Commit e288bb38 authored by Sjoerd Simons's avatar Sjoerd Simons

Show the assistant if there are no non-salut accounts

parent dd33e47c
......@@ -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;
}
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment