aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/empathy.c')
-rw-r--r--src/empathy.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/empathy.c b/src/empathy.c
index 2cc5a9f28..2dc62943e 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -69,6 +69,8 @@
#include <libempathy-gtk/empathy-location-manager.h>
#include "empathy-main-window.h"
+#include "empathy-import-mc4-accounts.h"
+#include "empathy-accounts-common.h"
#include "empathy-accounts-dialog.h"
#include "empathy-status-icon.h"
#include "empathy-call-window.h"
@@ -85,6 +87,10 @@
static gboolean start_hidden = FALSE;
static gboolean no_connect = FALSE;
+static void account_manager_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data);
+
static void
dispatch_cb (EmpathyDispatcher *dispatcher,
EmpathyDispatchOperation *operation,
@@ -248,10 +254,10 @@ accounts_application_exited_cb (GPid pid,
static void
show_accounts_ui (GdkScreen *screen,
- gboolean try_import)
+ gboolean if_needed)
{
empathy_accounts_dialog_show_application (screen,
- accounts_application_exited_cb, NULL, NULL, try_import, start_hidden);
+ accounts_application_exited_cb, NULL, NULL, if_needed, start_hidden);
}
static UniqueResponse
@@ -262,6 +268,7 @@ unique_app_message_cb (UniqueApp *unique_app,
gpointer user_data)
{
GtkWindow *window = user_data;
+ TpAccountManager *account_manager;
DEBUG ("Other instance launched, presenting the main window. "
"Command=%d, timestamp %u", command, timestamp);
@@ -281,6 +288,11 @@ unique_app_message_cb (UniqueApp *unique_app,
gtk_window_present_with_time (GTK_WINDOW (window), timestamp);
gtk_window_set_skip_taskbar_hint (window, FALSE);
+ account_manager = tp_account_manager_dup ();
+ tp_account_manager_prepare_async (account_manager, NULL,
+ account_manager_ready_cb, NULL);
+ g_object_unref (account_manager);
+
return UNIQUE_RESPONSE_OK;
}
@@ -370,7 +382,11 @@ account_manager_ready_cb (GObject *source_object,
/* if current state is Offline, then put it online */
empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_AVAILABLE);
- show_accounts_ui (gdk_screen_get_default (), TRUE);
+ /* Pop up the accounts dialog if it's needed (either when we don't have any
+ * non-salut accounts yet or when we haven't imported mc4 accounts yet */
+ if (!empathy_accounts_has_non_salut_accounts (manager)
+ || !empathy_import_mc4_has_imported ())
+ show_accounts_ui (gdk_screen_get_default (), TRUE);
g_object_unref (idle);
g_object_unref (connectivity);