diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2009-07-24 21:52:29 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2009-07-30 06:13:20 +0800 |
commit | e3ed5ba84d20da177070d4708bca4bdb9d0ee149 (patch) | |
tree | 74c0d06b877869874bf3d5865f26e6c47b453322 /libempathy/empathy-account-settings.c | |
parent | 45c7f5469ed08aeda3d54bf375d129cab5194cde (diff) | |
download | gsoc2013-empathy-e3ed5ba84d20da177070d4708bca4bdb9d0ee149.tar gsoc2013-empathy-e3ed5ba84d20da177070d4708bca4bdb9d0ee149.tar.gz gsoc2013-empathy-e3ed5ba84d20da177070d4708bca4bdb9d0ee149.tar.bz2 gsoc2013-empathy-e3ed5ba84d20da177070d4708bca4bdb9d0ee149.tar.lz gsoc2013-empathy-e3ed5ba84d20da177070d4708bca4bdb9d0ee149.tar.xz gsoc2013-empathy-e3ed5ba84d20da177070d4708bca4bdb9d0ee149.tar.zst gsoc2013-empathy-e3ed5ba84d20da177070d4708bca4bdb9d0ee149.zip |
Implement _set_display_name
Diffstat (limited to 'libempathy/empathy-account-settings.c')
-rw-r--r-- | libempathy/empathy-account-settings.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c index 2763f0702..989d2d355 100644 --- a/libempathy/empathy-account-settings.c +++ b/libempathy/empathy-account-settings.c @@ -799,6 +799,26 @@ empathy_account_settings_set_boolean (EmpathyAccountSettings *settings, tp_asv_set_boolean (priv->parameters, param, value); } +static void +account_settings_display_name_set_cb (GObject *src, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + EmpathyAccount *account = EMPATHY_ACCOUNT (src); + GSimpleAsyncResult *set_result = user_data; + + empathy_account_set_display_name_finish (account, res, &error); + + if (error != NULL) + { + g_simple_async_result_set_from_error (set_result, error); + g_error_free (error); + } + + g_simple_async_result_complete (set_result); + g_object_unref (set_result); +} void empathy_account_settings_set_display_name_async ( @@ -807,6 +827,26 @@ empathy_account_settings_set_display_name_async ( GAsyncReadyCallback callback, gpointer user_data) { + EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + GSimpleAsyncResult *result; + + result = g_simple_async_result_new (G_OBJECT (settings), + callback, user_data, empathy_account_settings_set_display_name_finish); + + if (priv->account == NULL) + { + if (priv->display_name != NULL) + g_free (priv->display_name); + + priv->display_name = g_strdup (name); + + g_simple_async_result_complete_in_idle (result); + + return; + } + + empathy_account_set_display_name_async (priv->account, name, + account_settings_display_name_set_cb, result); } gboolean @@ -815,6 +855,12 @@ empathy_account_settings_set_display_name_finish ( GAsyncResult *result, GError **error) { + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), + error)) + return FALSE; + + g_return_val_if_fail (g_simple_async_result_is_valid (result, + G_OBJECT (settings), empathy_account_settings_set_display_name_finish), FALSE); return TRUE; } |