From f304d1898d61e431738154c7f09cab901936e647 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Thu, 15 Sep 2011 13:47:06 +0200 Subject: Port most settings in calendar-config.c to GSettings --- calendar/gui/calendar-config.c | 49 ++++++++++++------------ data/evolution.convert | 9 +++++ data/org.gnome.evolution.calendar.gschema.xml.in | 45 ++++++++++++++++++++++ 3 files changed, 79 insertions(+), 24 deletions(-) diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 6d97cdf8cf..1ae04af530 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -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,10 +56,8 @@ 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 @@ -92,7 +91,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 +141,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,7 +152,7 @@ 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 @@ -177,7 +176,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 +185,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 +196,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 +228,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 +283,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 +293,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 +303,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 +338,10 @@ calendar_config_set_day_second_zone (const gchar *location) if (location && *location) { GSList *lst, *l; - GError *error = NULL; gint max_zones; /* 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; @@ -375,7 +376,7 @@ calendar_config_set_day_second_zone (const gchar *location) calendar_config_free_day_second_zones (lst); } - 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 diff --git a/data/evolution.convert b/data/evolution.convert index 45954be817..874453aac7 100644 --- a/data/evolution.convert +++ b/data/evolution.convert @@ -32,18 +32,27 @@ vpane-position = /apps/evolution/addressbook/display/vpane_position show-preview = /apps/evolution/addressbook/display/show_preview [org.gnome.evolution.calendar] +audi-dir = /apps/evolution/calendar/audio_dir +day-second-zone = /apps/evolution/calendar/display/day_second_zone +day-second-zones = /apps/evolution/calendar/display/day_second_zones +day-second-zones-max = /apps/evolution/calendar/display/day_second_zones_max editor-show-categories = /apps/evolution/calendar/display/show_categories editor-show-role = /apps/evolution/calendar/display/show_role editor-show-rsvp = /apps/evolution/calendar/display/show_rsvp editor-show-status = /apps/evolution/calendar/display/show_status editor-show-timezone = /apps/evolution/calendar/display/show_timezone editor-show-type = /apps/evolution/calendar/display/show_type +hide-completed-tasks = /apps/evolution/calendar/tasks/hide_completed +hide-completed-tasks-units = /apps/evolution/calendar/tasks/hide_completed_units +hide-completed-tasks-value = /apps/evolution/calendar/tasks/hide_completed_value last-notification-time = /apps/evolution/calendar/notify/last_notification_time +month-scroll-by-week = /apps/evolution/calendar/display/month_scroll_by_week notify-programs = /apps/evolution/calendar/notify/programs notify-with-tray = /apps/evolution/calendar/notify/notify_with_tray timezone = /apps/evolution/calendar/display/timezone use-24hour-format = /apps/evolution/calendar/display/use_24hour_format use-system-timezone = /apps/evolution/calendar/display/use_system_timezone +working-days = /apps/evolution/calendar/display/working_days [org.gnome.evolution.mail] check-if-default-mailer = /apps/evolution/mail/prompts/checkdefault diff --git a/data/org.gnome.evolution.calendar.gschema.xml.in b/data/org.gnome.evolution.calendar.gschema.xml.in index 9c0050f8f2..70a13b94d2 100644 --- a/data/org.gnome.evolution.calendar.gschema.xml.in +++ b/data/org.gnome.evolution.calendar.gschema.xml.in @@ -1,6 +1,26 @@ + + '' + <_summary>Save directory for reminder audio + <_description>Directory for saving reminder audio files + + + '' + <_summary>The second timezone for a Day View + <_description>Shows the second time zone in a Day View, if set. Value is similar to one used in a 'timezone' key + + + [] + <_summary>Recently used second time zones in a Day View + <_description>List of recently used second time zones in a Day View + + + 5 + <_summary>Maximum number of recently used timezones to remember + <_description>Maximum number of recently used timezones to remember in a 'day-second-zones' list + false <_summary>Show categories field in the event/meeting/task editor @@ -31,11 +51,31 @@ <_summary>Show type field in the event/task/meeting editor <_description>Whether to show type field in the event/task/meeting editor + + false + <_summary>Hide completed tasks + <_description>Whether to hide completed tasks in the tasks view + + + 'days' + <_summary>Hide task units + <_description>Units for determining when to hide tasks, "minutes", "hours" or "days" + + + 1 + <_summary>Hide task value + <_description>Number of units for determining when to hide tasks + 1 <_summary>Last reminder time <_description>Time the last reminder ran, in time_t + + true + <_summary>Scroll Month View by a week + <_description>Whether to scroll a Month View by a week, not by a month + [] <_summary>Reminder programs @@ -61,4 +101,9 @@ <_summary>Use system timezone <_description>Use the system timezone instead of the timezone selected in Evolution + + 62 + <_summary>Work days + <_description>Days on which the start and end of work hours should be indicated + -- cgit