summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-09-23 15:00:03 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2011-09-23 15:23:54 +0100
commitaf96bbe41f468f6301819b455713359d25efb5d7 (patch)
tree87fbf7d606b62f6c3fb47c99cd868466d86b5e70 /util
parent871eb58541a95c2f9c015350b4f63aca64c4b785 (diff)
mc-tool add: use tp_account_manager_create_account_async
Diffstat (limited to 'util')
-rw-r--r--util/mc-tool.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/util/mc-tool.c b/util/mc-tool.c
index 005d6d42..f6b5eca1 100644
--- a/util/mc-tool.c
+++ b/util/mc-tool.c
@@ -518,18 +518,23 @@ command_list (TpAccountManager *manager)
static void
-callback_for_create_account (TpAccountManager *proxy,
- gchar const *account,
- GError const *error,
- gpointer user_data,
- GObject *weak)
+callback_for_create_account (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
{
- if (error == NULL) {
+ TpAccountManager *am = TP_ACCOUNT_MANAGER (source);
+ TpAccount *account;
+ GError *error = NULL;
+
+ account = tp_account_manager_create_account_finish (am, result, &error);
+
+ if (account != NULL) {
command.common.ret = 0;
- puts (skip_prefix (account));
+ puts (skip_prefix (tp_proxy_get_object_path (account)));
}
else {
- fprintf (stderr, "%s: %s\n", app_name, error->message);
+ fprintf (stderr, "%s %s: %s\n", app_name, command.common.name,
+ error->message);
}
g_main_loop_quit (main_loop);
}
@@ -537,20 +542,17 @@ callback_for_create_account (TpAccountManager *proxy,
static gboolean
command_add (TpAccountManager *manager)
{
- GHashTable *properties;
-
- properties = g_hash_table_new (g_str_hash, g_str_equal);
+ GHashTable *properties = tp_asv_new (NULL, NULL);
- return NULL !=
- tp_cli_account_manager_call_create_account
- (manager, 25000,
+ tp_account_manager_create_account_async (manager,
command.add.manager,
command.add.protocol,
command.add.display,
command.add.parameters,
properties,
callback_for_create_account,
- NULL, NULL, NULL);
+ NULL);
+ return TRUE;
}
static void