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/dialogs/cal-prefs-dialog.c | 57 +++++++++++---------------------- 1 file changed, 19 insertions(+), 38 deletions(-) (limited to 'calendar/gui/dialogs/cal-prefs-dialog.c') 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 ()); -- cgit v1.2.3