aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-08-24 01:55:54 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-08-24 06:18:48 +0800
commit96ae3367ff3aca2ef4c33e7e1f4790c7d5cc6fe3 (patch)
treed6beaa528c5215749869a7c336026ffae5e278e9 /src/empathy.c
parent97ce0c3a078943c1c25ad8e2411482ffc9edc8c8 (diff)
downloadgsoc2013-empathy-96ae3367ff3aca2ef4c33e7e1f4790c7d5cc6fe3.tar
gsoc2013-empathy-96ae3367ff3aca2ef4c33e7e1f4790c7d5cc6fe3.tar.gz
gsoc2013-empathy-96ae3367ff3aca2ef4c33e7e1f4790c7d5cc6fe3.tar.bz2
gsoc2013-empathy-96ae3367ff3aca2ef4c33e7e1f4790c7d5cc6fe3.tar.lz
gsoc2013-empathy-96ae3367ff3aca2ef4c33e7e1f4790c7d5cc6fe3.tar.xz
gsoc2013-empathy-96ae3367ff3aca2ef4c33e7e1f4790c7d5cc6fe3.tar.zst
gsoc2013-empathy-96ae3367ff3aca2ef4c33e7e1f4790c7d5cc6fe3.zip
Refactor the startup sequence a bit
On initial start the following should happen: * If we haven't tried to import mc4 accounts, do so * If there were no mc4 accounts imported and there are no accounts defined show the account creation assistant. * If we haven't created a salut account, do so
Diffstat (limited to 'src/empathy.c')
-rw-r--r--src/empathy.c67
1 files changed, 37 insertions, 30 deletions
diff --git a/src/empathy.c b/src/empathy.c
index a80d39684..38fd56c54 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -323,39 +323,41 @@ create_salut_account_if_needed (EmpathyConnectionManagers *managers)
}
static void
-connection_managers_ready_cb (EmpathyConnectionManagers *managers,
- GParamSpec *spec,
- gpointer user_data)
+maybe_show_account_assistant (void)
{
- if (empathy_connection_managers_is_ready (managers))
+ EmpathyAccountManager *manager;
+ manager = empathy_account_manager_dup_singleton ();
+
+ if (empathy_account_manager_get_count (manager) == 0)
{
- empathy_import_mc4_accounts ();
- create_salut_account_if_needed (managers);
- g_object_unref (managers);
- managers = NULL;
+ GtkWidget * assistant = empathy_account_assistant_new (
+ GTK_WINDOW (empathy_main_window_get ()));
+ gtk_window_present (GTK_WINDOW (assistant));
}
}
-static void
-create_salut_account (void)
+static gboolean
+check_connection_managers_ready (EmpathyConnectionManagers *managers)
{
- EmpathyConnectionManagers *managers;
-
- if (!should_create_salut_account ())
- return;
-
- managers = empathy_connection_managers_dup_singleton ();
-
if (empathy_connection_managers_is_ready (managers))
{
+ if (!empathy_import_mc4_accounts (managers))
+ maybe_show_account_assistant ();
+
create_salut_account_if_needed (managers);
g_object_unref (managers);
+ managers = NULL;
+ return TRUE;
}
- else
- {
- g_signal_connect (managers, "notify::ready",
- G_CALLBACK (connection_managers_ready_cb), NULL);
- }
+ return FALSE;
+}
+
+static void
+connection_managers_ready_cb (EmpathyConnectionManagers *managers,
+ GParamSpec *spec,
+ gpointer user_data)
+{
+ check_connection_managers_ready (managers);
}
static void
@@ -536,19 +538,24 @@ account_manager_ready_cb (EmpathyAccountManager *manager,
GParamSpec *spec,
gpointer user_data)
{
- GtkWidget *assistant;
-
if (!empathy_account_manager_is_ready (manager))
return;
- if (empathy_account_manager_get_count (manager) == 0)
+ if (should_create_salut_account () || !empathy_import_mc4_has_imported ())
{
- assistant = empathy_account_assistant_new (
- GTK_WINDOW (empathy_main_window_get ()));
- gtk_window_present (GTK_WINDOW (assistant));
- }
+ EmpathyConnectionManagers *managers;
+ managers = empathy_connection_managers_dup_singleton ();
- create_salut_account ();
+ if (!check_connection_managers_ready (managers))
+ {
+ g_signal_connect (managers, "notify::ready",
+ G_CALLBACK (connection_managers_ready_cb), NULL);
+ }
+ }
+ else
+ {
+ maybe_show_account_assistant ();
+ }
}
int