diff options
author | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2010-06-11 14:36:09 +0800 |
---|---|---|
committer | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2010-06-18 09:35:16 +0800 |
commit | c563c362a275d985a2d51c218ce0aca7ad3248f0 (patch) | |
tree | 9baeb38f4524d85f0815c6cbd504e107b967f6f2 | |
parent | 4b4d14729fd0b03b72fd8b02047e0e97a4f79042 (diff) | |
download | gsoc2013-empathy-c563c362a275d985a2d51c218ce0aca7ad3248f0.tar gsoc2013-empathy-c563c362a275d985a2d51c218ce0aca7ad3248f0.tar.gz gsoc2013-empathy-c563c362a275d985a2d51c218ce0aca7ad3248f0.tar.bz2 gsoc2013-empathy-c563c362a275d985a2d51c218ce0aca7ad3248f0.tar.lz gsoc2013-empathy-c563c362a275d985a2d51c218ce0aca7ad3248f0.tar.xz gsoc2013-empathy-c563c362a275d985a2d51c218ce0aca7ad3248f0.tar.zst gsoc2013-empathy-c563c362a275d985a2d51c218ce0aca7ad3248f0.zip |
Port empathy-import-mc4-accounts imported setting to GSettings
-rw-r--r-- | libempathy/empathy-gsettings.h | 3 | ||||
-rw-r--r-- | src/empathy-import-mc4-accounts.c | 29 |
2 files changed, 17 insertions, 15 deletions
diff --git a/libempathy/empathy-gsettings.h b/libempathy/empathy-gsettings.h index 1aef1e353..eb5074f03 100644 --- a/libempathy/empathy-gsettings.h +++ b/libempathy/empathy-gsettings.h @@ -86,6 +86,9 @@ G_BEGIN_DECLS #define EMPATHY_PREFS_LOCATION_RESOURCE_GPS "resource-gps" #define EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY "reduce-accuracy" +#define EMPATHY_PREFS_ACCOUNTS_SCHEMA EMPATHY_PREFS_SCHEMA ".accounts" +#define EMPATHY_PREFS_ACCOUNTS_IMPORTED_MC4_ACCOUNTS "imported-mc4-accounts" + G_END_DECLS #endif /* __EMPATHY_GSETTINGS_H__ */ diff --git a/src/empathy-import-mc4-accounts.c b/src/empathy-import-mc4-accounts.c index 1d5fd674a..24332d23a 100644 --- a/src/empathy-import-mc4-accounts.c +++ b/src/empathy-import-mc4-accounts.c @@ -33,6 +33,7 @@ #include <gnome-keyring.h> #include <libempathy/empathy-account-settings.h> #include <libempathy/empathy-connection-managers.h> +#include <libempathy/empathy-gsettings.h> #include "empathy-import-mc4-accounts.h" @@ -40,7 +41,6 @@ #include <libempathy/empathy-debug.h> #define MC_ACCOUNTS_GCONF_BASE "/apps/telepathy/mc/accounts" -#define IMPORTED_MC4_ACCOUNTS "/apps/empathy/accounts/imported_mc4_accounts" typedef struct { @@ -463,13 +463,15 @@ failed: gboolean empathy_import_mc4_has_imported (void) { - GConfClient *client; + GSettings *gsettings; gboolean ret; - client = gconf_client_get_default (); + gsettings = g_settings_new (EMPATHY_PREFS_ACCOUNTS_SCHEMA); - ret = gconf_client_get_bool (client, IMPORTED_MC4_ACCOUNTS, NULL); - g_object_unref (client); + ret = g_settings_get_boolean (gsettings, + EMPATHY_PREFS_ACCOUNTS_IMPORTED_MC4_ACCOUNTS); + + g_object_unref (gsettings); return ret; } @@ -478,6 +480,7 @@ gboolean empathy_import_mc4_accounts (EmpathyConnectionManagers *managers) { GConfClient *client; + GSettings *gsettings; GError *error = NULL; GSList *dir, *dirs = NULL; gboolean imported_mc4_accounts; @@ -486,17 +489,10 @@ empathy_import_mc4_accounts (EmpathyConnectionManagers *managers) g_return_val_if_fail (empathy_connection_managers_is_ready (managers), FALSE); + gsettings = g_settings_new (EMPATHY_PREFS_ACCOUNTS_SCHEMA); client = gconf_client_get_default (); - imported_mc4_accounts = gconf_client_get_bool (client, - IMPORTED_MC4_ACCOUNTS, &error); - - if (error != NULL) - { - DEBUG ("Failed to get import_mc4_accounts key: %s", error->message); - g_error_free (error); - goto out; - } + imported_mc4_accounts = empathy_import_mc4_has_imported (); if (imported_mc4_accounts) { @@ -525,9 +521,12 @@ empathy_import_mc4_accounts (EmpathyConnectionManagers *managers) } out: - gconf_client_set_bool (client, IMPORTED_MC4_ACCOUNTS, TRUE, NULL); + g_settings_set_boolean (gsettings, + EMPATHY_PREFS_ACCOUNTS_IMPORTED_MC4_ACCOUNTS, TRUE); g_slist_free (dirs); g_object_unref (client); + g_object_unref (gsettings); + return imported; } |