[empathy/mc5] Refactor the startup sequence a bit
- From: Sjoerd Simons <sjoerds src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy/mc5] Refactor the startup sequence a bit
- Date: Sun, 23 Aug 2009 22:21:23 +0000 (UTC)
commit 96ae3367ff3aca2ef4c33e7e1f4790c7d5cc6fe3
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date: Sun Aug 23 18:55:54 2009 +0100
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
src/empathy.c | 67 +++++++++++++++++++++++++++++++-------------------------
1 files changed, 37 insertions(+), 30 deletions(-)
---
diff --git a/src/empathy.c b/src/empathy.c
index a80d396..38fd56c 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]