]> git.0d.be Git - empathy.git/blobdiff - src/empathy-accounts-common.c
Merge remote-tracking branch 'glassrose/add-All-service-selection-in-debug-window'
[empathy.git] / src / empathy-accounts-common.c
index 311a5f60083b7b173453ea22c03b211f1b9dbd52..f6bb4027846cd0f5bb30ca427958167dcac984fe 100644 (file)
@@ -30,8 +30,7 @@
 #include <stdlib.h>
 
 #include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <unique/unique.h>
+#include <glib/gi18n-lib.h>
 
 #include <telepathy-glib/account-manager.h>
 #include <telepathy-glib/util.h>
@@ -42,9 +41,6 @@
 
 #include "empathy-accounts-common.h"
 #include "empathy-accounts-dialog.h"
-#include "empathy-account-assistant.h"
-#include "empathy-import-mc4-accounts.h"
-#include "empathy-auto-salut-account-helper.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
 #include <libempathy/empathy-debug.h>
@@ -84,83 +80,23 @@ empathy_accounts_has_accounts (TpAccountManager *manager)
   return has_accounts;
 }
 
-void
-empathy_accounts_import (TpAccountManager *account_mgr,
-    EmpathyConnectionManagers *cm_mgr)
-{
-  g_return_if_fail (tp_account_manager_is_prepared (account_mgr,
-      TP_ACCOUNT_MANAGER_FEATURE_CORE));
-  g_return_if_fail (empathy_connection_managers_is_ready (cm_mgr));
-
-  if (!empathy_import_mc4_has_imported ())
-    empathy_import_mc4_accounts (cm_mgr);
-}
-
-static void
-do_show_accounts_ui (TpAccountManager *manager,
-    TpAccount *account,
-    GCallback window_destroyed_cb)
-{
-  GtkWidget *accounts_window;
-
-  accounts_window = empathy_accounts_dialog_show (NULL, account);
-
-  if (window_destroyed_cb)
-    g_signal_connect (accounts_window, "destroy", window_destroyed_cb, NULL);
-
-  gtk_window_present (GTK_WINDOW (accounts_window));
-}
-
-static GtkWidget *
-show_account_assistant (EmpathyConnectionManagers *connection_mgrs,
-    GCallback assistant_destroy_cb)
-{
-  GtkWidget *assistant;
-
-  assistant = empathy_account_assistant_show (NULL, connection_mgrs);
-  if (assistant_destroy_cb)
-    g_signal_connect (assistant, "destroy", assistant_destroy_cb, NULL);
-
-  return assistant;
-}
-
-static void
-connection_managers_prepare_for_accounts (GObject *source,
-    GAsyncResult *result,
-    gpointer user_data)
-{
-  EmpathyConnectionManagers *cm_mgr = EMPATHY_CONNECTION_MANAGERS (source);
-  GCallback assistant_destroy_cb = G_CALLBACK (user_data);
-
-  if (!empathy_connection_managers_prepare_finish (cm_mgr, result, NULL))
-    goto out;
-
-  show_account_assistant (cm_mgr, assistant_destroy_cb);
-  DEBUG ("would show the account assistant");
-
-out:
-  g_object_unref (cm_mgr);
-}
-
 void
 empathy_accounts_show_accounts_ui (TpAccountManager *manager,
     TpAccount *account,
-    GCallback window_destroyed_cb)
+    GApplication *app)
 {
+  static GtkWidget *accounts_window = NULL;
+
   g_return_if_fail (TP_IS_ACCOUNT_MANAGER (manager));
   g_return_if_fail (!account || TP_IS_ACCOUNT (account));
 
-  if (empathy_accounts_has_non_salut_accounts (manager))
-    {
-      do_show_accounts_ui (manager, account, window_destroyed_cb);
-    }
-  else
+  if (accounts_window == NULL)
     {
-      EmpathyConnectionManagers *cm_mgr;
+      accounts_window = empathy_accounts_dialog_show (NULL, account);
 
-      cm_mgr = empathy_connection_managers_dup_singleton ();
-
-      empathy_connection_managers_prepare_async (cm_mgr,
-          connection_managers_prepare_for_accounts, window_destroyed_cb);
+      gtk_application_add_window (GTK_APPLICATION (app),
+          GTK_WINDOW (accounts_window));
     }
+
+  gtk_window_present (GTK_WINDOW (accounts_window));
 }