Don't pass managers to create_salut_account_if_needed
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 19 Jan 2010 14:54:46 +0000 (14:54 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 19 Jan 2010 16:11:11 +0000 (16:11 +0000)
It can dup it itself.

src/empathy-auto-salut-account-helper.c
src/empathy-auto-salut-account-helper.h
src/empathy.c

index a6bbf88d9a711824dabd90e239ef333dc67e9880..30842dd436b1d9262238bb5c10f8f6c4fe66b860 100644 (file)
@@ -201,15 +201,33 @@ create_salut_account_am_ready_cb (GObject *source_object,
   g_object_unref (managers);
 }
 
-void
-create_salut_account_if_needed (EmpathyConnectionManagers *managers)
+static void
+create_salut_account_cms_ready_cb (EmpathyConnectionManagers *managers)
 {
   TpAccountManager *manager;
 
   manager = tp_account_manager_dup ();
 
   tp_account_manager_prepare_async (manager, NULL,
-      create_salut_account_am_ready_cb, g_object_ref (managers));
+      create_salut_account_am_ready_cb, managers);
 
   g_object_unref (manager);
 }
+
+void
+create_salut_account_if_needed (void)
+{
+  EmpathyConnectionManagers *managers;
+
+  managers = empathy_connection_managers_dup_singleton ();
+
+  if (empathy_connection_managers_is_ready (managers))
+    {
+      create_salut_account_cms_ready_cb (managers);
+    }
+  else
+    {
+      g_signal_connect (managers, "notify::ready",
+            G_CALLBACK (create_salut_account_cms_ready_cb), NULL);
+    }
+}
index 6e934500baa82af85524c0464a9de2dddea82b10..8cec7b8ff527cdf56f19b34b55795a2b49fa4374 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <libempathy/empathy-connection-managers.h>
 
-void create_salut_account_if_needed (EmpathyConnectionManagers *managers);
+void create_salut_account_if_needed (void);
 
 gboolean should_create_salut_account (TpAccountManager *manager);
 
index 60ff6c0cd89b5ce45137fa7f6c98146ceaf609e7..1d25e9247c9c5f310cc75b2b78ff25cc96746b64 100644 (file)
@@ -208,9 +208,8 @@ check_connection_managers_ready (EmpathyConnectionManagers *managers)
       if (!empathy_import_mc4_accounts (managers) && !start_hidden)
         maybe_show_account_assistant ();
 
-      create_salut_account_if_needed (managers);
+      create_salut_account_if_needed ();
       g_object_unref (managers);
-      managers = NULL;
       return TRUE;
     }
   return FALSE;