aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@gnome-db.org>2011-10-13 23:13:34 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-10-13 23:13:34 +0800
commit7caabe92304734e3bfc60bdf2e9d36915367e5f0 (patch)
tree949686368929f50664add60d9d3018c5ab2ba389
parentb436b8468346c384edc6bde0f24b2ac0ce657e00 (diff)
downloadgsoc2013-evolution-7caabe92304734e3bfc60bdf2e9d36915367e5f0.tar
gsoc2013-evolution-7caabe92304734e3bfc60bdf2e9d36915367e5f0.tar.gz
gsoc2013-evolution-7caabe92304734e3bfc60bdf2e9d36915367e5f0.tar.bz2
gsoc2013-evolution-7caabe92304734e3bfc60bdf2e9d36915367e5f0.tar.lz
gsoc2013-evolution-7caabe92304734e3bfc60bdf2e9d36915367e5f0.tar.xz
gsoc2013-evolution-7caabe92304734e3bfc60bdf2e9d36915367e5f0.tar.zst
gsoc2013-evolution-7caabe92304734e3bfc60bdf2e9d36915367e5f0.zip
Migrate mail-account-view.c to GSettings
-rw-r--r--capplet/anjal-settings-main.c1
-rw-r--r--capplet/settings/mail-account-view.c42
2 files changed, 25 insertions, 18 deletions
diff --git a/capplet/anjal-settings-main.c b/capplet/anjal-settings-main.c
index 2bc3268b58..99e0b4a282 100644
--- a/capplet/anjal-settings-main.c
+++ b/capplet/anjal-settings-main.c
@@ -38,7 +38,6 @@
#include <libedataserverui/e-passwords.h>
#include <mail/mail-mt.h>
#include "settings/mail-capplet-shell.h"
-#include <gconf/gconf-client.h>
#include <libedataserver/e-categories.h>
#ifdef G_OS_WIN32
diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c
index 3617c6a866..35c561ed50 100644
--- a/capplet/settings/mail-account-view.c
+++ b/capplet/settings/mail-account-view.c
@@ -238,6 +238,29 @@ sanitize_user_mail (const gchar *user)
}
static void
+add_selected_calendar (const gchar *uid)
+{
+ gchar **ids;
+ gint i;
+ GPtrArray *array;
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+ ids = g_settings_get_strv (settings, "selected-calendars");
+
+ array = g_ptr_array_new ();
+ for (i = 0; ids[i] != NULL; i++)
+ g_ptr_array_add (array, ids[i]);
+ g_ptr_array_add (array, uid);
+ g_ptr_array_add (array, NULL);
+
+ g_settings_set_strv (settings, "selected-calendars", (const gchar* const *) array->pdata);
+
+ g_ptr_array_free (array, TRUE);
+ g_object_unref (settings);
+}
+
+static void
setup_yahoo_account (MailAccountView *mav)
{
GConfClient *gconf = gconf_client_get_default ();
@@ -250,7 +273,6 @@ setup_yahoo_account (MailAccountView *mav)
ESourceGroup *sgrp;
ESource *calendar;
gchar *sanitize_uname, *abs_uri, *rel_uri;
- GSList *ids, *temp;
const gchar *email = e_account_get_string (em_account_editor_get_modified_account (mav->edit), E_ACCOUNT_ID_ADDRESS);
slist = e_source_list_new_for_gconf (gconf, "/apps/evolution/calendar/sources");
@@ -286,14 +308,7 @@ setup_yahoo_account (MailAccountView *mav)
e_source_group_add_source (sgrp, calendar, -1);
e_source_list_sync (slist, NULL);
- ids = gconf_client_get_list (gconf, SELECTED_CALENDARS, GCONF_VALUE_STRING, NULL);
- ids = g_slist_append (ids, g_strdup (e_source_peek_uid (calendar)));
- gconf_client_set_list (gconf, SELECTED_CALENDARS, GCONF_VALUE_STRING, ids, NULL);
- temp = ids;
-
- for (; temp != NULL; temp = g_slist_next (temp))
- g_free (temp->data);
- g_slist_free (ids);
+ add_selected_calendar (e_source_peek_uid (calendar));
g_free (abs_uri);
g_free (rel_uri);
@@ -385,14 +400,7 @@ setup_google_accounts (MailAccountView *mav)
e_source_list_sync (slist, NULL);
- ids = gconf_client_get_list (gconf, SELECTED_CALENDARS, GCONF_VALUE_STRING, NULL);
- ids = g_slist_append (ids, g_strdup (e_source_peek_uid (calendar)));
- gconf_client_set_list (gconf, SELECTED_CALENDARS, GCONF_VALUE_STRING, ids, NULL);
- temp = ids;
-
- for (; temp != NULL; temp = g_slist_next (temp))
- g_free (temp->data);
- g_slist_free (ids);
+ add_selected_calendar (e_source_peek_uid (calendar));
g_free (abs_uri);
g_free (rel_uri);