[empathy/mc5: 99/483] Move the responsibility of popping up the empathy accounts dialog out of the status icon



commit 1c95c220ca3830e83ed436d840528126e9ba9d15
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Thu Jul 16 11:41:15 2009 +0100

    Move the responsibility of popping up the empathy accounts dialog out of the status icon

 src/empathy-status-icon.c |   17 -----------------
 src/empathy.c             |   21 ++++++++++++++++++---
 2 files changed, 18 insertions(+), 20 deletions(-)
---
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index f6c63c5..aca2d85 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -305,24 +305,7 @@ status_icon_set_visibility (EmpathyStatusIcon *icon,
 	if (!visible) {
 		empathy_window_iconify (priv->window, priv->icon);
 	} else {
-		GList *accounts;
-		GList *l;
-		gboolean one_enabled = FALSE;
-
 		empathy_window_present (GTK_WINDOW (priv->window), TRUE);
-
-		/* Show the accounts dialog if there is no enabled accounts */
-		accounts = empathy_account_manager_dup_accounts (priv->account_manager);
-		for (l = accounts ; l != NULL ; l = g_list_next (l)) {
-			one_enabled = empathy_account_is_enabled (EMPATHY_ACCOUNT (l->data))
-				|| one_enabled;
-			g_object_unref (l->data);
-		}
-		g_list_free (accounts);
-		if (!one_enabled) {
-			DEBUG ("No enabled account, Showing account dialog");
-			empathy_accounts_dialog_show (GTK_WINDOW (priv->window), NULL);
-		}
 	}
 }
 
diff --git a/src/empathy.c b/src/empathy.c
index 5e3d983..1fa7f5a 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -453,6 +453,22 @@ default_log_handler (const gchar *log_domain,
 }
 #endif /* ENABLE_DEBUG */
 
+static void
+account_manager_ready_cb (EmpathyAccountManager *manager,
+	GParamSpec *spec,
+	gpointer user_data)
+{
+	if (!empathy_account_manager_is_ready (manager))
+		return;
+
+	if (empathy_account_manager_get_count (manager) != 0)
+		{
+			empathy_accounts_dialog_show (GTK_WINDOW (empathy_main_window_get ()),
+				NULL);
+		}
+	create_salut_account ();
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -605,8 +621,8 @@ main (int argc, char *argv[])
 
 	/* account management */
 	account_manager = empathy_account_manager_dup_singleton ();
-
-	create_salut_account ();
+	g_signal_connect (account_manager, "notify::ready",
+		G_CALLBACK (account_manager_ready_cb), NULL);
 
 	/* Setting up UI */
 	window = empathy_main_window_show ();
@@ -666,4 +682,3 @@ main (int argc, char *argv[])
 
 	return EXIT_SUCCESS;
 }
-



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]