aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2007-04-02 12:19:25 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2007-04-02 12:19:25 +0800
commitb5365bc587c99c0eb18293c4e70029782a185d56 (patch)
treec28ff26a508bcb3195b7b74868540f3c9ffc1458 /mail
parent7dd3f720c743488c2aac7b6a1cfcdb97b1c1ac70 (diff)
downloadgsoc2013-evolution-b5365bc587c99c0eb18293c4e70029782a185d56.tar.gz
gsoc2013-evolution-b5365bc587c99c0eb18293c4e70029782a185d56.tar.zst
gsoc2013-evolution-b5365bc587c99c0eb18293c4e70029782a185d56.zip
** Fixes bug #373116
2007-04-01 Matthew Barnes <mbarnes@redhat.com> ** Fixes bug #373116 * calendar/gui/calendar-component.c (ensure_sources): * calendar/gui/e-cal-model.c (ecm_get_color_for_component): * calendar/gui/memos-component.c (ensure_sources): * calendar/gui/migration.c (create_calendar_contact_source), (create_calendar_sources), (create_task_sources), (create_memo_sources), (add_gw_esource): * calendar/gui/tasks-component.c (ensure_sources): * plugins/groupwise-account-setup/camel-gw-listener.c (add_esource): Use the new ESource color API. * calendar/gui/dialogs/cal-prefs-dialog.c: * calendar/gui/dialogs/cal-prefs-dialog.glade: * calendar/gui/dialogs/calendar-setup.c: * calendar/gui/dialogs/calendar-setup.glade: * filter-colour.c (get_widget): * mail/em-composer-prefs.c: * mail/em-composer-prefs.h: * mail/em-mailer-prefs.c: * mail/em-mailer-prefs.h: * mail/mail-config.glade: Migrate from GnomeColorPicker to GtkColorButton. * filter/filter-colour.h: Store color as a GdkColor instead of separate RGBA components. * filter/filter-colour.c (color_eq): Use gdk_color_equal() to compare colors. * filter/filter-colour.c (xml_encode): Encode color as a single property ("spec"). * filter/filter-colour.c (xml_decode): Read the color from a single property ("spec"). Provide a migration path for old XML files. * calendar/gui/calendar-component.c (calendar_config_get_tasks_due_today_color), (calendar_config_get_tasks_overdue_color): Return a GdkColor instead of an X color specification. * calendar/gui/calendar-component.c (calendar_config_set_tasks_due_today_color), (calendar_config_set_tasks_overdue_color): Accept a GdkColor instead of an X color specification. * calenar/gui/e-cal-model-tasks.c (ecmt_get_color_for_component): Adapt to modified color API in calendar-component.c by converting the GdkColor to an X color specification. This is an ugly hack to be fixed later. svn path=/trunk/; revision=33349
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog11
-rw-r--r--mail/em-composer-prefs.c41
-rw-r--r--mail/em-composer-prefs.h3
-rw-r--r--mail/em-mailer-prefs.c71
-rw-r--r--mail/em-mailer-prefs.h5
-rw-r--r--mail/mail-config.glade23
6 files changed, 74 insertions, 80 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index c818437768..50346e240d 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,14 @@
+2007-04-01 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #373117
+
+ * em-composer-prefs.c:
+ * em-composer-prefs.h:
+ * em-mailer-prefs.c:
+ * em-mailer-prefs.h:
+ * mail-config.glade:
+ Migrate from GnomeColorPicker to GtkColorButton.
+
2007-03-30 Matthew Barnes <mbarnes@redhat.com>
* em-format-html-display.c (icon_entry_changed_cb): Fix a typo.
diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c
index 616f3a43ae..96813058ea 100644
--- a/mail/em-composer-prefs.c
+++ b/mail/em-composer-prefs.c
@@ -56,9 +56,8 @@
#include <gtk/gtkcellrenderertext.h>
#include <gtk/gtkimage.h>
#include <gtk/gtkstock.h>
-
+#include <gtk/gtkcolorbutton.h>
#include <gtk/gtkfilechooserbutton.h>
-#include <libgnomeui/gnome-color-picker.h>
#include <gtkhtml/gtkhtml.h>
@@ -545,7 +544,7 @@ spell_set_ui (EMComposerPrefs *prefs)
GtkTreeIter iter;
GError *err = NULL;
char **strv = NULL;
- guint r, g, b;
+ GdkColor color;
gboolean go;
char *lang;
int i;
@@ -580,21 +579,33 @@ spell_set_ui (EMComposerPrefs *prefs)
if (strv != NULL)
g_strfreev (strv);
- r = gconf_client_get_int (prefs->gconf, GNOME_SPELL_GCONF_DIR "/spell_error_color_red", NULL);
- g = gconf_client_get_int (prefs->gconf, GNOME_SPELL_GCONF_DIR "/spell_error_color_green", NULL);
- b = gconf_client_get_int (prefs->gconf, GNOME_SPELL_GCONF_DIR "/spell_error_color_blue", NULL);
-
- gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (prefs->colour), r, g, b, 0xffff);
+ color.red = gconf_client_get_int (prefs->gconf,
+ GNOME_SPELL_GCONF_DIR "/spell_error_color_red", NULL);
+ color.green = gconf_client_get_int (prefs->gconf,
+ GNOME_SPELL_GCONF_DIR "/spell_error_color_green", NULL);
+ color.blue = gconf_client_get_int (prefs->gconf,
+ GNOME_SPELL_GCONF_DIR "/spell_error_color_blue", NULL);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (prefs->color), &color);
prefs->spell_active = TRUE;
}
static void
-spell_color_set (GtkWidget *widget, guint r, guint g, guint b, guint a, EMComposerPrefs *prefs)
+spell_color_set (GtkColorButton *color_button, EMComposerPrefs *prefs)
{
- gconf_client_set_int (prefs->gconf, GNOME_SPELL_GCONF_DIR "/spell_error_color_red", r, NULL);
- gconf_client_set_int (prefs->gconf, GNOME_SPELL_GCONF_DIR "/spell_error_color_green", g, NULL);
- gconf_client_set_int (prefs->gconf, GNOME_SPELL_GCONF_DIR "/spell_error_color_blue", b, NULL);
+ GdkColor color;
+
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (color_button), &color);
+
+ gconf_client_set_int (prefs->gconf,
+ GNOME_SPELL_GCONF_DIR "/spell_error_color_red",
+ color.red, NULL);
+ gconf_client_set_int (prefs->gconf,
+ GNOME_SPELL_GCONF_DIR "/spell_error_color_green",
+ color.green, NULL);
+ gconf_client_set_int (prefs->gconf,
+ GNOME_SPELL_GCONF_DIR "/spell_error_color_blue",
+ color.blue, NULL);
}
static char *
@@ -676,7 +687,7 @@ spell_setup (EMComposerPrefs *prefs)
spell_set_ui (prefs);
- widget = glade_xml_get_widget (prefs->gui, "colorpickerSpellCheckColor");
+ widget = glade_xml_get_widget (prefs->gui, "colorButtonSpellCheckColor");
g_signal_connect (widget, "color_set", G_CALLBACK (spell_color_set), prefs);
}
@@ -922,7 +933,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
g_free (buf);
/* Spell Checking: GNOME Spell part */
- prefs->colour = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerSpellCheckColor"));
+ prefs->color = GTK_COLOR_BUTTON (glade_xml_get_widget (gui, "colorButtonSpellCheckColor"));
prefs->language = GTK_TREE_VIEW (glade_xml_get_widget (gui, "listSpellCheckLanguage"));
model = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER);
gtk_tree_view_set_model (prefs->language, (GtkTreeModel *) model);
@@ -942,7 +953,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
info_pixmap = glade_xml_get_widget (gui, "pixmapSpellInfo");
gtk_image_set_from_stock (GTK_IMAGE (info_pixmap), GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_BUTTON);
if (!spell_setup_check_options (prefs)) {
- gtk_widget_hide (GTK_WIDGET (prefs->colour));
+ gtk_widget_hide (GTK_WIDGET (prefs->color));
gtk_widget_hide (GTK_WIDGET (prefs->language));
}
diff --git a/mail/em-composer-prefs.h b/mail/em-composer-prefs.h
index ca64ead692..ecdbb22f3f 100644
--- a/mail/em-composer-prefs.h
+++ b/mail/em-composer-prefs.h
@@ -48,7 +48,6 @@ struct _GtkOptionMenu;
struct _GdkPixbuf;
struct _GtkWidget;
struct _GladeXML;
-struct _GnomeColorPicker;
struct _GConfClient;
struct _GtkButton;
struct _GtkTreeView;
@@ -71,7 +70,7 @@ struct _EMComposerPrefs {
struct _GtkOptionMenu *charset;
struct _GtkToggleButton *spell_check;
- struct _GnomeColorPicker *colour;
+ struct _GtkColorButton *color;
struct _GtkTreeView *language;
CORBA_sequence_GNOME_Spell_Language *language_seq;
gboolean spell_active;
diff --git a/mail/em-mailer-prefs.c b/mail/em-mailer-prefs.c
index c552ad7e92..064ef1256a 100644
--- a/mail/em-mailer-prefs.c
+++ b/mail/em-mailer-prefs.c
@@ -35,7 +35,7 @@
#include "misc/e-charset-picker.h"
#include <bonobo/bonobo-generic-factory.h>
-#include <libgnomeui/gnome-color-picker.h>
+#include <gtk/gtkcolorbutton.h>
#include <gtk/gtkfilechooserbutton.h>
#include <gtk/gtkfontbutton.h>
@@ -157,49 +157,27 @@ em_mailer_prefs_finalise (GObject *obj)
static void
-colorpicker_set_color (GnomeColorPicker *color, const char *str)
+color_button_set_color (GtkColorButton *color_button, const gchar *spec)
{
- GdkColor colour;
- guint32 rgb;
-
- gdk_color_parse (str, &colour);
- rgb = ((colour.red & 0xff00) << 8) | (colour.green & 0xff00) | ((colour.blue & 0xff00) >> 8);
-
- gnome_color_picker_set_i8 (color, (rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff, 0xff);
-}
+ GdkColor color;
-static guint32
-colorpicker_get_color (GnomeColorPicker *color)
-{
- guint8 r, g, b, a;
- guint32 rgb = 0;
-
- gnome_color_picker_get_i8 (color, &r, &g, &b, &a);
-
- rgb = r;
- rgb <<= 8;
- rgb |= g;
- rgb <<= 8;
- rgb |= b;
-
- return rgb;
+ if (gdk_color_parse (spec, &color))
+ gtk_color_button_set_color (color_button, &color);
}
static void
-citation_color_set (GtkWidget *widget, guint r, guint g, guint b, guint a, EMMailerPrefs *prefs)
+citation_color_set (GtkColorButton *color_button, EMMailerPrefs *prefs)
{
- guint32 rgb = 0;
- char buf[20];
-
- rgb = r & 0xff;
- rgb <<= 8;
- rgb |= g & 0xff;
- rgb <<= 8;
- rgb |= b & 0xff;
-
- sprintf (buf, "#%06x", rgb & 0xffffff);
-
- gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/display/citation_colour", buf, NULL);
+ GdkColor color;
+ gchar spec[16];
+
+ gtk_color_button_get_color (color_button, &color);
+ g_snprintf (spec, sizeof (spec), "#%04x%04x%04x",
+ color.red, color.green, color.blue);
+
+ gconf_client_set_string (prefs->gconf,
+ "/apps/evolution/mail/display/citation_colour",
+ spec, NULL);
}
static void
@@ -212,9 +190,12 @@ labels_changed (EMMailerPrefs *prefs)
int i;
for (i = 4; i >= 0; i--) {
+ GdkColor color;
+
cstring = gtk_entry_get_text (prefs->labels[i].name);
- rgb = colorpicker_get_color (prefs->labels[i].color);
- string = g_strdup_printf ("%s:#%06x", cstring, rgb & 0xffffff);
+ gtk_color_button_get_color (prefs->labels[i].color, &color);
+ string = g_strdup_printf ("%s:#%04x%04x%04x", cstring,
+ color.red, color.green, color.blue);
list = g_slist_prepend (list, string);
}
@@ -249,7 +230,7 @@ restore_labels_clicked (GtkWidget *widget, gpointer user_data)
for (i = 0; i < 5; i++) {
gtk_entry_set_text (prefs->labels[i].name, _(label_defaults[i].name));
- colorpicker_set_color (prefs->labels[i].color, label_defaults[i].colour);
+ color_button_set_color (prefs->labels[i].color, label_defaults[i].colour);
atk_object_set_name(gtk_widget_get_accessible((GtkWidget *)prefs->labels[i].color), _(label_defaults[i].name));
}
}
@@ -812,9 +793,9 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
"/apps/evolution/mail/display/mark_citations",
G_CALLBACK (toggle_button_toggled));
- prefs->citation_color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerHighlightCitations"));
+ prefs->citation_color = GTK_COLOR_BUTTON (glade_xml_get_widget (gui, "colorButtonHighlightCitations"));
buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/citation_colour", NULL);
- colorpicker_set_color (prefs->citation_color, buf ? buf : "#737373");
+ color_button_set_color (prefs->citation_color, buf ? buf : "#737373");
g_signal_connect (prefs->citation_color, "color-set", G_CALLBACK (citation_color_set), prefs);
if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/citation_colour", NULL))
gtk_widget_set_sensitive ((GtkWidget *) prefs->citation_color, FALSE);
@@ -935,14 +916,14 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
g_free (widget_name);
widget_name = g_strdup_printf ("colorLabel%d", i);
- prefs->labels[i].color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, widget_name));
+ prefs->labels[i].color = GTK_COLOR_BUTTON (glade_xml_get_widget (gui, widget_name));
gtk_widget_set_sensitive ((GtkWidget *) prefs->labels[i].color, !locked);
g_free (widget_name);
gtk_entry_set_text (prefs->labels[i].name, label->name);
g_signal_connect (prefs->labels[i].name, "changed", G_CALLBACK (label_entry_changed), prefs);
- colorpicker_set_color (prefs->labels[i].color, label->colour);
+ color_button_set_color (prefs->labels[i].color, label->colour);
g_signal_connect (prefs->labels[i].color, "color-set", G_CALLBACK (label_color_set), prefs);
atk_object_set_name(gtk_widget_get_accessible((GtkWidget *)prefs->labels[i].color), label->name);
diff --git a/mail/em-mailer-prefs.h b/mail/em-mailer-prefs.h
index 582938a2d9..9a8222a3ba 100644
--- a/mail/em-mailer-prefs.h
+++ b/mail/em-mailer-prefs.h
@@ -37,7 +37,6 @@ struct _GtkOptionMenu;
struct _GdkPixbuf;
struct _GtkWidget;
struct _GladeXML;
-struct _GnomeColorPicker;
struct _GtkFileChooserbutton;
struct _GtkFontButton;
struct _GConfClient;
@@ -80,7 +79,7 @@ struct _EMMailerPrefs {
struct _GtkSpinButton *mlimit_count;
struct _GtkOptionMenu *charset;
struct _GtkToggleButton *citation_highlight;
- struct _GnomeColorPicker *citation_color;
+ struct _GtkColorButton *citation_color;
/* Deleting Mail */
struct _GtkToggleButton *empty_trash;
@@ -110,7 +109,7 @@ struct _EMMailerPrefs {
/* Labels and Colours tab */
struct {
struct _GtkEntry *name;
- struct _GnomeColorPicker *color;
+ struct _GtkColorButton *color;
} labels[5];
struct _GtkButton *restore_labels;
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 9a14bd8881..6a1442b88b 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -5139,10 +5139,9 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</child>
<child>
- <widget class="GnomeColorPicker" id="colorpickerHighlightCitations">
+ <widget class="GtkColorButton" id="colorButtonHighlightCitations">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="dither">True</property>
<property name="use_alpha">False</property>
<property name="title" translatable="yes">Pick a color</property>
<property name="focus_on_click">True</property>
@@ -6080,10 +6079,9 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
<property name="column_spacing">6</property>
<child>
- <widget class="GnomeColorPicker" id="colorLabel0">
+ <widget class="GtkColorButton" id="colorLabel0">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="dither">True</property>
<property name="use_alpha">False</property>
<property name="title" translatable="yes">Pick a color</property>
<property name="focus_on_click">True</property>
@@ -6099,10 +6097,9 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</child>
<child>
- <widget class="GnomeColorPicker" id="colorLabel1">
+ <widget class="GtkColorButton" id="colorLabel1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="dither">True</property>
<property name="use_alpha">False</property>
<property name="title" translatable="yes">Pick a color</property>
<property name="focus_on_click">True</property>
@@ -6118,10 +6115,9 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</child>
<child>
- <widget class="GnomeColorPicker" id="colorLabel2">
+ <widget class="GtkColorButton" id="colorLabel2">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="dither">True</property>
<property name="use_alpha">False</property>
<property name="title" translatable="yes">Pick a color</property>
<property name="focus_on_click">True</property>
@@ -6137,10 +6133,9 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</child>
<child>
- <widget class="GnomeColorPicker" id="colorLabel3">
+ <widget class="GtkColorButton" id="colorLabel3">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="dither">True</property>
<property name="use_alpha">False</property>
<property name="title" translatable="yes">Pick a color</property>
<property name="focus_on_click">True</property>
@@ -6156,10 +6151,9 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</child>
<child>
- <widget class="GnomeColorPicker" id="colorLabel4">
+ <widget class="GtkColorButton" id="colorLabel4">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="dither">True</property>
<property name="use_alpha">False</property>
<property name="title" translatable="yes">Pick a color</property>
<property name="focus_on_click">True</property>
@@ -8316,7 +8310,7 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">colorpickerSpellCheckColor</property>
+ <property name="mnemonic_widget">colorButtonSpellCheckColor</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -8330,10 +8324,9 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</child>
<child>
- <widget class="GnomeColorPicker" id="colorpickerSpellCheckColor">
+ <widget class="GtkColorButton" id="colorButtonSpellCheckColor">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="dither">True</property>
<property name="use_alpha">False</property>
<property name="title" translatable="yes">Pick a color</property>
<property name="focus_on_click">True</property>