aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-21 23:50:43 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-22 00:27:59 +0800
commit10b85cf1e8161c7f3392f50dc329c89f3bb87512 (patch)
tree8f9244c7cf642a05f58536ae5193b18c3571fc2e
parentb81f5d599018df2378b489f080b5a2a64a8f9c9a (diff)
downloadgsoc2013-empathy-10b85cf1e8161c7f3392f50dc329c89f3bb87512.tar
gsoc2013-empathy-10b85cf1e8161c7f3392f50dc329c89f3bb87512.tar.gz
gsoc2013-empathy-10b85cf1e8161c7f3392f50dc329c89f3bb87512.tar.bz2
gsoc2013-empathy-10b85cf1e8161c7f3392f50dc329c89f3bb87512.tar.lz
gsoc2013-empathy-10b85cf1e8161c7f3392f50dc329c89f3bb87512.tar.xz
gsoc2013-empathy-10b85cf1e8161c7f3392f50dc329c89f3bb87512.tar.zst
gsoc2013-empathy-10b85cf1e8161c7f3392f50dc329c89f3bb87512.zip
Add API to Update an accounts parameters
-rw-r--r--libempathy/empathy-account.c51
-rw-r--r--libempathy/empathy-account.h8
2 files changed, 59 insertions, 0 deletions
diff --git a/libempathy/empathy-account.c b/libempathy/empathy-account.c
index 91edaed66..5ad3ef464 100644
--- a/libempathy/empathy-account.c
+++ b/libempathy/empathy-account.c
@@ -830,3 +830,54 @@ empathy_account_request_presence (EmpathyAccount *account,
g_value_unset (&value);
}
+
+static void
+empathy_account_updated_cb (TpAccount *proxy,
+ const gchar **reconnect_required,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT (user_data);
+
+ if (error != NULL)
+ {
+ g_simple_async_result_set_from_error (result, (GError *)error);
+ }
+
+ g_simple_async_result_complete (result);
+ g_object_unref (G_OBJECT (result));
+}
+
+void
+empathy_account_update_settings_async (EmpathyAccount *account,
+ const GHashTable *parameters, const gchar **unset_parameters,
+ GAsyncReadyCallback callback, gpointer user_data)
+{
+ EmpathyAccountPriv *priv = GET_PRIV (account);
+ GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (account),
+ callback, user_data, empathy_account_update_settings_finish);
+
+ tp_cli_account_call_update_parameters (priv->account,
+ -1,
+ (GHashTable *)parameters,
+ unset_parameters,
+ empathy_account_updated_cb,
+ result,
+ NULL,
+ G_OBJECT (account));
+}
+
+gboolean
+empathy_account_update_settings_finish (EmpathyAccount *account,
+ 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 (account), empathy_account_update_settings_finish), FALSE);
+
+ return TRUE;
+}
diff --git a/libempathy/empathy-account.h b/libempathy/empathy-account.h
index efc8df713..f498e11e3 100644
--- a/libempathy/empathy-account.h
+++ b/libempathy/empathy-account.h
@@ -22,6 +22,7 @@
#define __EMPATHY_ACCOUNT_H__
#include <glib-object.h>
+#include <gio/gio.h>
#include <telepathy-glib/connection.h>
@@ -71,6 +72,13 @@ gboolean empathy_account_is_enabled (EmpathyAccount *account);
gboolean empathy_account_is_valid (EmpathyAccount *account);
gboolean empathy_account_is_ready (EmpathyAccount *account);
+void empathy_account_update_settings_async (EmpathyAccount *account,
+ const GHashTable *parameters, const gchar **unset_parameters,
+ GAsyncReadyCallback callback, gpointer user_data);
+
+gboolean empathy_account_update_settings_finish (EmpathyAccount *account,
+ GAsyncResult *result, GError **error);
+
void empathy_account_set_display_name (EmpathyAccount *account,
const gchar *display_name);