diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-04-02 12:19:25 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-04-02 12:19:25 +0800 |
commit | b5365bc587c99c0eb18293c4e70029782a185d56 (patch) | |
tree | c28ff26a508bcb3195b7b74868540f3c9ffc1458 /calendar/gui/calendar-config.c | |
parent | 7dd3f720c743488c2aac7b6a1cfcdb97b1c1ac70 (diff) | |
download | gsoc2013-evolution-b5365bc587c99c0eb18293c4e70029782a185d56.tar gsoc2013-evolution-b5365bc587c99c0eb18293c4e70029782a185d56.tar.gz gsoc2013-evolution-b5365bc587c99c0eb18293c4e70029782a185d56.tar.bz2 gsoc2013-evolution-b5365bc587c99c0eb18293c4e70029782a185d56.tar.lz gsoc2013-evolution-b5365bc587c99c0eb18293c4e70029782a185d56.tar.xz 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 'calendar/gui/calendar-config.c')
-rw-r--r-- | calendar/gui/calendar-config.c | 84 |
1 files changed, 60 insertions, 24 deletions
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); + } } /** |