]> git.0d.be Git - empathy.git/commitdiff
rely on the factory to prepare TP_CONNECTION_FEATURE_BALANCE
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 18 Aug 2011 15:29:56 +0000 (17:29 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 19 Aug 2011 07:26:35 +0000 (09:26 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=656831

libempathy/empathy-client-factory.c
src/empathy-main-window.c

index 200ea5fe27b9008daf9eb55afb93bf2cba61e238..d3cc57e03393f4ba3e3596348a3072f00a6df7a7 100644 (file)
@@ -146,6 +146,9 @@ empathy_client_factory_dup_connection_features (TpSimpleClientFactory *factory,
   feature = TP_CONNECTION_FEATURE_CONTACT_INFO;
   g_array_append_val (features, feature);
 
+  feature = TP_CONNECTION_FEATURE_BALANCE;
+  g_array_append_val (features, feature);
+
   return features;
 }
 
index 3ecb939a4cfe95f3da9848b2e6464db73ac17b17..e3588c26c1ca0cb510cb6ed37f2c931141a993da 100644 (file)
@@ -1063,24 +1063,20 @@ main_window_setup_balance_create_widget (EmpathyMainWindow *window,
 }
 
 static void
-main_window_setup_balance_conn_ready (GObject      *source,
-                                     GAsyncResult *result,
-                                     gpointer      user_data)
+main_window_setup_balance (EmpathyMainWindow *window,
+                          TpAccount         *account)
 {
-       EmpathyMainWindow *window = user_data;
        EmpathyMainWindowPriv *priv = GET_PRIV (window);
-       TpConnection *conn = TP_CONNECTION (source);
-       TpAccount *account = g_object_get_data (source, "account");
+       TpConnection *conn = tp_account_get_connection (account);
        GtkAction *action;
-       GError *error = NULL;
        const gchar *uri;
 
-       if (!tp_proxy_prepare_finish (conn, result, &error)) {
-               DEBUG ("Failed to prepare connection: %s", error->message);
-
-               g_error_free (error);
+       if (conn == NULL)
                return;
-       }
+
+       /* need to prepare the connection:
+        * store the account on the connection */
+       g_object_set_data (G_OBJECT (conn), "account", account);
 
        if (!tp_proxy_is_prepared (conn, TP_CONNECTION_FEATURE_BALANCE))
                return;
@@ -1110,23 +1106,7 @@ main_window_setup_balance_conn_ready (GObject      *source,
 
        g_signal_connect (conn, "balance-changed",
                G_CALLBACK (main_window_balance_changed_cb), action);
-}
-
-static void
-main_window_setup_balance (EmpathyMainWindow *window,
-                          TpAccount         *account)
-{
-       TpConnection *conn = tp_account_get_connection (account);
-       GQuark features[] = { TP_CONNECTION_FEATURE_BALANCE, 0 };
 
-       if (conn == NULL)
-               return;
-
-       /* need to prepare the connection:
-        * store the account on the connection */
-       g_object_set_data (G_OBJECT (conn), "account", account);
-       tp_proxy_prepare_async (conn, features,
-               main_window_setup_balance_conn_ready, window);
 }
 
 static void