diff options
author | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-21 23:04:46 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-21 23:04:46 +0800 |
commit | b9a43c056c67bc343748fbd7c1b5385a6457014a (patch) | |
tree | f7efd6482c50a750ccee63ba5801eda170252088 | |
parent | 66e77897b5bb3b32d95268b1de12493b1dd5b140 (diff) | |
download | gsoc2013-evolution-b9a43c056c67bc343748fbd7c1b5385a6457014a.tar gsoc2013-evolution-b9a43c056c67bc343748fbd7c1b5385a6457014a.tar.gz gsoc2013-evolution-b9a43c056c67bc343748fbd7c1b5385a6457014a.tar.bz2 gsoc2013-evolution-b9a43c056c67bc343748fbd7c1b5385a6457014a.tar.lz gsoc2013-evolution-b9a43c056c67bc343748fbd7c1b5385a6457014a.tar.xz gsoc2013-evolution-b9a43c056c67bc343748fbd7c1b5385a6457014a.tar.zst gsoc2013-evolution-b9a43c056c67bc343748fbd7c1b5385a6457014a.zip |
Port ECalShellBackend to GSettings
-rw-r--r-- | data/evolution.convert | 1 | ||||
-rw-r--r-- | data/org.gnome.evolution.calendar.gschema.xml.in | 5 | ||||
-rw-r--r-- | modules/calendar/e-cal-shell-backend.c | 40 |
3 files changed, 31 insertions, 15 deletions
diff --git a/data/evolution.convert b/data/evolution.convert index 657d743abd..83f5efccc5 100644 --- a/data/evolution.convert +++ b/data/evolution.convert @@ -51,6 +51,7 @@ memo-layout = /apps/evolution/calendar/display/memo_layout 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 +selected-calendars = /apps/evolution/calendar/display/selected_calendars show-memo-preview = /apps/evolution/calendar/display/show_memo_preview timezone = /apps/evolution/calendar/display/timezone use-24hour-format = /apps/evolution/calendar/display/use_24hour_format diff --git a/data/org.gnome.evolution.calendar.gschema.xml.in b/data/org.gnome.evolution.calendar.gschema.xml.in index 39285fc7f9..9525066123 100644 --- a/data/org.gnome.evolution.calendar.gschema.xml.in +++ b/data/org.gnome.evolution.calendar.gschema.xml.in @@ -96,6 +96,11 @@ <_summary>Show display reminders in notification tray</_summary> <_description>Whether or not to use the notification tray for display reminders</_description> </key> + <key name="selected-calendars" type="as"> + <default>[]</default> + <_summary>List of selected calendars</_summary> + <_description>List of calendars to load</_description> + </key> <key name="show-memo-preview" type="b"> <default>true</default> <_summary>Show the memo preview pane</_summary> diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 96077cf19e..2a1edb96d2 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -901,18 +901,24 @@ e_cal_shell_backend_get_source_list (ECalShellBackend *cal_shell_backend) GSList * e_cal_shell_backend_get_selected_calendars (ECalShellBackend *cal_shell_backend) { - GConfClient *client; - GSList *selected_calendars; - const gchar *key; + GSettings *settings; + char **strv; + gint i; + GSList *selected_calendars = NULL; g_return_val_if_fail ( E_IS_CAL_SHELL_BACKEND (cal_shell_backend), NULL); - client = gconf_client_get_default (); - key = "/apps/evolution/calendar/display/selected_calendars"; - selected_calendars = gconf_client_get_list ( - client, key, GCONF_VALUE_STRING, NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.calendar"); + selected_calendars = g_settings_get_strv (settings, "selected-calendars"); + g_object_unref (settings); + + if (strv != NULL) { + for (i = 0; strv[i] != NULL; i++) + selected_calendars = g_slist_append (selected_calendars, g_strdup (strv[i])); + + g_strfreev (strv); + } return selected_calendars; } @@ -921,16 +927,20 @@ void e_cal_shell_backend_set_selected_calendars (ECalShellBackend *cal_shell_backend, GSList *selected_calendars) { - GConfClient *client; - const gchar *key; + GSettings *settings; + GSList *l; + GPtrArray *array = g_ptr_array_new (); g_return_if_fail (E_IS_CAL_SHELL_BACKEND (cal_shell_backend)); - client = gconf_client_get_default (); - key = "/apps/evolution/calendar/display/selected_calendars"; - gconf_client_set_list ( - client, key, GCONF_VALUE_STRING, selected_calendars, NULL); - g_object_unref (client); + for (l = selected_calendars; l != NULL; l = l->next) + g_ptr_array_add (array, l->data); + + settings = g_settings_new ("org.gnome.evolution.calendar"); + g_settings_set_strv (settings, "selected-calendars", array->pdata); + g_object_unref (settings); + + g_ptr_array_free (array, FALSE); } void |