aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-10-14 07:22:40 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-10-15 01:26:03 +0800
commite288bb38a4f04cf4ce00e77b5b81937eda2f0a12 (patch)
treef3d9ea94a03f443e657d0961e8284b84bf7add4c /src
parentdd33e47cf95d374d9dfb9d0346cf2977c9393a21 (diff)
downloadgsoc2013-empathy-e288bb38a4f04cf4ce00e77b5b81937eda2f0a12.tar
gsoc2013-empathy-e288bb38a4f04cf4ce00e77b5b81937eda2f0a12.tar.gz
gsoc2013-empathy-e288bb38a4f04cf4ce00e77b5b81937eda2f0a12.tar.bz2
gsoc2013-empathy-e288bb38a4f04cf4ce00e77b5b81937eda2f0a12.tar.lz
gsoc2013-empathy-e288bb38a4f04cf4ce00e77b5b81937eda2f0a12.tar.xz
gsoc2013-empathy-e288bb38a4f04cf4ce00e77b5b81937eda2f0a12.tar.zst
gsoc2013-empathy-e288bb38a4f04cf4ce00e77b5b81937eda2f0a12.zip
Show the assistant if there are no non-salut accounts
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