aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-accounts.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-10-25 23:03:28 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-10-26 17:02:51 +0800
commit6678cb7bc2dbd2b57925bdb70da0cb64bad03e2c (patch)
tree3635c895be8c0f912b17fb39da1256aae9ba2bc2 /src/empathy-accounts.c
parentcf3a9f53216213720c3551c8e1833fc4eb971fe0 (diff)
downloadgsoc2013-empathy-6678cb7bc2dbd2b57925bdb70da0cb64bad03e2c.tar
gsoc2013-empathy-6678cb7bc2dbd2b57925bdb70da0cb64bad03e2c.tar.gz
gsoc2013-empathy-6678cb7bc2dbd2b57925bdb70da0cb64bad03e2c.tar.bz2
gsoc2013-empathy-6678cb7bc2dbd2b57925bdb70da0cb64bad03e2c.tar.lz
gsoc2013-empathy-6678cb7bc2dbd2b57925bdb70da0cb64bad03e2c.tar.xz
gsoc2013-empathy-6678cb7bc2dbd2b57925bdb70da0cb64bad03e2c.tar.zst
gsoc2013-empathy-6678cb7bc2dbd2b57925bdb70da0cb64bad03e2c.zip
empathy-debugger: rely on gtk_application_add_window() to manage the main loop
We have to old the application while doing async preparation as the app window is not created right away. https://bugzilla.gnome.org/show_bug.cgi?id=662504
Diffstat (limited to 'src/empathy-accounts.c')
-rw-r--r--src/empathy-accounts.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/empathy-accounts.c b/src/empathy-accounts.c
index fa6b6b26f..3b25201c5 100644
--- a/src/empathy-accounts.c
+++ b/src/empathy-accounts.c
@@ -57,13 +57,16 @@ static gchar *selected_account_name = NULL;
static gboolean assistant = FALSE;
static void
-maybe_show_accounts_ui (TpAccountManager *manager)
+maybe_show_accounts_ui (TpAccountManager *manager,
+ GApplication *app)
{
- if (hidden ||
- (only_if_needed && empathy_accounts_has_non_salut_accounts (manager)))
- gtk_main_quit ();
- else
- empathy_accounts_show_accounts_ui (manager, NULL, assistant, gtk_main_quit);
+ if (hidden)
+ return;
+
+ if (only_if_needed && empathy_accounts_has_non_salut_accounts (manager))
+ return;
+
+ empathy_accounts_show_accounts_ui (manager, NULL, assistant, app);
}
static TpAccount *
@@ -94,12 +97,13 @@ account_manager_ready_for_accounts_cb (GObject *source_object,
{
TpAccountManager *manager = TP_ACCOUNT_MANAGER (source_object);
GError *error = NULL;
+ GApplication *app = G_APPLICATION (user_data);
if (!tp_proxy_prepare_finish (manager, result, &error))
{
DEBUG ("Failed to prepare account manager: %s", error->message);
g_clear_error (&error);
- return;
+ goto out;
}
if (selected_account_name != NULL)
@@ -119,10 +123,8 @@ account_manager_ready_for_accounts_cb (GObject *source_object,
if (account != NULL)
{
- empathy_accounts_show_accounts_ui (manager, account, assistant,
- G_CALLBACK (gtk_main_quit));
-
- return;
+ empathy_accounts_show_accounts_ui (manager, account, assistant, app);
+ goto out;
}
else
{
@@ -130,15 +132,18 @@ account_manager_ready_for_accounts_cb (GObject *source_object,
g_clear_error (&error);
- maybe_show_accounts_ui (manager);
+ maybe_show_accounts_ui (manager, app);
}
g_free (account_path);
}
else
{
- maybe_show_accounts_ui (manager);
+ maybe_show_accounts_ui (manager, app);
}
+
+out:
+ g_application_release (app);
}
static int
@@ -147,12 +152,13 @@ app_command_line_cb (GApplication *app,
{
TpAccountManager *account_manager;
- g_application_hold (app);
-
account_manager = tp_account_manager_dup ();
+ /* Hold the application while preparing the AM */
+ g_application_hold (app);
+
tp_proxy_prepare_async (account_manager, NULL,
- account_manager_ready_for_accounts_cb, NULL);
+ account_manager_ready_for_accounts_cb, app);
g_object_unref (account_manager);