diff options
author | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-10 23:40:06 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-10 23:40:06 +0800 |
commit | 90ffcfd8ce2aeb5159d5c6f8a44601b89ea0ba05 (patch) | |
tree | 536d9c55bf93cb05fce24781b06362fe68cb63d8 | |
parent | 2f62d91630f58325820712e9c21439b7fae055ce (diff) | |
download | gsoc2013-evolution-90ffcfd8ce2aeb5159d5c6f8a44601b89ea0ba05.tar gsoc2013-evolution-90ffcfd8ce2aeb5159d5c6f8a44601b89ea0ba05.tar.gz gsoc2013-evolution-90ffcfd8ce2aeb5159d5c6f8a44601b89ea0ba05.tar.bz2 gsoc2013-evolution-90ffcfd8ce2aeb5159d5c6f8a44601b89ea0ba05.tar.lz gsoc2013-evolution-90ffcfd8ce2aeb5159d5c6f8a44601b89ea0ba05.tar.xz gsoc2013-evolution-90ffcfd8ce2aeb5159d5c6f8a44601b89ea0ba05.tar.zst gsoc2013-evolution-90ffcfd8ce2aeb5159d5c6f8a44601b89ea0ba05.zip |
Last bits of calendar-config migrated to GSettings
-rw-r--r-- | calendar/gui/calendar-config.c | 29 | ||||
-rw-r--r-- | calendar/gui/calendar-config.h | 13 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.c | 2 | ||||
-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 |
6 files changed, 49 insertions, 65 deletions
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 9623dcf058..85c2e3e60d 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -61,11 +61,12 @@ calendar_config_init (void) } 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 @@ -155,17 +156,14 @@ calendar_config_get_month_scroll_by_week (void) 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); } /***************************************/ @@ -371,7 +369,7 @@ calendar_config_set_day_second_zone (const gchar *location) for (i = 0, l = lst; i < max_zones && l != NULL; i++, l = l->next) g_ptr_array_add (array, l->data); - g_settings_set_strv (config, "day-second-zones", array->pdata); + 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); @@ -426,15 +424,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/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 84046e7aac..109ce4539d 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -1571,7 +1571,7 @@ e_calendar_view_new_appointment_full (ECalendarView *cal_view, gint time_div = e_calendar_view_get_time_divisions (cal_view); gint hours, mins; - if (!time_div) /* Possible if your gconf values aren't so nice */ + if (!time_div) /* Possible if your settings values aren't so nice */ time_div = 30; if (time_day_begin (now) == time_day_begin (dtstart)) { 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) { |