From b5365bc587c99c0eb18293c4e70029782a185d56 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 2 Apr 2007 04:19:25 +0000 Subject: ** Fixes bug #373116 2007-04-01 Matthew Barnes ** 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 --- calendar/gui/calendar-component.c | 2 +- calendar/gui/calendar-config.c | 84 +++++++++++----- calendar/gui/calendar-config.h | 9 +- calendar/gui/dialogs/cal-prefs-dialog.c | 57 ++++------- calendar/gui/dialogs/cal-prefs-dialog.glade | 6 +- calendar/gui/dialogs/calendar-setup.c | 142 ++++++++++++++-------------- calendar/gui/dialogs/calendar-setup.glade | 6 +- calendar/gui/e-cal-model-tasks.c | 18 +++- calendar/gui/e-cal-model.c | 7 +- calendar/gui/memos-component.c | 2 +- calendar/gui/migration.c | 10 +- calendar/gui/tasks-component.c | 2 +- 12 files changed, 185 insertions(+), 160 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 17824272b4..d528202a50 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -252,7 +252,7 @@ ensure_sources (CalendarComponent *component) } g_free (primary_calendar); - e_source_set_color (personal_source, 0xBECEDD); + e_source_set_color_spec (personal_source, "#BECEDD"); } if (!on_the_web) { diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 6ec6386a79..9a1221274e 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -1219,68 +1219,104 @@ on_timezone_dialog_delete_event (GnomeDialog *dialog, /** * calendar_config_get_tasks_due_today_color: + * @color: the location to store the color * * Queries the color to be used to display tasks that are due today. - * - * Return value: An X color specification. **/ -const char * -calendar_config_get_tasks_due_today_color (void) +void +calendar_config_get_tasks_due_today_color (GdkColor *color) { - static char *color = NULL; + const gchar *key = CALENDAR_CONFIG_TASKS_DUE_TODAY_COLOR; + GError *error = NULL; + gchar *color_spec; - if (color) - g_free (color); + g_return_if_fail (color != NULL); - color = gconf_client_get_string (config, CALENDAR_CONFIG_TASKS_DUE_TODAY_COLOR, NULL); - return color; + color_spec = gconf_client_get_string (config, key, &error); + + if (color_spec != NULL && !gdk_color_parse (color_spec, color)) + g_warning ("Unknown color \"%s\"", color_spec); + else if (error != NULL) { + g_warning ("%s", error->message); + g_error_free (error); + } + + g_free (color_spec); } /** * calendar_config_set_tasks_due_today_color: - * @color: X color specification + * @color: a #GdkColor * * Sets the color to be used to display tasks that are due today. **/ void -calendar_config_set_tasks_due_today_color (const char *color) +calendar_config_set_tasks_due_today_color (GdkColor *color) { + const gchar *key = CALENDAR_CONFIG_TASKS_DUE_TODAY_COLOR; + GError *error = NULL; + gchar color_spec[16]; + g_return_if_fail (color != NULL); - gconf_client_set_string (config, CALENDAR_CONFIG_TASKS_DUE_TODAY_COLOR, color, NULL); + g_snprintf (color_spec, sizeof (color_spec), "#%04x%04x%04x", + color->red, color->green, color->blue); + + if (!gconf_client_set_string (config, key, color_spec, &error)) { + g_warning ("%s", error->message); + g_error_free (error); + } } /** * calendar_config_get_tasks_overdue_color: + * @color: the location to store the color * * Queries the color to be used to display overdue tasks. - * - * Return value: An X color specification. **/ -const char * -calendar_config_get_tasks_overdue_color (void) +void +calendar_config_get_tasks_overdue_color (GdkColor *color) { - static char *color = NULL; + const gchar *key = CALENDAR_CONFIG_TASKS_OVERDUE_COLOR; + GError *error = NULL; + gchar *color_spec; - if (color) - g_free (color); + g_return_if_fail (color != NULL); - color = gconf_client_get_string (config, CALENDAR_CONFIG_TASKS_OVERDUE_COLOR, NULL); - return color; + color_spec = gconf_client_get_string (config, key, &error); + + if (color_spec != NULL && !gdk_color_parse (color_spec, color)) + g_warning ("Unknown color \"%s\"", color_spec); + else if (error != NULL) { + g_warning ("%s", error->message); + g_error_free (error); + } + + g_free (color_spec); } /** * calendar_config_set_tasks_overdue_color: - * @color: X color specification + * @color: a #GdkColor * * Sets the color to be used to display overdue tasks. **/ void -calendar_config_set_tasks_overdue_color (const char *color) +calendar_config_set_tasks_overdue_color (GdkColor *color) { + const gchar *key = CALENDAR_CONFIG_TASKS_OVERDUE_COLOR; + GError *error = NULL; + gchar color_spec[16]; + g_return_if_fail (color != NULL); - gconf_client_set_string (config, CALENDAR_CONFIG_TASKS_OVERDUE_COLOR, color, NULL); + g_snprintf (color_spec, sizeof (color_spec), "#%04x%04x%04x", + color->red, color->green, color->blue); + + if (!gconf_client_set_string (config, key, color_spec, &error)) { + g_warning ("%s", error->message); + g_error_free (error); + } } /** diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index 9b97c1e6c2..8e24792647 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -31,6 +31,7 @@ #define _CALENDAR_CONFIG_H_ #include +#include #include #include @@ -201,11 +202,11 @@ void calendar_config_set_primary_memos (const char *primary_uid); guint calendar_config_add_notification_primary_memos (GConfClientNotifyFunc func, gpointer data); /* Colors for the task list */ -const char *calendar_config_get_tasks_due_today_color (void); -void calendar_config_set_tasks_due_today_color (const char *color); +void calendar_config_get_tasks_due_today_color (GdkColor *color); +void calendar_config_set_tasks_due_today_color (GdkColor *color); -const char *calendar_config_get_tasks_overdue_color (void); -void calendar_config_set_tasks_overdue_color (const char *color); +void calendar_config_get_tasks_overdue_color (GdkColor *color); +void calendar_config_set_tasks_overdue_color (GdkColor *color); /* Settings to hide completed tasks. */ gboolean calendar_config_get_hide_completed_tasks (void); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 38f9ed50a6..665f76d2c6 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -31,7 +31,6 @@ #include "../e-timezone-entry.h" #include "../calendar-config.h" #include "cal-prefs-dialog.h" -#include #include #include #include @@ -95,21 +94,6 @@ eccp_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget return glade_xml_get_widget (prefs->gui, item->label); } -/* Returns a pointer to a static string with an X color spec for the current - * value of a color picker. - */ -static const char * -spec_from_picker (GtkWidget *picker) -{ - static char spec[8]; - guint8 r, g, b; - - gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (picker), &r, &g, &b, NULL); - g_snprintf (spec, sizeof (spec), "#%02x%02x%02x", r, g, b); - - return spec; -} - static void working_days_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { @@ -276,15 +260,21 @@ hide_completed_tasks_units_changed (GtkWidget *widget, CalendarPrefsDialog *pref } static void -tasks_due_today_set_color (GnomeColorPicker *picker, guint r, guint g, guint b, guint a, CalendarPrefsDialog *prefs) +tasks_due_today_set_color (GtkColorButton *color_button, CalendarPrefsDialog *prefs) { - calendar_config_set_tasks_due_today_color (spec_from_picker (prefs->tasks_due_today_color)); + GdkColor color; + + gtk_color_button_get_color (color_button, &color); + calendar_config_set_tasks_due_today_color (&color); } static void -tasks_overdue_set_color (GnomeColorPicker *picker, guint r, guint g, guint b, guint a, CalendarPrefsDialog *prefs) +tasks_overdue_set_color (GtkColorButton *color_button, CalendarPrefsDialog *prefs) { - calendar_config_set_tasks_overdue_color (spec_from_picker (prefs->tasks_overdue_color)); + GdkColor color; + + gtk_color_button_get_color (color_button, &color); + calendar_config_set_tasks_overdue_color (&color); } static void @@ -416,22 +406,6 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->template_url), "changed", G_CALLBACK (template_url_changed), prefs); } -/* Sets the color in a color picker from an X color spec */ -static void -set_color_picker (GtkWidget *picker, const char *spec) -{ - GdkColor color; - - if (!spec || !gdk_color_parse (spec, &color)) - color.red = color.green = color.blue = 0; - - gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (picker), - color.red, - color.green, - color.blue, - 65535); -} - /* Shows the current Free/Busy settings in the dialog */ static void show_fb_config (CalendarPrefsDialog *prefs) @@ -448,11 +422,18 @@ show_fb_config (CalendarPrefsDialog *prefs) static void show_task_list_config (CalendarPrefsDialog *prefs) { + GtkColorButton *color_button; + GdkColor color; CalUnits units; gboolean hide_completed_tasks = FALSE; - set_color_picker (prefs->tasks_due_today_color, calendar_config_get_tasks_due_today_color ()); - set_color_picker (prefs->tasks_overdue_color, calendar_config_get_tasks_overdue_color ()); + color_button = GTK_COLOR_BUTTON (prefs->tasks_due_today_color); + calendar_config_get_tasks_due_today_color (&color); + gtk_color_button_set_color (color_button, &color); + + color_button = GTK_COLOR_BUTTON (prefs->tasks_overdue_color); + calendar_config_get_tasks_overdue_color (&color); + gtk_color_button_set_color (color_button, &color); /* Hide Completed Tasks. */ e_dialog_toggle_set (prefs->tasks_hide_completed, calendar_config_get_hide_completed_tasks ()); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index 92ca58e1c6..18c9421b11 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -1231,10 +1231,9 @@ Days - + True True - True False Pick a color True @@ -1250,10 +1249,9 @@ Days - + True True - True False Pick a color True diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index 4e679054e6..543a3555c7 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -72,29 +72,6 @@ eccp_check_complete (EConfig *ec, const char *pageid, void *data) return valid; } -static void -colorpicker_set_color (GnomeColorPicker *color, guint32 rgb) -{ - gnome_color_picker_set_i8 (color, (rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff, 0xff); -} - -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; -} - static void eccp_commit (EConfig *ec, GSList *items, void *data) { @@ -102,15 +79,16 @@ eccp_commit (EConfig *ec, GSList *items, void *data) xmlNodePtr xml; if (sdialog->original_source) { - guint32 color; + const gchar *color_spec; xml = xmlNewNode (NULL, "dummy"); e_source_dump_to_xml_node (sdialog->source, xml); e_source_update_from_xml_node (sdialog->original_source, xml->children, NULL); xmlFreeNode (xml); - if (e_source_get_color (sdialog->source, &color)) - e_source_set_color (sdialog->original_source, color); + color_spec = e_source_peek_color_spec (sdialog->source); + if (color_spec != NULL) + e_source_set_color_spec (sdialog->original_source, color_spec); } else { e_source_group_add_source (sdialog->source_group, sdialog->source, -1); e_source_list_sync (sdialog->source_list, NULL); @@ -304,63 +282,80 @@ eccp_general_offline (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, } static void -color_changed (GnomeColorPicker *picker, guint r, guint g, guint b, guint a, ECalConfigTargetSource *t) +color_changed (GtkColorButton *color_button, ECalConfigTargetSource *target) { - ESource *source = t->source; - e_source_set_color (source, colorpicker_get_color (picker)); + ESource *source = target->source; + gchar color_spec[16]; + GdkColor color; + + gtk_color_button_get_color (color_button, &color); + g_snprintf (color_spec, sizeof (color_spec), "#%04x%04x%04x", + color.red, color.green, color.blue); + e_source_set_color_spec (source, color_spec); +} + +static const gchar * +choose_initial_color (void) +{ + static const gchar *colors[] = { + "#BECEDD", /* 190 206 221 Blue */ + "#E2F0EF", /* 226 240 239 Light Blue */ + "#C6E2B7", /* 198 226 183 Green */ + "#E2F0D3", /* 226 240 211 Light Green */ + "#E2D4B7", /* 226 212 183 Khaki */ + "#EAEAC1", /* 234 234 193 Light Khaki */ + "#F0B8B7", /* 240 184 183 Pink */ + "#FED4D3", /* 254 212 211 Light Pink */ + "#E2C6E1", /* 226 198 225 Purple */ + "#F0E2EF" /* 240 226 239 Light Purple */ + }; + + return colors[g_random_int_range (0, G_N_ELEMENTS (colors))]; } static GtkWidget * eccp_get_source_color (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, void *data) { CalendarSourceDialog *sdialog = data; - static GtkWidget *label, *picker; - int row; - ECalConfigTargetSource *t = (ECalConfigTargetSource *) ec->target; - static guint32 assigned_colors[] = { - 0xBECEDD, /* 190 206 221 Blue */ - 0xE2F0EF, /* 226 240 239 Light Blue */ - 0xC6E2B7, /* 198 226 183 Green */ - 0xE2F0D3, /* 226 240 211 Light Green */ - 0xE2D4B7, /* 226 212 183 Khaki */ - 0xEAEAC1, /* 234 234 193 Light Khaki */ - 0xF0B8B7, /* 240 184 183 Pink */ - 0xFED4D3, /* 254 212 211 Light Pink */ - 0xE2C6E1, /* 226 198 225 Purple */ - 0xF0E2EF /* 240 226 239 Light Purple */ - }; - GRand *rand = g_rand_new (); - guint32 color; + static GtkWidget *label, *color_button; + guint row = GTK_TABLE (parent)->nrows; + const gchar *color_spec = NULL; + GdkColor color; if (old) gtk_widget_destroy (label); - row = ((GtkTable*)parent)->nrows; + if (sdialog->original_source) + color_spec = e_source_peek_color_spec (sdialog->original_source); - color = assigned_colors[g_rand_int_range (rand, 0, 9)]; - g_rand_free (rand); + if (color_spec == NULL) { + color_spec = choose_initial_color (); + e_source_set_color_spec (sdialog->source, color_spec); + } + + if (!gdk_color_parse (color_spec, &color)) + g_warning ("Unknown color \"%s\" in calendar \"%s\"", + color_spec, e_source_peek_name (sdialog->source)); label = gtk_label_new_with_mnemonic (_("C_olor:")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_table_attach ( + GTK_TABLE (parent), label, + 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); gtk_widget_show (label); - gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row, row+1, GTK_FILL, 0, 0, 0); - picker = gnome_color_picker_new (); - gtk_widget_show (picker); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), picker); - gtk_table_attach (GTK_TABLE (parent), picker, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); - g_signal_connect (G_OBJECT (picker), "color-set", G_CALLBACK (color_changed), t); - - if (sdialog->original_source) - e_source_get_color (sdialog->original_source, &color); - else - /* since we don't have an original source here, we want to set - * the initial color */ - e_source_set_color (sdialog->source, color); + color_button = gtk_color_button_new_with_color (&color); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), color_button); + gtk_table_attach ( + GTK_TABLE (parent), color_button, + 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); + gtk_widget_show (color_button); - colorpicker_set_color (GNOME_COLOR_PICKER (picker), color); + g_signal_connect ( + G_OBJECT (color_button), "color-set", + G_CALLBACK (color_changed), ec->target); - return picker; + return color_button; } static ECalConfigItem eccp_items[] = { @@ -414,7 +409,7 @@ calendar_setup_edit_calendar (struct _GtkWindow *parent, ESource *source, ESourc ECalConfigTargetSource *target; if (source) { - guint32 color; + const gchar *color_spec; sdialog->original_source = source; g_object_ref (source); @@ -423,8 +418,9 @@ calendar_setup_edit_calendar (struct _GtkWindow *parent, ESource *source, ESourc sdialog->source = e_source_new_from_standalone_xml (xml); g_free (xml); - if (e_source_get_color (source, &color)) - e_source_set_color (sdialog->source, color); + color_spec = e_source_peek_color_spec (source); + if (color_spec != NULL) + e_source_set_color_spec (sdialog->source, color_spec); } else { GConfClient *gconf; GSList *l, *ptr, *temp = NULL; @@ -504,7 +500,7 @@ calendar_setup_edit_task_list (struct _GtkWindow *parent, ESource *source) ECalConfigTargetSource *target; if (source) { - guint32 color; + const gchar *color_spec; sdialog->original_source = source; g_object_ref (source); @@ -513,8 +509,8 @@ calendar_setup_edit_task_list (struct _GtkWindow *parent, ESource *source) sdialog->source = e_source_new_from_standalone_xml (xml); g_free (xml); - e_source_get_color (source, &color); - e_source_set_color (sdialog->source, color); + color_spec = e_source_peek_color_spec (source); + e_source_set_color_spec (sdialog->source, color_spec); } else { GConfClient *gconf; GSList *l, *ptr, *temp = NULL; @@ -589,7 +585,7 @@ calendar_setup_edit_memo_list (struct _GtkWindow *parent, ESource *source) ECalConfigTargetSource *target; if (source) { - guint32 color; + const gchar *color_spec; sdialog->original_source = source; g_object_ref (source); @@ -598,8 +594,8 @@ calendar_setup_edit_memo_list (struct _GtkWindow *parent, ESource *source) sdialog->source = e_source_new_from_standalone_xml (xml); g_free (xml); - e_source_get_color (source, &color); - e_source_set_color (sdialog->source, color); + color_spec = e_source_peek_color_spec (source); + e_source_set_color_spec (sdialog->source, color_spec); } else { GConfClient *gconf; GSList *l; diff --git a/calendar/gui/dialogs/calendar-setup.glade b/calendar/gui/dialogs/calendar-setup.glade index da2947d9c7..75631fe1fc 100644 --- a/calendar/gui/dialogs/calendar-setup.glade +++ b/calendar/gui/dialogs/calendar-setup.glade @@ -338,10 +338,9 @@ - + True True - True False Pick a color True @@ -587,10 +586,9 @@ - + True True - True False Pick a color True diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c index b481c52048..cb989b0845 100644 --- a/calendar/gui/e-cal-model-tasks.c +++ b/calendar/gui/e-cal-model-tasks.c @@ -1025,14 +1025,28 @@ ecmt_value_to_string (ETableModel *etm, int col, const void *value) static const char * ecmt_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data) { + static gchar color_spec[16]; + GdkColor color; + g_return_val_if_fail (E_IS_CAL_MODEL_TASKS (model), NULL); g_return_val_if_fail (comp_data != NULL, NULL); + /* XXX ECalModel's get_color_for_component() method should really + * get a GdkColor instead of a color specification string. */ + switch (get_due_status ((ECalModelTasks *) model, comp_data)) { case E_CAL_MODEL_TASKS_DUE_TODAY: - return calendar_config_get_tasks_due_today_color (); + /* XXX ugly hack */ + calendar_config_get_tasks_due_today_color (&color); + g_snprintf (color_spec, sizeof (color_spec), "#%04x%04x%04x", + color.red, color.green, color.blue); + return color_spec; case E_CAL_MODEL_TASKS_DUE_OVERDUE: - return calendar_config_get_tasks_overdue_color (); + /* XXX ugly hack */ + calendar_config_get_tasks_overdue_color (&color); + g_snprintf (color_spec, sizeof (color_spec), "#%04x%04x%04x", + color.red, color.green, color.blue); + return color_spec; case E_CAL_MODEL_TASKS_DUE_NEVER: case E_CAL_MODEL_TASKS_DUE_FUTURE: case E_CAL_MODEL_TASKS_DUE_COMPLETE: diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 19bd29e8f7..78afb704a3 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -947,7 +947,7 @@ static const char * ecm_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data) { ESource *source; - guint32 source_color; + const gchar *color_spec; gint i, first_empty = 0; static AssignedColorData assigned_colors[] = { { "#BECEDD", NULL }, /* 190 206 221 Blue */ @@ -965,9 +965,10 @@ ecm_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data) g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL); source = e_cal_get_source (comp_data->client); - if (e_source_get_color (source, &source_color)) { + color_spec = e_source_peek_color_spec (source); + if (color_spec != NULL) { g_free (comp_data->color); - comp_data->color = g_strdup_printf ("#%06x", source_color & 0xffffff); + comp_data->color = g_strdup (color_spec); return comp_data->color; } diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c index 81d3208cd2..b304a41dbd 100644 --- a/calendar/gui/memos-component.c +++ b/calendar/gui/memos-component.c @@ -213,7 +213,7 @@ ensure_sources (MemosComponent *component) calendar_config_set_memos_selected (&selected); } - e_source_set_color (source, 0xBECEDD); + e_source_set_color_spec (source, "#BECEDD"); personal_source = source; } diff --git a/calendar/gui/migration.c b/calendar/gui/migration.c index feffff101f..65c759ce40 100644 --- a/calendar/gui/migration.c +++ b/calendar/gui/migration.c @@ -406,7 +406,7 @@ create_calendar_contact_source (ESourceList *source_list) e_source_group_add_source (group, source, -1); g_object_unref (source); - e_source_set_color (source, 0xFED4D3); + e_source_set_color_spec (source, "#FED4D3"); e_source_group_set_readonly (group, TRUE); return group; @@ -497,7 +497,7 @@ create_calendar_sources (CalendarComponent *component, } g_free (primary_calendar); - e_source_set_color (source, 0xBECEDD); + e_source_set_color_spec (source, "#BECEDD"); *personal_source = source; } @@ -590,7 +590,7 @@ create_task_sources (TasksComponent *component, calendar_config_set_tasks_selected (&selected); } - e_source_set_color (source, 0xBECEDD); + e_source_set_color_spec (source, "#BECEDD"); *personal_source = source; } @@ -1098,7 +1098,7 @@ create_memo_sources (MemosComponent *component, calendar_config_set_memos_selected (&selected); } - e_source_set_color (source, 0xBECEDD); + e_source_set_color_spec (source, "#BECEDD"); *personal_source = source; } @@ -1161,7 +1161,7 @@ add_gw_esource (ESourceList *source_list, const char *group_name, const char *s e_source_set_property (source, "use_ssl", use_ssl); e_source_set_property (source, "offline_sync", offline_sync ? "1" : "0" ); - e_source_set_color (source, 0xEEBC60); + e_source_set_color_spec (source, "#EEBC60"); e_source_group_add_source (group, source, -1); ids = gconf_client_get_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, NULL); diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 4e9643dc92..2fc9bc8d62 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -209,7 +209,7 @@ ensure_sources (TasksComponent *component) calendar_config_set_tasks_selected (&selected); } - e_source_set_color (source, 0xBECEDD); + e_source_set_color_spec (source, "#BECEDD"); personal_source = source; } -- cgit v1.2.3