]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-account.c
Merge commit 'jtellier/reconnect-account'
[empathy.git] / libempathy / empathy-account.c
index b508f3952077dae54f063ee7b9f77e597e90f4d8..0e4758baa648cb198f4675a3c771effdef581aa9 100644 (file)
@@ -348,7 +348,7 @@ empathy_account_got_all_cb (TpProxy *proxy,
 {
   EmpathyAccount *account = EMPATHY_ACCOUNT (weak_object);
 
-  DEBUG ("Got initial set of properties for %s",
+  DEBUG ("Got whole set of properties for %s",
     empathy_account_get_unique_name (account));
 
   if (error != NULL)
@@ -475,12 +475,7 @@ empathy_account_constructed (GObject *object)
     empathy_account_removed_cb,
     NULL, NULL, object, NULL);
 
-  tp_cli_dbus_properties_call_get_all (priv->account, -1,
-    TP_IFACE_ACCOUNT,
-    empathy_account_got_all_cb,
-    NULL,
-    NULL,
-    G_OBJECT (account));
+  empathy_account_refresh_properties (account);
 }
 
 static void empathy_account_dispose (GObject *object);
@@ -957,17 +952,20 @@ empathy_account_set_enabled_async (EmpathyAccount *account,
       return;
     }
 
-  acc_manager = empathy_account_manager_dup_singleton ();
-  presence = empathy_account_manager_get_requested_global_presence
-    (acc_manager, &status, &status_message);
+  if (enabled)
+    {
+      acc_manager = empathy_account_manager_dup_singleton ();
+      presence = empathy_account_manager_get_requested_global_presence
+       (acc_manager, &status, &status_message);
 
-  if (presence != TP_CONNECTION_PRESENCE_TYPE_UNSET)
-    empathy_account_request_presence (account, presence, status,
-        status_message);
+      if (presence != TP_CONNECTION_PRESENCE_TYPE_UNSET)
+       empathy_account_request_presence (account, presence, status,
+            status_message);
 
-  g_object_unref (acc_manager);
-  g_free (status);
-  g_free (status_message);
+      g_object_unref (acc_manager);
+      g_free (status);
+      g_free (status_message);
+    }
 
   g_value_init (&value, G_TYPE_BOOLEAN);
   g_value_set_boolean (&value, enabled);
@@ -1218,3 +1216,19 @@ empathy_account_remove_finish (EmpathyAccount *account,
   return TRUE;
 }
 
+void
+empathy_account_refresh_properties (EmpathyAccount *account)
+{
+  EmpathyAccountPriv *priv;
+
+  g_return_if_fail (EMPATHY_IS_ACCOUNT (account));
+
+  priv = GET_PRIV (account);
+
+  tp_cli_dbus_properties_call_get_all (priv->account, -1,
+    TP_IFACE_ACCOUNT,
+    empathy_account_got_all_cb,
+    NULL,
+    NULL,
+    G_OBJECT (account));
+}