2 * Copyright (C) 2008 Collabora Ltd.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 * Authors: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
19 * Sjoerd Simons <sjoerd.simons@collabora.co.uk>
24 #include <telepathy-glib/util.h>
25 #include <telepathy-glib/account-manager.h>
26 #include <telepathy-glib/enums.h>
27 #include <telepathy-glib/defs.h>
28 #include <telepathy-glib/dbus.h>
29 #include <telepathy-glib/interfaces.h>
31 #include "empathy-account-manager.h"
32 #include "empathy-marshal.h"
33 #include "empathy-utils.h"
35 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
36 #include <libempathy/empathy-debug.h>
38 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountManager)
40 #define MC5_BUS_NAME "org.freedesktop.Telepathy.MissionControl5"
43 /* (owned) unique name -> (reffed) EmpathyAccount */
49 TpAccountManager *tp_manager;
53 EmpathyAccount *global_account;
55 TpConnectionPresenceType global_presence;
57 gchar *global_status_message;
59 /* requested global presence, could be different
60 * from the actual global one.
62 TpConnectionPresenceType requested_presence;
63 gchar *requested_status;
64 gchar *requested_status_message;
66 GHashTable *create_results;
67 } EmpathyAccountManagerPriv;
75 ACCOUNT_CONNECTION_CHANGED,
76 GLOBAL_PRESENCE_CHANGED,
85 static guint signals[LAST_SIGNAL];
86 static EmpathyAccountManager *manager_singleton = NULL;
88 G_DEFINE_TYPE (EmpathyAccountManager, empathy_account_manager, G_TYPE_OBJECT);
91 emp_account_connection_cb (EmpathyAccount *account,
95 TpConnection *connection = empathy_account_get_connection (account);
97 DEBUG ("Signalling connection %p of account %s",
98 connection, empathy_account_get_unique_name (account));
100 if (connection != NULL)
101 g_signal_emit (manager, signals[NEW_CONNECTION], 0, connection);
105 emp_account_enabled_cb (EmpathyAccount *account,
109 if (empathy_account_is_enabled (account))
110 g_signal_emit (manager, signals[ACCOUNT_ENABLED], 0, account);
112 g_signal_emit (manager, signals[ACCOUNT_DISABLED], 0, account);
116 emp_account_status_changed_cb (EmpathyAccount *account,
117 TpConnectionStatus old,
118 TpConnectionStatus new,
119 TpConnectionStatusReason reason,
122 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (user_data);
123 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
127 case TP_CONNECTION_STATUS_CONNECTING:
130 case TP_CONNECTION_STATUS_CONNECTED:
139 case TP_CONNECTION_STATUS_CONNECTING:
142 case TP_CONNECTION_STATUS_CONNECTED:
149 g_signal_emit (manager, signals[ACCOUNT_CONNECTION_CHANGED], 0,
150 account, reason, new, old);
154 emp_account_manager_update_global_presence (EmpathyAccountManager *manager)
156 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
157 TpConnectionPresenceType presence = TP_CONNECTION_PRESENCE_TYPE_OFFLINE;
158 EmpathyAccount *account = NULL;
162 /* Make the global presence is equal to the presence of the account with the
163 * highest availability */
165 g_hash_table_iter_init (&iter, priv->accounts);
166 while (g_hash_table_iter_next (&iter, NULL, &value))
168 EmpathyAccount *a = EMPATHY_ACCOUNT (value);
169 TpConnectionPresenceType p;
171 g_object_get (a, "presence", &p, NULL);
173 if (tp_connection_presence_type_cmp_availability (p, presence) > 0)
180 priv->global_account = account;
181 g_free (priv->global_status);
182 g_free (priv->global_status_message);
186 priv->global_status = NULL;
187 priv->global_status_message = NULL;
191 g_object_get (account,
192 "presence", &priv->global_presence,
193 "status", &priv->global_status,
194 "status-message", &priv->global_status_message,
197 DEBUG ("Updated global presence to: %s (%d) \"%s\"",
198 priv->global_status, priv->global_presence, priv->global_status_message);
202 emp_account_presence_changed_cb (EmpathyAccount *account,
203 TpConnectionPresenceType presence,
205 const gchar *status_message,
208 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (user_data);
209 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
211 if (tp_connection_presence_type_cmp_availability (presence,
212 priv->global_presence) > 0)
214 priv->global_account = account;
216 priv->global_presence = presence;
218 g_free (priv->global_status);
219 priv->global_status = g_strdup (status);
221 g_free (priv->global_status_message);
222 priv->global_status_message = g_strdup (status_message);
226 else if (priv->global_account == account)
228 emp_account_manager_update_global_presence (manager);
234 g_signal_emit (manager, signals[GLOBAL_PRESENCE_CHANGED], 0,
235 priv->global_presence, priv->global_status, priv->global_status_message);
239 emp_account_removed_cb (EmpathyAccount *account, gpointer user_data)
241 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (user_data);
242 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
244 g_object_ref (account);
245 g_hash_table_remove (priv->accounts,
246 empathy_account_get_unique_name (account));
248 g_signal_emit (manager, signals[ACCOUNT_DELETED], 0, account);
249 g_object_unref (account);
253 empathy_account_manager_check_ready (EmpathyAccountManager *manager)
255 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
262 g_hash_table_iter_init (&iter, priv->accounts);
263 while (g_hash_table_iter_next (&iter, NULL, &value))
265 EmpathyAccount *account = EMPATHY_ACCOUNT (value);
268 g_object_get (account, "ready", &ready, NULL);
274 /* Rerequest global presence on the initial set of accounts for cases where a
275 * global presence was requested before the manager was ready */
276 if (priv->requested_presence != TP_CONNECTION_PRESENCE_TYPE_UNSET)
277 empathy_account_manager_request_global_presence (manager,
278 priv->requested_presence,
279 priv->requested_status,
280 priv->requested_status_message);
283 g_object_notify (G_OBJECT (manager), "ready");
287 account_manager_account_ready_cb (GObject *obj,
291 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (user_data);
292 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
293 EmpathyAccount *account = EMPATHY_ACCOUNT (obj);
294 GSimpleAsyncResult *result;
297 g_object_get (account, "ready", &ready, NULL);
302 /* see if there's any pending callbacks for this account */
303 result = g_hash_table_lookup (priv->create_results, account);
306 g_simple_async_result_set_op_res_gpointer (
307 G_SIMPLE_ASYNC_RESULT (result), account, NULL);
309 g_simple_async_result_complete (result);
311 g_hash_table_remove (priv->create_results, account);
312 g_object_unref (result);
315 g_signal_emit (manager, signals[ACCOUNT_CREATED], 0, account);
317 g_signal_connect (account, "notify::connection",
318 G_CALLBACK (emp_account_connection_cb), manager);
320 g_signal_connect (account, "notify::enabled",
321 G_CALLBACK (emp_account_enabled_cb), manager);
323 g_signal_connect (account, "status-changed",
324 G_CALLBACK (emp_account_status_changed_cb), manager);
326 g_signal_connect (account, "presence-changed",
327 G_CALLBACK (emp_account_presence_changed_cb), manager);
329 g_signal_connect (account, "removed",
330 G_CALLBACK (emp_account_removed_cb), manager);
332 empathy_account_manager_check_ready (manager);
336 empathy_account_manager_get_account (EmpathyAccountManager *manager,
339 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
340 EmpathyAccount *account;
342 account = g_hash_table_lookup (priv->accounts, path);
346 account = empathy_account_new (priv->dbus, path);
347 g_hash_table_insert (priv->accounts, g_strdup (path), account);
349 g_signal_connect (account, "notify::ready",
350 G_CALLBACK (account_manager_account_ready_cb), manager);
356 account_manager_got_all_cb (TpProxy *proxy,
357 GHashTable *properties,
360 GObject *weak_object)
362 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (weak_object);
368 DEBUG ("Failed to get account manager properties: %s", error->message);
372 accounts = tp_asv_get_boxed (properties, "ValidAccounts",
373 EMPATHY_ARRAY_TYPE_OBJECT);
375 if (accounts != NULL)
377 for (i = 0; i < accounts->len; i++)
379 gchar *name = g_ptr_array_index (accounts, i);
381 empathy_account_manager_get_account (manager, name);
385 empathy_account_manager_check_ready (manager);
389 account_validity_changed_cb (TpAccountManager *proxy,
393 GObject *weak_object)
395 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (weak_object);
400 empathy_account_manager_get_account (manager, path);
404 account_manager_name_owner_cb (TpDBusDaemon *proxy,
406 const gchar *new_owner,
409 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (user_data);
410 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
412 tp_dbus_daemon_cancel_name_owner_watch (proxy, name,
413 account_manager_name_owner_cb, user_data);
415 priv->tp_manager = tp_account_manager_new (priv->dbus);
417 tp_cli_account_manager_connect_to_account_validity_changed (
419 account_validity_changed_cb,
425 tp_cli_dbus_properties_call_get_all (priv->tp_manager, -1,
426 TP_IFACE_ACCOUNT_MANAGER,
427 account_manager_got_all_cb,
434 empathy_account_manager_init (EmpathyAccountManager *manager)
436 EmpathyAccountManagerPriv *priv;
439 priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
440 EMPATHY_TYPE_ACCOUNT_MANAGER, EmpathyAccountManagerPriv);
442 manager->priv = priv;
443 priv->connected = priv->connecting = 0;
444 priv->global_presence = TP_CONNECTION_PRESENCE_TYPE_UNSET;
446 priv->accounts = g_hash_table_new_full (g_str_hash, g_str_equal,
447 g_free, (GDestroyNotify) g_object_unref);
449 priv->create_results = g_hash_table_new (g_direct_hash, g_direct_equal);
451 priv->dbus = tp_dbus_daemon_dup (NULL);
453 tp_dbus_daemon_watch_name_owner (priv->dbus,
454 TP_ACCOUNT_MANAGER_BUS_NAME,
455 account_manager_name_owner_cb,
459 /* trigger MC5 starting */
460 mc5_proxy = g_object_new (TP_TYPE_PROXY,
461 "dbus-daemon", priv->dbus,
462 "dbus-connection", tp_proxy_get_dbus_connection (TP_PROXY (priv->dbus)),
463 "bus-name", MC5_BUS_NAME,
467 tp_cli_dbus_peer_call_ping (mc5_proxy, -1, NULL, NULL, NULL, NULL);
469 g_object_unref (mc5_proxy);
473 do_finalize (GObject *obj)
475 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (obj);
476 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
478 g_hash_table_destroy (priv->create_results);
479 g_hash_table_destroy (priv->accounts);
481 g_free (priv->global_status);
482 g_free (priv->global_status_message);
484 g_free (priv->requested_status);
485 g_free (priv->requested_status_message);
487 G_OBJECT_CLASS (empathy_account_manager_parent_class)->finalize (obj);
491 do_dispose (GObject *obj)
493 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (obj);
494 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
496 GSimpleAsyncResult *result;
498 if (priv->dispose_run)
501 priv->dispose_run = TRUE;
503 /* the manager is being destroyed while there are account creation
504 * processes pending; this should not happen, but emit the callbacks
505 * with an error anyway.
507 g_hash_table_iter_init (&iter, priv->create_results);
508 while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &result))
510 g_simple_async_result_set_error (result, G_IO_ERROR,
511 G_IO_ERROR_CANCELLED, "The account manager was disposed while "
512 "creating the account");
513 g_simple_async_result_complete (result);
514 g_object_unref (result);
516 g_hash_table_remove_all (priv->create_results);
518 if (priv->dbus != NULL)
520 tp_dbus_daemon_cancel_name_owner_watch (priv->dbus,
521 TP_ACCOUNT_MANAGER_BUS_NAME, account_manager_name_owner_cb, manager);
523 g_object_unref (priv->dbus);
527 G_OBJECT_CLASS (empathy_account_manager_parent_class)->dispose (obj);
531 do_constructor (GType type,
532 guint n_construct_params,
533 GObjectConstructParam *construct_params)
537 if (!manager_singleton)
539 retval = G_OBJECT_CLASS (empathy_account_manager_parent_class)->constructor (type,
542 manager_singleton = EMPATHY_ACCOUNT_MANAGER (retval);
543 g_object_add_weak_pointer (retval, (gpointer) &manager_singleton);
547 retval = g_object_ref (manager_singleton);
554 do_get_property (GObject *object,
559 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (object);
560 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
565 g_value_set_boolean (value, priv->ready);
568 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
574 empathy_account_manager_class_init (EmpathyAccountManagerClass *klass)
576 GObjectClass *oclass = G_OBJECT_CLASS (klass);
578 oclass->finalize = do_finalize;
579 oclass->dispose = do_dispose;
580 oclass->constructor = do_constructor;
581 oclass->get_property = do_get_property;
583 g_object_class_install_property (oclass, PROP_READY,
584 g_param_spec_boolean ("ready",
586 "Whether the initial state dump from the account manager is finished",
588 G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
590 signals[ACCOUNT_CREATED] =
591 g_signal_new ("account-created",
592 G_TYPE_FROM_CLASS (klass),
596 g_cclosure_marshal_VOID__OBJECT,
598 1, EMPATHY_TYPE_ACCOUNT);
600 signals[ACCOUNT_DELETED] =
601 g_signal_new ("account-deleted",
602 G_TYPE_FROM_CLASS (klass),
606 g_cclosure_marshal_VOID__OBJECT,
608 1, EMPATHY_TYPE_ACCOUNT);
610 signals[ACCOUNT_ENABLED] =
611 g_signal_new ("account-enabled",
612 G_TYPE_FROM_CLASS (klass),
616 g_cclosure_marshal_VOID__OBJECT,
618 1, EMPATHY_TYPE_ACCOUNT);
620 signals[ACCOUNT_DISABLED] =
621 g_signal_new ("account-disabled",
622 G_TYPE_FROM_CLASS (klass),
626 g_cclosure_marshal_VOID__OBJECT,
628 1, EMPATHY_TYPE_ACCOUNT);
630 signals[ACCOUNT_CHANGED] =
631 g_signal_new ("account-changed",
632 G_TYPE_FROM_CLASS (klass),
636 g_cclosure_marshal_VOID__OBJECT,
638 1, EMPATHY_TYPE_ACCOUNT);
640 signals[ACCOUNT_CONNECTION_CHANGED] =
641 g_signal_new ("account-connection-changed",
642 G_TYPE_FROM_CLASS (klass),
646 _empathy_marshal_VOID__OBJECT_INT_UINT_UINT,
648 4, EMPATHY_TYPE_ACCOUNT,
649 G_TYPE_INT, /* reason */
650 G_TYPE_UINT, /* actual connection */
651 G_TYPE_UINT); /* previous connection */
653 signals[GLOBAL_PRESENCE_CHANGED] =
654 g_signal_new ("global-presence-changed",
655 G_TYPE_FROM_CLASS (klass),
659 _empathy_marshal_VOID__UINT_STRING_STRING,
661 3, G_TYPE_UINT, /* Presence type */
662 G_TYPE_STRING, /* status */
663 G_TYPE_STRING); /* stauts message*/
665 signals[NEW_CONNECTION] =
666 g_signal_new ("new-connection",
667 G_TYPE_FROM_CLASS (klass),
671 g_cclosure_marshal_VOID__OBJECT,
673 1, TP_TYPE_CONNECTION);
675 g_type_class_add_private (oclass, sizeof (EmpathyAccountManagerPriv));
680 EmpathyAccountManager *
681 empathy_account_manager_dup_singleton (void)
683 return g_object_new (EMPATHY_TYPE_ACCOUNT_MANAGER, NULL);
687 empathy_account_manager_is_ready (EmpathyAccountManager *manager)
689 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
695 empathy_account_manager_get_connected_accounts (EmpathyAccountManager *manager)
697 EmpathyAccountManagerPriv *priv;
699 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), 0);
701 priv = GET_PRIV (manager);
703 return priv->connected;
707 empathy_account_manager_get_connecting_accounts (EmpathyAccountManager *manager)
709 EmpathyAccountManagerPriv *priv;
711 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), 0);
713 priv = GET_PRIV (manager);
715 return priv->connecting;
719 * empathy_account_manager_get_count:
720 * @manager: a #EmpathyAccountManager
722 * Get the number of accounts.
724 * Returns: the number of accounts.
727 empathy_account_manager_get_count (EmpathyAccountManager *manager)
729 EmpathyAccountManagerPriv *priv;
731 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), 0);
733 priv = GET_PRIV (manager);
735 return g_hash_table_size (priv->accounts);
739 empathy_account_manager_get_account_for_connection (
740 EmpathyAccountManager *manager,
741 TpConnection *connection)
743 EmpathyAccountManagerPriv *priv;
747 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), 0);
749 priv = GET_PRIV (manager);
751 g_hash_table_iter_init (&iter, priv->accounts);
752 while (g_hash_table_iter_next (&iter, NULL, &value))
754 EmpathyAccount *account = EMPATHY_ACCOUNT (value);
756 if (connection == empathy_account_get_connection (account))
764 empathy_account_manager_dup_accounts (EmpathyAccountManager *manager)
766 EmpathyAccountManagerPriv *priv;
769 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), NULL);
771 priv = GET_PRIV (manager);
773 ret = g_hash_table_get_values (priv->accounts);
774 g_list_foreach (ret, (GFunc) g_object_ref, NULL);
780 * empathy_account_manager_dup_connections:
781 * @manager: a #EmpathyAccountManager
783 * Get a #GList of all ready #TpConnection. The list must be freed with
784 * g_list_free, and its elements must be unreffed.
786 * Returns: the list of connections
789 empathy_account_manager_dup_connections (EmpathyAccountManager *manager)
791 EmpathyAccountManagerPriv *priv;
796 g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), NULL);
798 priv = GET_PRIV (manager);
800 g_hash_table_iter_init (&iter, priv->accounts);
801 while (g_hash_table_iter_next (&iter, NULL, &value))
803 EmpathyAccount *account = EMPATHY_ACCOUNT (value);
804 TpConnection *connection;
806 connection = empathy_account_get_connection (account);
807 if (connection != NULL)
808 ret = g_list_prepend (ret, g_object_ref (connection));
815 empathy_account_manager_request_global_presence (
816 EmpathyAccountManager *manager,
817 TpConnectionPresenceType type,
819 const gchar *message)
821 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
825 DEBUG ("request global presence, type: %d, status: %s, message: %s",
826 type, status, message);
828 g_hash_table_iter_init (&iter, priv->accounts);
829 while (g_hash_table_iter_next (&iter, NULL, &value))
831 EmpathyAccount *account = EMPATHY_ACCOUNT (value);
834 g_object_get (account, "ready", &ready, NULL);
837 empathy_account_request_presence (account, type, status, message);
840 /* save the requested global presence, to use it in case we create
841 * new accounts or some accounts become ready.
843 priv->requested_presence = type;
845 if (tp_strdiff (priv->requested_status, status))
847 g_free (priv->requested_status);
848 priv->requested_status = g_strdup (status);
851 if (tp_strdiff (priv->requested_status_message, message))
853 g_free (priv->requested_status_message);
854 priv->requested_status_message = g_strdup (message);
858 TpConnectionPresenceType
859 empathy_account_manager_get_requested_global_presence (
860 EmpathyAccountManager *manager,
864 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
867 *status = g_strdup (priv->requested_status);
869 *message = g_strdup (priv->requested_status_message);
871 return priv->requested_presence;
874 TpConnectionPresenceType
875 empathy_account_manager_get_global_presence (
876 EmpathyAccountManager *manager,
880 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
883 *status = g_strdup (priv->global_status);
885 *message = g_strdup (priv->global_status_message);
887 return priv->global_presence;
891 empathy_account_manager_created_cb (TpAccountManager *proxy,
892 const gchar *account_path,
895 GObject *weak_object)
897 EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (weak_object);
898 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
899 GSimpleAsyncResult *my_res = user_data;
900 EmpathyAccount *account;
904 g_simple_async_result_set_from_error (my_res,
906 g_simple_async_result_complete (my_res);
907 g_object_unref (my_res);
912 account = empathy_account_manager_get_account (manager, account_path);
914 g_hash_table_insert (priv->create_results, account, my_res);
918 empathy_account_manager_create_account_async (EmpathyAccountManager *manager,
919 const gchar *connection_manager,
920 const gchar *protocol,
921 const gchar *display_name,
922 GHashTable *parameters,
923 GHashTable *properties,
924 GAsyncReadyCallback callback,
927 EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
928 GSimpleAsyncResult *res;
930 res = g_simple_async_result_new
931 (G_OBJECT (manager), callback, user_data,
932 empathy_account_manager_create_account_finish);
934 tp_cli_account_manager_call_create_account (priv->tp_manager,
941 empathy_account_manager_created_cb,
948 empathy_account_manager_create_account_finish (
949 EmpathyAccountManager *manager, GAsyncResult *result, GError **error)
951 EmpathyAccount *retval;
953 if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result),
957 g_return_val_if_fail (g_simple_async_result_is_valid (result,
958 G_OBJECT (manager), empathy_account_manager_create_account_finish), NULL);
960 retval = EMPATHY_ACCOUNT (g_simple_async_result_get_op_res_gpointer (
961 G_SIMPLE_ASYNC_RESULT (result)));