aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/empathy-account-assistant.c18
-rw-r--r--src/empathy-account-assistant.h2
-rw-r--r--src/empathy.c31
3 files changed, 41 insertions, 10 deletions
diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c
index ca4881fd3..d9834f38b 100644
--- a/src/empathy-account-assistant.c
+++ b/src/empathy-account-assistant.c
@@ -930,8 +930,20 @@ empathy_account_assistant_init (EmpathyAccountAssistant *self)
}
GtkWidget *
-empathy_account_assistant_new (GtkWindow *window)
+empathy_account_assistant_show (GtkWindow *window)
{
- return g_object_new (EMPATHY_TYPE_ACCOUNT_ASSISTANT, "parent-window",
- window, NULL);
+ static GtkWidget *dialog = NULL;
+
+ if (dialog == NULL)
+ {
+ dialog = g_object_new (EMPATHY_TYPE_ACCOUNT_ASSISTANT, "parent-window",
+ window, NULL);
+ g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &dialog);
+ }
+
+ gtk_window_present (GTK_WINDOW (dialog));
+
+ return dialog;
}
+
+
diff --git a/src/empathy-account-assistant.h b/src/empathy-account-assistant.h
index 857460201..ef91fa9da 100644
--- a/src/empathy-account-assistant.h
+++ b/src/empathy-account-assistant.h
@@ -56,7 +56,7 @@ typedef struct {
GType empathy_account_assistant_get_type (void);
-GtkWidget *empathy_account_assistant_new (GtkWindow *parent);
+GtkWidget *empathy_account_assistant_show (GtkWindow *parent);
G_END_DECLS
diff --git a/src/empathy.c b/src/empathy.c
index 1226b55dd..9152b643d 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -313,18 +313,37 @@ create_salut_account_if_needed (EmpathyConnectionManagers *managers)
g_object_unref (book);
}
+static gboolean
+has_non_salut_accounts (EmpathyAccountManager *manager)
+{
+ gboolean ret = FALSE;
+ GList *accounts, *l;
+
+ accounts = empathy_account_manager_dup_accounts (manager);
+
+ for (l = accounts ; l != NULL; l = g_list_next (l))
+ {
+ EmpathyAccount *account = EMPATHY_ACCOUNT (l->data);
+
+ if (tp_strdiff (empathy_account_get_protocol (l->data), "local-xmpp"))
+ ret = TRUE;
+
+ g_object_unref (account);
+ }
+
+ g_list_free (accounts);
+
+ return ret;
+}
+
static void
maybe_show_account_assistant (void)
{
EmpathyAccountManager *manager;
manager = empathy_account_manager_dup_singleton ();
- if (empathy_account_manager_get_count (manager) == 0)
- {
- GtkWidget * assistant = empathy_account_assistant_new (
- GTK_WINDOW (empathy_main_window_get ()));
- gtk_window_present (GTK_WINDOW (assistant));
- }
+ if (!has_non_salut_accounts (manager))
+ empathy_account_assistant_show (GTK_WINDOW (empathy_main_window_get ()));
}
static gboolean