diff options
Diffstat (limited to 'calendar')
27 files changed, 168 insertions, 226 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 4f04974b33..eeca88e1b6 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -106,7 +106,8 @@ process_removal_in_hash (const gchar *uri, } static gint -find_slist_source_uri_cb (gconstpointer a, gconstpointer b) +find_slist_source_uri_cb (gconstpointer a, + gconstpointer b) { ESource *asource = (ESource *) a; const gchar *buri = b; diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c index a05498532b..2797d44b0a 100644 --- a/calendar/gui/alarm-notify/alarm.c +++ b/calendar/gui/alarm-notify/alarm.c @@ -36,7 +36,6 @@ #include "alarm.h" #include "config-data.h" - /* Our glib timeout */ static guint timeout_id; diff --git a/calendar/gui/alarm-notify/alarm.h b/calendar/gui/alarm-notify/alarm.h index 54a6e4c720..d6e9ff4a4e 100644 --- a/calendar/gui/alarm-notify/alarm.h +++ b/calendar/gui/alarm-notify/alarm.h @@ -29,7 +29,6 @@ #include <time.h> #include <glib.h> - typedef void (* AlarmFunction) (gpointer alarm_id, time_t trigger, gpointer data); typedef void (* AlarmDestroyNotify) (gpointer alarm_id, gpointer data); diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c index 567ca69c09..c8348f89fc 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, @@ -189,28 +189,18 @@ config_data_replace_string_list (const gchar *key, } } -GConfClient * -config_data_get_conf_client (void) -{ - ensure_inited (); - return conf_client; -} - 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 +219,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 +230,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 +245,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 +275,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 +292,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 +306,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 = 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; + value = g_settings_get_int (calendar_settings, "last-notification-time"); + now = time (NULL); + if (value > now) + value = now; - return val; - } - - return -1; + return value; } /** @@ -364,17 +332,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, (gpointer) 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 +359,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/alarm-notify/config-data.h b/calendar/gui/alarm-notify/config-data.h index 1023609d6a..a7a0ca58e0 100644 --- a/calendar/gui/alarm-notify/config-data.h +++ b/calendar/gui/alarm-notify/config-data.h @@ -28,10 +28,8 @@ #include <libical/ical.h> #include <libecal/e-cal-client.h> -#include <gconf/gconf-client.h> #include <libedataserver/e-source-list.h> -GConfClient * config_data_get_conf_client (void); icaltimezone * config_data_get_timezone (void); gboolean config_data_get_24_hour_format (void); gboolean config_data_get_notify_with_tray diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 6d97cdf8cf..39431549dd 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/calendar-view-factory.c b/calendar/gui/calendar-view-factory.c index 4c92d6d8fc..8342475620 100644 --- a/calendar/gui/calendar-view-factory.c +++ b/calendar/gui/calendar-view-factory.c @@ -30,7 +30,6 @@ #include "calendar-view-factory.h" #include "calendar-view.h" - /* Private part of the CalendarViewFactory structure */ struct _CalendarViewFactoryPrivate { /* Type of views created by this factory */ diff --git a/calendar/gui/calendar-view.c b/calendar/gui/calendar-view.c index d238daf3df..6f9f2951f3 100644 --- a/calendar/gui/calendar-view.c +++ b/calendar/gui/calendar-view.c @@ -28,7 +28,6 @@ #include "calendar-view.h" - /* Private part of the CalendarView structure */ struct _CalendarViewPrivate { /* Type of the view */ diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c index 8bb5500f23..f768335c3c 100644 --- a/calendar/gui/comp-util.c +++ b/calendar/gui/comp-util.c @@ -39,7 +39,6 @@ #include "shell/e-shell-window.h" #include "shell/e-shell-view.h" - /** * cal_comp_util_add_exdate: * @comp: A calendar component object. diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 4576f3df6f..1c76c79d83 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -45,7 +45,6 @@ #include "comp-editor-util.h" #include "alarm-dialog.h" - typedef struct { GtkBuilder *builder; diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c index 4fb5884026..065e865f92 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ b/calendar/gui/dialogs/alarm-list-dialog.c @@ -42,7 +42,6 @@ #include "alarm-dialog.h" #include "alarm-list-dialog.h" - typedef struct { GtkBuilder *builder; diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c index c5caa9371d..1bb37acf4b 100644 --- a/calendar/gui/dialogs/cancel-comp.c +++ b/calendar/gui/dialogs/cancel-comp.c @@ -31,7 +31,6 @@ #include "e-util/e-alert-dialog.h" #include "cancel-comp.h" - /* is_past_event: * * returns TRUE if @comp is in the past, FALSE otherwise. diff --git a/calendar/gui/dialogs/changed-comp.c b/calendar/gui/dialogs/changed-comp.c index bc25188f5d..f8a98c9908 100644 --- a/calendar/gui/dialogs/changed-comp.c +++ b/calendar/gui/dialogs/changed-comp.c @@ -29,7 +29,6 @@ #include <glib/gi18n.h> #include "changed-comp.h" - /** * changed_component_dialog: * @parent: Parent window for the dialog. diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index 2c087bb2f6..58c649b7ee 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -37,7 +37,6 @@ #include <shell/e-shell.h> #include "comp-editor-util.h" - /** * comp_editor_dates: * @dates: A structure to be filled out with dates of a component 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/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index 44c133afbe..87330ed0dd 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -30,7 +30,6 @@ #include "e-util/e-alert-dialog.h" #include "delete-comp.h" - /** * delete_component_dialog: * @comp: A calendar component if a single component is to be deleted, or NULL diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c index a68fed8e1d..7dc53253fa 100644 --- a/calendar/gui/dialogs/delete-error.c +++ b/calendar/gui/dialogs/delete-error.c @@ -30,7 +30,6 @@ #include <glib/gi18n.h> #include "delete-error.h" - /** * delete_error_dialog: * diff --git a/calendar/gui/dialogs/recur-comp.c b/calendar/gui/dialogs/recur-comp.c index 9652553ee3..434d552a40 100644 --- a/calendar/gui/dialogs/recur-comp.c +++ b/calendar/gui/dialogs/recur-comp.c @@ -29,7 +29,6 @@ #include <glib/gi18n.h> #include "recur-comp.h" - gboolean recur_component_dialog (ECalClient *client, ECalComponent *comp, diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c index 524f4c8097..4e5e1668c1 100644 --- a/calendar/gui/dialogs/send-comp.c +++ b/calendar/gui/dialogs/send-comp.c @@ -30,7 +30,6 @@ #include "e-util/e-alert-dialog.h" #include "send-comp.h" - static gboolean component_has_new_attendees (ECalComponent *comp) { diff --git a/calendar/gui/e-cal-config.c b/calendar/gui/e-cal-config.c index 8269a1067e..99a2487f98 100644 --- a/calendar/gui/e-cal-config.c +++ b/calendar/gui/e-cal-config.c @@ -70,8 +70,8 @@ ecp_target_free (EConfig *ec, break; } case EC_CONFIG_TARGET_PREFS: { ECalConfigTargetPrefs *s = (ECalConfigTargetPrefs *) t; - if (s->gconf) - g_object_unref (s->gconf); + if (s->settings) + g_object_unref (s->settings); break; } } @@ -172,7 +172,7 @@ e_cal_config_target_new_prefs (ECalConfig *ecp) t = e_config_target_new ( &ecp->config, EC_CONFIG_TARGET_PREFS, sizeof (*t)); - t->gconf = gconf_client_get_default (); + t->settings = g_settings_new ("org.gnome.evolution.calendar"); return t; } diff --git a/calendar/gui/e-cal-config.h b/calendar/gui/e-cal-config.h index 582bdf6a53..28109ab394 100644 --- a/calendar/gui/e-cal-config.h +++ b/calendar/gui/e-cal-config.h @@ -80,7 +80,7 @@ struct _ECalConfigTargetSource { struct _ECalConfigTargetPrefs { EConfigTarget target; - struct _GConfClient *gconf; + GSettings *settings; }; typedef struct _EConfigItem ECalConfigItem; diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c index 928a91bbfb..9b61f11649 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..aa0aebf08a 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; @@ -1481,7 +1480,6 @@ gnome_calendar_init (GnomeCalendar *gcal) static void gnome_calendar_do_dispose (GObject *object) { - GList *l; GnomeCalendar *gcal; GnomeCalendarPrivate *priv; gint ii; @@ -1508,11 +1506,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) { diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 187757cece..4b2a8d262d 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -577,11 +577,11 @@ comp_to_list (ECalComponentItipMethod method, ECalComponentAttendee *att = l->data; /* Bugfix: 688711 - Varadhan - Resource is also considered as a "attendee". If the respective backend - is able to successfully book resources automagically, it will appear - in the users list and thereby won't get added to the list of destinations - to send the meeting invite, otherwise, as a safety measure, a meeting - invite will be sent to the resources as well. */ + * Resource is also considered as a "attendee". If the respective backend + * is able to successfully book resources automagically, it will appear + * in the users list and thereby won't get added to the list of destinations + * to send the meeting invite, otherwise, as a safety measure, a meeting + * invite will be sent to the resources as well. */ if (att->cutype != ICAL_CUTYPE_INDIVIDUAL && att->cutype != ICAL_CUTYPE_GROUP && att->cutype != ICAL_CUTYPE_RESOURCE) diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 449cab0d24..3887780ed7 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -1023,13 +1023,13 @@ gnome_calendar_getwidget (EImport *ei, EImportImporter *im) { GtkWidget *hbox, *w; - GConfClient *gconf; + GSettings *settings; gboolean done_cal, done_tasks; - gconf = gconf_client_get_default (); - done_cal = gconf_client_get_bool (gconf, "/apps/evolution/importer/gnome-calendar/calendar", NULL); - done_tasks = gconf_client_get_bool (gconf, "/apps/evolution/importer/gnome-calendar/tasks", NULL); - g_object_unref (gconf); + settings = g_settings_new ("org.gnome.evolution.importer"); + done_cal = g_settings_get_boolean (settings, "gnome-calendar-done-calendar"); + done_tasks = g_settings_get_boolean (settings, "gnome-calendar-done-tasks"); + g_object_unref (settings); g_datalist_set_data(&target->data, "gnomecal-do-cal", GINT_TO_POINTER(!done_cal)); g_datalist_set_data(&target->data, "gnomecal-do-tasks", GINT_TO_POINTER(!done_tasks)); @@ -1380,11 +1380,11 @@ get_users_timezone (void) if (e_shell_settings_get_boolean (shell_settings, "cal-use-system-timezone")) { location = e_cal_util_get_system_timezone_location (); } else { - GConfClient *client = gconf_client_get_default (); + GSettings *settings = g_settings_new ("org.gnome.evolution.calendar"); - location = gconf_client_get_string (client, CALENDAR_CONFIG_TIMEZONE, NULL); + location = g_settings_get_string (settings, "timezone"); - g_object_unref (client); + g_object_unref (settings); } if (location) { |