]> git.0d.be Git - empathy.git/blobdiff - src/empathy-import-widget.c
Merge branch 'change-audio'
[empathy.git] / src / empathy-import-widget.c
index 5a0d82c8c151ead5ec664d6d5bb4e4c24056b8fd..fc1e2f5326157db93c04eeb81b448e5d4a7dc4db 100644 (file)
@@ -22,6 +22,8 @@
 
 /* empathy-import-widget.c */
 
+#include <config.h>
+
 #include "empathy-import-dialog.h"
 #include "empathy-import-widget.h"
 #include "empathy-import-pidgin.h"
@@ -36,7 +38,7 @@
 #include <telepathy-glib/account-manager.h>
 #include <telepathy-glib/util.h>
 
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
 
 G_DEFINE_TYPE (EmpathyImportWidget, empathy_import_widget, G_TYPE_OBJECT)
 
@@ -165,6 +167,7 @@ import_widget_create_account_cb (GObject *source,
   GAsyncResult *result,
   gpointer user_data)
 {
+  TpAccountManager *account_manager;
   TpAccount *account;
   GError *error = NULL;
   EmpathyImportWidget *self = user_data;
@@ -182,6 +185,13 @@ import_widget_create_account_cb (GObject *source,
 
   DEBUG ("account created\n");
 
+  if (tp_account_is_enabled (account))
+    {
+      account_manager = tp_account_manager_dup ();
+      empathy_connect_new_account (account, account_manager);
+      g_object_unref (account_manager);
+    }
+
   g_object_unref (self);
 }
 
@@ -206,7 +216,8 @@ import_widget_add_account (EmpathyImportWidget *self,
 
   DEBUG ("display name: %s\n", display_name);
 
-  properties = g_hash_table_new (NULL, NULL);
+  properties = tp_asv_new (NULL, NULL);
+  tp_asv_set_boolean (properties, TP_IFACE_ACCOUNT ".Enabled", data->enabled);
 
   tp_account_manager_create_account_async (account_manager,
       (const gchar*) data->connection_manager, data->protocol, display_name,
@@ -334,12 +345,17 @@ import_widget_set_up_account_list (EmpathyImportWidget *self)
 }
 
 static void
-import_widget_cms_ready_cb (EmpathyConnectionManagers *cms,
-    GParamSpec *pspec,
-    EmpathyImportWidget *self)
+import_widget_cms_prepare_cb (GObject *source,
+    GAsyncResult *result,
+    gpointer user_data)
 {
-  if (empathy_connection_managers_is_ready (cms))
-    import_widget_set_up_account_list (self);
+  EmpathyImportWidget *self = user_data;
+
+  if (!empathy_connection_managers_prepare_finish (
+        EMPATHY_CONNECTION_MANAGERS (source), result, NULL))
+    return;
+
+  import_widget_set_up_account_list (self);
 }
 
 static void
@@ -438,11 +454,8 @@ do_constructed (GObject *obj)
   g_signal_connect (priv->vbox, "destroy",
       G_CALLBACK (import_widget_destroy_cb), self);
 
-  if (empathy_connection_managers_is_ready (priv->cms))
-    import_widget_set_up_account_list (self);
-  else
-    g_signal_connect (priv->cms, "notify::ready",
-        G_CALLBACK (import_widget_cms_ready_cb), self);
+  empathy_connection_managers_prepare_async (priv->cms,
+      import_widget_cms_prepare_cb, self);
 }
 
 static void