diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-24 01:24:46 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-24 06:18:48 +0800 |
commit | afd7de0052654752aa60edc8dddfd628eaa49ce6 (patch) | |
tree | d49b07891f40a5d3e43a0899d6ddecc460400c50 /src | |
parent | f4cd87f5aba95e2c20cb4af10f9de8e1d62b3702 (diff) | |
download | gsoc2013-empathy-afd7de0052654752aa60edc8dddfd628eaa49ce6.tar gsoc2013-empathy-afd7de0052654752aa60edc8dddfd628eaa49ce6.tar.gz gsoc2013-empathy-afd7de0052654752aa60edc8dddfd628eaa49ce6.tar.bz2 gsoc2013-empathy-afd7de0052654752aa60edc8dddfd628eaa49ce6.tar.lz gsoc2013-empathy-afd7de0052654752aa60edc8dddfd628eaa49ce6.tar.xz gsoc2013-empathy-afd7de0052654752aa60edc8dddfd628eaa49ce6.tar.zst gsoc2013-empathy-afd7de0052654752aa60edc8dddfd628eaa49ce6.zip |
Return TRUE if we imported any mc4 accounts
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-import-mc4-accounts.c | 30 | ||||
-rw-r--r-- | src/empathy-import-mc4-accounts.h | 2 |
2 files changed, 20 insertions, 12 deletions
diff --git a/src/empathy-import-mc4-accounts.c b/src/empathy-import-mc4-accounts.c index 614c5cbe3..5425b35cd 100644 --- a/src/empathy-import-mc4-accounts.c +++ b/src/empathy-import-mc4-accounts.c @@ -283,7 +283,7 @@ _recurse_account (GSList *entries, EmpathyAccountSettings *settings, } } -static void +static gboolean import_one_account (const char *path, EmpathyConnectionManagers *managers, GConfClient *client) @@ -298,6 +298,7 @@ import_one_account (const char *path, gchar *display_name; gchar *key; gboolean enabled = FALSE; + gboolean ret = FALSE; DEBUG ("Starting import of %s (%s)", path, account_name); @@ -350,12 +351,15 @@ import_one_account (const char *path, g_free (key); empathy_account_settings_apply_async (settings, _create_account_cb, GINT_TO_POINTER (enabled)); + ret = TRUE; + out: g_free (protocol); g_free (profile); g_slist_free (entries); g_free (account_name); - return; + + return ret; failed: DEBUG ("Failed to import %s", path); @@ -364,15 +368,17 @@ failed: goto out; } -void +gboolean empathy_import_mc4_accounts (EmpathyConnectionManagers *managers) { GConfClient *client; GError *error = NULL; - GSList *dir, *dirs; + GSList *dir, *dirs = NULL; gboolean imported_mc4_accounts; + gboolean imported = FALSE; - g_return_if_fail (empathy_connection_managers_is_ready (managers)); + g_return_val_if_fail (empathy_connection_managers_is_ready (managers), + FALSE); client = gconf_client_get_default (); @@ -384,14 +390,13 @@ empathy_import_mc4_accounts (EmpathyConnectionManagers *managers) DEBUG ("Failed to get import_mc4_accounts key: %s\n", error->message); g_clear_error (&error); g_object_unref (client); - return; + goto out; } if (imported_mc4_accounts) { DEBUG ("Mc4 accounts already imported"); - g_object_unref (client); - return; + goto out; } DEBUG ("MC 4 accounts are going to be imported\n"); @@ -404,15 +409,15 @@ empathy_import_mc4_accounts (EmpathyConnectionManagers *managers) error->message); g_clear_error (&error); g_object_unref (client); - return; + goto out; } for (dir = dirs; NULL != dir; dir = dir->next) { - import_one_account ((gchar *)dir->data, managers, client); + if (import_one_account ((gchar *)dir->data, managers, client)) + imported = TRUE; g_free (dir->data); } - g_slist_free (dirs); gconf_client_set_bool (client, IMPORTED_MC4_ACCOUNTS, TRUE, &error); @@ -423,5 +428,8 @@ empathy_import_mc4_accounts (EmpathyConnectionManagers *managers) g_clear_error (&error); } +out: + g_slist_free (dirs); g_object_unref (client); + return imported; } diff --git a/src/empathy-import-mc4-accounts.h b/src/empathy-import-mc4-accounts.h index e5392db67..c30b4e505 100644 --- a/src/empathy-import-mc4-accounts.h +++ b/src/empathy-import-mc4-accounts.h @@ -26,7 +26,7 @@ G_BEGIN_DECLS #include <libempathy/empathy-connection-managers.h> -void empathy_import_mc4_accounts (EmpathyConnectionManagers *managers); +gboolean empathy_import_mc4_accounts (EmpathyConnectionManagers *managers); G_END_DECLS |