diff options
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/alarm-notify/alarm-notify.c | 9 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/config-data.c | 121 | ||||
-rw-r--r-- | calendar/gui/calendar-config.c | 90 | ||||
-rw-r--r-- | calendar/gui/calendar-config.h | 13 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 39 | ||||
-rw-r--r-- | calendar/gui/e-day-view-time-item.c | 21 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 43 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 6 |
8 files changed, 153 insertions, 189 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index e612b0c56c..3b5402b4a6 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -37,9 +37,7 @@ #include "alarm-queue.h" #include "config-data.h" -#define ALARM_NOTIFY_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), TYPE_ALARM_NOTIFY, AlarmNotifyPrivate)) +#define APPLICATION_ID "org.gnome.EvolutionAlarmNotify" #define APPLICATION_ID "org.gnome.EvolutionAlarmNotify" @@ -222,7 +220,7 @@ alarm_notify_finalize (GObject *object) AlarmNotifyPrivate *priv; gint ii; - priv = ALARM_NOTIFY_GET_PRIVATE (object); + priv = ALARM_NOTIFY (object)->priv; for (ii = 0; ii < E_CAL_CLIENT_SOURCE_TYPE_LAST; ii++) { g_hash_table_foreach ( @@ -311,7 +309,8 @@ alarm_notify_init (AlarmNotify *an) { gint ii; - an->priv = ALARM_NOTIFY_GET_PRIVATE (an); + an->priv = G_TYPE_INSTANCE_GET_PRIVATE ( + an, TYPE_ALARM_NOTIFY, AlarmNotifyPrivate); an->priv->mutex = g_mutex_new (); an->priv->selected_calendars = config_data_get_calendars ( "/apps/evolution/calendar/sources"); diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c index 567ca69c09..b9f2be49a3 100644 --- a/calendar/gui/alarm-notify/config-data.c +++ b/calendar/gui/alarm-notify/config-data.c @@ -30,14 +30,11 @@ #include <libedataserver/e-source-list.h> #include "config-data.h" -#define KEY_LAST_NOTIFICATION_TIME \ - "/apps/evolution/calendar/notify/last_notification_time" -#define KEY_PROGRAMS "/apps/evolution/calendar/notify/programs" - /* Whether we have initied ourselves by reading * the data from the configuration engine. */ static gboolean inited = FALSE; static GConfClient *conf_client = NULL; +static GSettings *calendar_settings = NULL; static ESourceList *calendar_source_list = NULL, *tasks_source_list = NULL; /* Copied from ../calendar-config.c; returns whether the locale has 'am' and @@ -69,6 +66,9 @@ do_cleanup (void) g_object_unref (conf_client); conf_client = NULL; + g_object_unref (calendar_settings); + calendar_settings = FALSE; + inited = FALSE; } @@ -87,6 +87,8 @@ ensure_inited (void) return; } + calendar_settings = g_settings_new ("org.gnome.evolution.calendar"); + g_atexit ((GVoidFunc) do_cleanup); /* load the sources for calendars and tasks */ @@ -104,8 +106,10 @@ config_data_get_calendars (const gchar *key) gboolean state; GSList *gconf_list; - if (!inited) + if (!inited) { conf_client = gconf_client_get_default (); + calendar_settings = g_settings_new ("org.gnome.evolution.calendar"); + } gconf_list = gconf_client_get_list (conf_client, key, @@ -119,15 +123,11 @@ config_data_get_calendars (const gchar *key) return cal_sources; } - state = gconf_client_get_bool (conf_client, - "/apps/evolution/calendar/notify/notify_with_tray", - NULL); + state = g_settings_get_boolean (calendar_settings, "notify-with-tray"); if (!state) /* Should be old client */ { GSList *source; - gconf_client_set_bool (conf_client, - "/apps/evolution/calendar/notify/notify_with_tray", - TRUE, - NULL); + + g_settings_set_boolean (calendar_settings, "notify-with-tray", TRUE); source = gconf_client_get_list (conf_client, "/apps/evolution/calendar/sources", GCONF_VALUE_STRING, @@ -200,17 +200,14 @@ icaltimezone * config_data_get_timezone (void) { gchar *location; - const gchar *key; icaltimezone *local_timezone; ensure_inited (); - key = "/apps/evolution/calendar/display/use_system_timezone"; - if (gconf_client_get_bool (conf_client, key, NULL)) + if (g_settings_get_boolean (calendar_settings, "use-system-timezone")) location = e_cal_util_get_system_timezone_location (); else { - key = "/apps/evolution/calendar/display/timezone"; - location = gconf_client_get_string (conf_client, key, NULL); + location = g_settings_get_string (calendar_settings, "timezone"); } if (location && location[0]) @@ -229,10 +226,7 @@ config_data_get_24_hour_format (void) ensure_inited (); if (locale_supports_12_hour_format ()) { - const gchar *key; - - key = "/apps/evolution/calendar/display/use_24hour_format"; - return gconf_client_get_bool (conf_client, key, NULL); + return g_settings_get_boolean (calendar_settings, "use-24hour-format"); } return TRUE; @@ -243,9 +237,7 @@ config_data_get_notify_with_tray (void) { ensure_inited (); - return gconf_client_get_bool (conf_client, - "/apps/evolution/calendar/notify/notify_with_tray", - NULL); + return g_settings_get_boolean (calendar_settings, "notify-with-tray"); } /** @@ -260,7 +252,6 @@ void config_data_set_last_notification_time (ECalClient *cal, time_t t) { - GConfClient *client; time_t current_t, now = time (NULL); g_return_if_fail (t != -1); @@ -291,14 +282,11 @@ config_data_set_last_notification_time (ECalClient *cal, } } - if (!(client = config_data_get_conf_client ())) - return; - /* we only store the new notification time if it is bigger * than the already stored one */ - current_t = gconf_client_get_int (client, KEY_LAST_NOTIFICATION_TIME, NULL); + current_t = g_settings_get_int (calendar_settings, "last-notification-time"); if (t > current_t || current_t > now) - gconf_client_set_int (client, KEY_LAST_NOTIFICATION_TIME, t, NULL); + g_settings_set_int (calendar_settings, "last-notification-time", t); } /** @@ -311,8 +299,7 @@ config_data_set_last_notification_time (ECalClient *cal, time_t config_data_get_last_notification_time (ECalClient *cal) { - GConfValue *value; - GConfClient *client; + time_t value, now; if (cal) { ESource *source = e_client_get_source (E_CLIENT (cal)); @@ -326,33 +313,21 @@ config_data_get_last_notification_time (ECalClient *cal) if (last_notified && *last_notified && g_time_val_from_iso8601 (last_notified, &tmval)) { - time_t now = time (NULL), val = (time_t) tmval.tv_sec; + time_t now = time (NULL), value = (time_t) tmval.tv_sec; - if (val > now) - val = now; - return val; + if (value > now) + value = now; + return value; } } } - if (!(client = config_data_get_conf_client ())) - return -1; + value = g_settings_get_int (calendar_settings, "last-notification-time"); + now = time (NULL); + if (value > now) + value = now; - value = gconf_client_get_without_default ( - client, KEY_LAST_NOTIFICATION_TIME, NULL); - if (value) { - time_t val, now; - - val = (time_t) gconf_value_get_int (value); - now = time (NULL); - - if (val > now) - val = now; - - return val; - } - - return -1; + return value; } /** @@ -364,17 +339,20 @@ config_data_get_last_notification_time (ECalClient *cal) void config_data_save_blessed_program (const gchar *program) { - GConfClient *client; - GSList *l; + gchar **list; + gint i; + GPtrArray *array = g_ptr_array_new (); - if (!(client = config_data_get_conf_client ())) - return; + list = g_settings_get_strv (calendar_settings, "notify-programs"); + for (i = 0; i < g_strv_length (list); i++) + g_ptr_array_add (array, list[i]); - l = gconf_client_get_list (client, KEY_PROGRAMS, GCONF_VALUE_STRING, NULL); - l = g_slist_append (l, g_strdup (program)); - gconf_client_set_list (client, KEY_PROGRAMS, GCONF_VALUE_STRING, l, NULL); - g_slist_foreach (l, (GFunc) g_free, NULL); - g_slist_free (l); + g_ptr_array_add (array, program); + g_ptr_array_add (array, NULL); + g_settings_set_strv (calendar_settings, "notify-programs", (const gchar *const *) array->pdata); + + g_strfreev (list); + g_ptr_array_free (array, TRUE); } /** @@ -388,23 +366,22 @@ config_data_save_blessed_program (const gchar *program) gboolean config_data_is_blessed_program (const gchar *program) { - GConfClient *client; - GSList *l, *n; + gchar **list; + gint i = 0; gboolean found = FALSE; - if (!(client = config_data_get_conf_client ())) + list = g_settings_get_strv (calendar_settings, "notify-programs"); + if (!list) return FALSE; - l = gconf_client_get_list (client, KEY_PROGRAMS, GCONF_VALUE_STRING, NULL); - while (l) { - n = l->next; + while (list[i] != NULL) { if (!found) - found = strcmp ((gchar *) l->data, program) == 0; - g_free (l->data); - g_slist_free_1 (l); - l = n; + found = strcmp ((gchar *) list[i], program) == 0; + i++; } + g_strfreev (list); + return found; } diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 6d97cdf8cf..15df6920ae 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -31,6 +31,7 @@ #include <time.h> #include <string.h> +#include <gio/gio.h> #include <e-util/e-util.h> #include <libecal/e-cal-time-util.h> #include <libedataserver/e-data-server-util.h> @@ -40,7 +41,7 @@ #include "calendar-config-keys.h" #include "calendar-config.h" -static GConfClient *config = NULL; +static GSettings *config = NULL; static void do_cleanup (void) @@ -55,18 +56,17 @@ calendar_config_init (void) if (config) return; - config = gconf_client_get_default (); + config = g_settings_new ("org.gnome.evolution.calendar"); g_atexit ((GVoidFunc) do_cleanup); - - gconf_client_add_dir (config, CALENDAR_CONFIG_PREFIX, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); } void -calendar_config_remove_notification (guint id) +calendar_config_remove_notification (CalendarConfigChangedFunc func, + gpointer data) { calendar_config_init (); - gconf_client_notify_remove (config, id); + g_signal_handlers_disconnect_by_func (G_OBJECT (config), G_CALLBACK (func), data); } /* Returns TRUE if the locale has 'am' and 'pm' strings defined, in which @@ -92,7 +92,7 @@ calendar_config_get_timezone_stored (void) { calendar_config_init (); - return gconf_client_get_string (config, CALENDAR_CONFIG_TIMEZONE, NULL); + return g_settings_get_string (config, "timezone"); } static gchar * @@ -142,7 +142,7 @@ calendar_config_get_24_hour_format (void) * default. If the locale doesn't have 'am' and 'pm' strings we have * to use 24-hour format, or strftime ()/strptime () won't work. */ if (calendar_config_locale_supports_12_hour_format ()) - return gconf_client_get_bool (config, CALENDAR_CONFIG_24HOUR, NULL); + return g_settings_get_boolean (config, "use-24hour-format"); return TRUE; } @@ -153,20 +153,17 @@ calendar_config_get_month_scroll_by_week (void) { calendar_config_init (); - return gconf_client_get_bool (config, CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK, NULL); + return g_settings_get_boolean (config, "month-scroll-by-week"); } -guint -calendar_config_add_notification_month_scroll_by_week (GConfClientNotifyFunc func, +void +calendar_config_add_notification_month_scroll_by_week (CalendarConfigChangedFunc func, gpointer data) { - guint id; - calendar_config_init (); - id = gconf_client_notify_add (config, CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK, func, data, NULL, NULL); - - return id; + g_signal_connect (G_OBJECT (config), "changed::month-scroll-by-week", + G_CALLBACK (func), data); } /***************************************/ @@ -177,7 +174,7 @@ calendar_config_get_working_days (void) { calendar_config_init (); - return gconf_client_get_int (config, CALENDAR_CONFIG_WORKING_DAYS, NULL); + return g_settings_get_int (config, "working-days"); } /* Settings to hide completed tasks. */ @@ -186,7 +183,7 @@ calendar_config_get_hide_completed_tasks (void) { calendar_config_init (); - return gconf_client_get_bool (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED, NULL); + return g_settings_get_boolean (config, "hide-completed-tasks"); } static EDurationType @@ -197,7 +194,7 @@ calendar_config_get_hide_completed_tasks_units (void) calendar_config_init (); - units = gconf_client_get_string (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_UNITS, NULL); + units = g_settings_get_string (config, "hide-completed-tasks-units"); if (units && !strcmp (units, "minutes")) cu = E_DURATION_MINUTES; @@ -229,7 +226,7 @@ calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed) gint value; units = calendar_config_get_hide_completed_tasks_units (); - value = gconf_client_get_int (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_VALUE, NULL); + value = g_settings_get_int (config, "hide-completed-tasks-value"); if (value == 0) { /* If the value is 0, we want to hide completed tasks @@ -284,7 +281,7 @@ calendar_config_set_dir_path (const gchar *path) { calendar_config_init (); - gconf_client_set_string (config, CALENDAR_CONFIG_SAVE_DIR, path, NULL); + g_settings_set_string (config, "audio-dir", path); } gchar * @@ -294,7 +291,7 @@ calendar_config_get_dir_path (void) calendar_config_init (); - path = gconf_client_get_string (config, CALENDAR_CONFIG_SAVE_DIR, NULL); + path = g_settings_get_string (config, "audio-dir"); return path; } @@ -304,11 +301,19 @@ calendar_config_get_dir_path (void) GSList * calendar_config_get_day_second_zones (void) { - GSList *res; + GSList *res = NULL; + gchar **strv; + gint i; calendar_config_init (); - res = gconf_client_get_list (config, CALENDAR_CONFIG_DAY_SECOND_ZONES_LIST, GCONF_VALUE_STRING, NULL); + strv = g_settings_get_strv (config, "day-second-zones"); + for (i = 0; i < g_strv_length (strv); i++) { + if (strv[i] != NULL) + res = g_slist_append (res, g_strdup (strv[i])); + } + + g_strfreev (strv); return res; } @@ -331,16 +336,12 @@ calendar_config_set_day_second_zone (const gchar *location) if (location && *location) { GSList *lst, *l; - GError *error = NULL; gint max_zones; + GPtrArray *array; + gint i; /* configurable max number of timezones to remember */ - max_zones = gconf_client_get_int (config, CALENDAR_CONFIG_DAY_SECOND_ZONES_MAX, &error); - - if (error) { - g_error_free (error); - max_zones = -1; - } + max_zones = g_settings_get_int (config, "day-second-zones-max"); if (max_zones <= 0) max_zones = 5; @@ -364,18 +365,18 @@ calendar_config_set_day_second_zone (const gchar *location) lst = g_slist_prepend (lst, g_strdup (location)); } - while (g_slist_length (lst) > max_zones) { - l = g_slist_last (lst); - g_free (l->data); - lst = g_slist_delete_link (lst, l); - } + array = g_ptr_array_new (); + for (i = 0, l = lst; i < max_zones && l != NULL; i++, l = l->next) + g_ptr_array_add (array, l->data); + g_ptr_array_add (array, NULL); - gconf_client_set_list (config, CALENDAR_CONFIG_DAY_SECOND_ZONES_LIST, GCONF_VALUE_STRING, lst, NULL); + g_settings_set_strv (config, "day-second-zones", (const gchar * const *) array->pdata); calendar_config_free_day_second_zones (lst); + g_ptr_array_free (array, FALSE); } - gconf_client_set_string (config, CALENDAR_CONFIG_DAY_SECOND_ZONE, location ? location : "", NULL); + g_settings_set_string (config, "day-second-zone", location ? location : ""); } /* location of the second time zone user has selected. Free with g_free. */ @@ -384,7 +385,7 @@ calendar_config_get_day_second_zone (void) { calendar_config_init (); - return gconf_client_get_string (config, CALENDAR_CONFIG_DAY_SECOND_ZONE, NULL); + return g_settings_get_string (config, "day-second-zone"); } void @@ -424,15 +425,12 @@ calendar_config_select_day_second_zone (void) g_object_unref (tzdlg); } -guint -calendar_config_add_notification_day_second_zone (GConfClientNotifyFunc func, +void +calendar_config_add_notification_day_second_zone (CalendarConfigChangedFunc func, gpointer data) { - guint id; - calendar_config_init (); - id = gconf_client_notify_add (config, CALENDAR_CONFIG_DAY_SECOND_ZONE, func, data, NULL, NULL); - - return id; + g_signal_connect (G_OBJECT (config), "changed::day-second-zone", + G_CALLBACK (func), data); } diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index 0be1e203c9..483fbbd667 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -28,9 +28,9 @@ #ifndef _CALENDAR_CONFIG_H_ #define _CALENDAR_CONFIG_H_ +#include <gio/gio.h> #include <gdk/gdk.h> #include <libecal/e-cal-client.h> -#include <gconf/gconf-client.h> #include <e-util/e-util-enums.h> /* These are used to get/set the working days in the week. The bit-flags are @@ -47,7 +47,11 @@ typedef enum CAL_SATURDAY = 1 << 6 } CalWeekdays; -void calendar_config_remove_notification (guint id); +typedef void (* CalendarConfigChangedFunc) (GSettings *settings, + const gchar *key, + gpointer user_data); + +void calendar_config_remove_notification (CalendarConfigChangedFunc func, gpointer data); /* * Calendar Settings. @@ -79,10 +83,11 @@ void calendar_config_free_day_second_zones (GSList *zones); void calendar_config_set_day_second_zone (const gchar *location); gchar * calendar_config_get_day_second_zone (void); void calendar_config_select_day_second_zone (void); -guint calendar_config_add_notification_day_second_zone (GConfClientNotifyFunc func, gpointer data); + +void calendar_config_add_notification_day_second_zone (CalendarConfigChangedFunc func, gpointer data); /* Scroll in a month view by a week, not by a month */ gboolean calendar_config_get_month_scroll_by_week (void); -guint calendar_config_add_notification_month_scroll_by_week (GConfClientNotifyFunc func, gpointer data); +void calendar_config_add_notification_month_scroll_by_week (CalendarConfigChangedFunc func, gpointer data); #endif /* _CALENDAR_CONFIG_H_ */ diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 4fa0250838..d5eee61a87 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -34,13 +34,13 @@ #include <unistd.h> #include <glib/gi18n-lib.h> #include <glib/gstdio.h> +#include <gio/gio.h> #include <gdk/gdkkeysyms.h> #include <libebackend/e-extensible.h> #include <e-util/e-util.h> #include <e-util/e-alert-sink.h> #include <e-util/e-dialog-utils.h> #include <e-util/e-util-private.h> -#include <e-util/gconf-bridge.h> #include <shell/e-shell.h> #include <libedataserver/e-data-server-util.h> @@ -71,6 +71,8 @@ struct _CompEditorPrivate { gpointer shell; /* weak pointer */ + GSettings *calendar_settings; + /* EFocusTracker keeps selection actions up-to-date. */ EFocusTracker *focus_tracker; @@ -1637,6 +1639,7 @@ comp_editor_finalize (GObject *object) priv = COMP_EDITOR (object)->priv; + g_object_unref (priv->calendar_settings); g_free (priv->summary); /* Chain up to parent's finalize() method. */ @@ -1653,39 +1656,35 @@ comp_editor_constructed (GObject *object) } static void -comp_editor_bind_gconf (CompEditor *editor) +comp_editor_bind_settings (CompEditor *editor) { - GConfBridge *bridge; GtkAction *action; - const gchar *key; g_return_if_fail (editor != NULL); - bridge = gconf_bridge_get (); - - key = "/apps/evolution/calendar/display/show_categories"; action = comp_editor_get_action (editor, "view-categories"); - gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + g_settings_bind (editor->priv->calendar_settings, "editor-show-categories", + G_OBJECT (action), "active", G_SETTINGS_BIND_DEFAULT); - key = "/apps/evolution/calendar/display/show_role"; action = comp_editor_get_action (editor, "view-role"); - gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + g_settings_bind (editor->priv->calendar_settings, "editor-show-role", + G_OBJECT (action), "active", G_SETTINGS_BIND_DEFAULT); - key = "/apps/evolution/calendar/display/show_rsvp"; action = comp_editor_get_action (editor, "view-rsvp"); - gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + g_settings_bind (editor->priv->calendar_settings, "editor-show-rsvp", + G_OBJECT (action), "active", G_SETTINGS_BIND_DEFAULT); - key = "/apps/evolution/calendar/display/show_status"; action = comp_editor_get_action (editor, "view-status"); - gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + g_settings_bind (editor->priv->calendar_settings, "editor-show-status", + G_OBJECT (action), "active", G_SETTINGS_BIND_DEFAULT); - key = "/apps/evolution/calendar/display/show_timezone"; action = comp_editor_get_action (editor, "view-time-zone"); - gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + g_settings_bind (editor->priv->calendar_settings, "editor-show-timezone", + G_OBJECT (action), "active", G_SETTINGS_BIND_DEFAULT); - key = "/apps/evolution/calendar/display/show_type"; action = comp_editor_get_action (editor, "view-type"); - gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + g_settings_bind (editor->priv->calendar_settings, "editor-show-type", + G_OBJECT (action), "active", G_SETTINGS_BIND_DEFAULT); } static gboolean @@ -1981,6 +1980,8 @@ comp_editor_init (CompEditor *editor) active_editors = g_list_prepend (active_editors, editor); + priv->calendar_settings = g_settings_new ("org.gnome.evolution.calendar"); + /* Each editor window gets its own window group. */ window = GTK_WINDOW (editor); priv->window_group = gtk_window_group_new (); @@ -2190,7 +2191,7 @@ comp_editor_init (CompEditor *editor) store, "row-inserted", G_CALLBACK (attachment_store_changed_cb), editor); - comp_editor_bind_gconf (editor); + comp_editor_bind_settings (editor); gtk_application_add_window ( GTK_APPLICATION (shell), GTK_WINDOW (editor)); diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c index 928a91bbfb..c901b82013 100644 --- a/calendar/gui/e-day-view-time-item.c +++ b/calendar/gui/e-day-view-time-item.c @@ -65,7 +65,6 @@ struct _EDayViewTimeItemPrivate { gboolean dragging_selection; /* The second timezone if shown, or else NULL. */ - guint second_zone_changed_id; icaltimezone *second_zone; }; @@ -109,9 +108,8 @@ static gint e_day_view_time_item_convert_position_to_row (EDayViewTimeItem *time_item, gint y); -static void edvti_second_zone_changed_cb (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, +static void edvti_second_zone_changed_cb (GSettings *settings, + const gchar *key, gpointer user_data); enum { @@ -178,9 +176,7 @@ day_view_time_item_finalize (GObject *object) time_item = E_DAY_VIEW_TIME_ITEM (object); - if (time_item->priv->second_zone_changed_id) - calendar_config_remove_notification (time_item->priv->second_zone_changed_id); - time_item->priv->second_zone_changed_id = 0; + calendar_config_remove_notification ((CalendarConfigChangedFunc) edvti_second_zone_changed_cb, time_item); /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (parent_class)->finalize (object); @@ -238,9 +234,9 @@ day_view_time_item_init (EDayViewTimeItem *time_item) g_free (last); } - time_item->priv->second_zone_changed_id = - calendar_config_add_notification_day_second_zone ( - edvti_second_zone_changed_cb, time_item); + calendar_config_add_notification_day_second_zone ( + (CalendarConfigChangedFunc) edvti_second_zone_changed_cb, + time_item); } GType @@ -732,9 +728,8 @@ e_day_view_time_item_event (GnomeCanvasItem *item, } static void -edvti_second_zone_changed_cb (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, +edvti_second_zone_changed_cb (GSettings *settings, + const gchar *key, gpointer user_data) { EDayViewTimeItem *time_item = user_data; diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 036b6192f5..4b2eeb02bf 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -638,6 +638,22 @@ week_view_cursor_key_right (EWeekView *week_view) } static void +month_scrol_by_week_changed_cb (GSettings *settings, + const gchar *key, + gpointer user_data) +{ + EWeekView *week_view = user_data; + + g_return_if_fail (week_view != NULL); + g_return_if_fail (E_IS_WEEK_VIEW (week_view)); + + if (week_view->multi_week_view && week_view->month_scroll_by_week != calendar_config_get_month_scroll_by_week ()) { + week_view->multi_week_view = FALSE; + e_week_view_set_multi_week_view (week_view, TRUE); + } +} + +static void e_week_view_class_init (EWeekViewClass *class) { GObjectClass *object_class; @@ -895,10 +911,7 @@ e_week_view_dispose (GObject *object) week_view->resize_width_cursor = NULL; } - if (week_view->scroll_by_week_notif_id) { - calendar_config_remove_notification (week_view->scroll_by_week_notif_id); - week_view->scroll_by_week_notif_id = 0; - } + calendar_config_remove_notification (month_scrol_by_week_changed_cb, week_view); /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (e_week_view_parent_class)->dispose (object); @@ -1875,23 +1888,6 @@ e_week_view_recalc_day_starts (EWeekView *week_view, } } -static void -month_scrol_by_week_changed_cb (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - gpointer user_data) -{ - EWeekView *week_view = user_data; - - g_return_if_fail (week_view != NULL); - g_return_if_fail (E_IS_WEEK_VIEW (week_view)); - - if (week_view->multi_week_view && week_view->month_scroll_by_week != calendar_config_get_month_scroll_by_week ()) { - week_view->multi_week_view = FALSE; - e_week_view_set_multi_week_view (week_view, TRUE); - } -} - gboolean e_week_view_get_multi_week_view (EWeekView *week_view) { @@ -1919,8 +1915,7 @@ e_week_view_set_multi_week_view (EWeekView *week_view, gtk_widget_show (week_view->titles_canvas); week_view->month_scroll_by_week = calendar_config_get_month_scroll_by_week (); - if (!week_view->scroll_by_week_notif_id) - week_view->scroll_by_week_notif_id = calendar_config_add_notification_month_scroll_by_week (month_scrol_by_week_changed_cb, week_view); + calendar_config_add_notification_month_scroll_by_week (month_scrol_by_week_changed_cb, week_view); if (week_view->month_scroll_by_week) { page_increment = 1; @@ -1934,7 +1929,7 @@ e_week_view_set_multi_week_view (EWeekView *week_view, page_increment = page_size = 1; if (week_view->scroll_by_week_notif_id) { - calendar_config_remove_notification (week_view->scroll_by_week_notif_id); + calendar_config_remove_notification (month_scrol_by_week_changed_cb, week_view); week_view->scroll_by_week_notif_id = 0; } } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 66c90fb1c2..6fd51534b5 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -103,7 +103,6 @@ struct _GnomeCalendarPrivate { * was selected in the date navigator to show the view. */ ECalendarView *views[GNOME_CAL_LAST_VIEW]; GnomeCalendarViewType current_view_type; - GList *notifications; gboolean range_selected; @@ -1508,11 +1507,6 @@ gnome_calendar_do_dispose (GObject *object) } } - for (l = priv->notifications; l; l = l->next) - calendar_config_remove_notification (GPOINTER_TO_UINT (l->data)); - g_list_free (priv->notifications); - priv->notifications = NULL; - free_dn_queries (gcal); if (priv->sexp) { |