aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-06 22:15:59 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-06 22:25:38 +0800
commitf6a74bbbfd94d2bb6eef27e7e2b5f5cb45927371 (patch)
tree752cd61f48952ced2d2dbc1684da764b1bcbdaa7
parent80ccb990d65628a31694edc94dcc2cb1511f5d9d (diff)
downloadgsoc2013-empathy-f6a74bbbfd94d2bb6eef27e7e2b5f5cb45927371.tar
gsoc2013-empathy-f6a74bbbfd94d2bb6eef27e7e2b5f5cb45927371.tar.gz
gsoc2013-empathy-f6a74bbbfd94d2bb6eef27e7e2b5f5cb45927371.tar.bz2
gsoc2013-empathy-f6a74bbbfd94d2bb6eef27e7e2b5f5cb45927371.tar.lz
gsoc2013-empathy-f6a74bbbfd94d2bb6eef27e7e2b5f5cb45927371.tar.xz
gsoc2013-empathy-f6a74bbbfd94d2bb6eef27e7e2b5f5cb45927371.tar.zst
gsoc2013-empathy-f6a74bbbfd94d2bb6eef27e7e2b5f5cb45927371.zip
roster-window: inline hide/show_contacts_loading in set_notebook_page()
It's cleaner to have all the logic deciding which page to display in set_notebook_page(). https://bugzilla.gnome.org/show_bug.cgi?id=683501
-rw-r--r--src/empathy-roster-window.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c
index b16f23960..cbe4300e5 100644
--- a/src/empathy-roster-window.c
+++ b/src/empathy-roster-window.c
@@ -1591,6 +1591,16 @@ set_notebook_page (EmpathyRosterWindow *self)
guint len;
TpConnectionPresenceType presence;
+ if (!empathy_individual_manager_get_contacts_loaded (
+ self->priv->individual_manager))
+ {
+ display_page_message (self, NULL, PAGE_MESSAGE_FLAG_SPINNER);
+ gtk_spinner_start (GTK_SPINNER (self->priv->spinner_loading));
+ return;
+ }
+
+ gtk_spinner_stop (GTK_SPINNER (self->priv->spinner_loading));
+
accounts = tp_account_manager_get_valid_accounts (
self->priv->account_manager);
@@ -1861,26 +1871,10 @@ empathy_roster_window_class_init (EmpathyRosterWindowClass *klass)
}
static void
-show_contacts_loading (EmpathyRosterWindow *self)
-{
- display_page_message (self, NULL, PAGE_MESSAGE_FLAG_SPINNER);
-
- gtk_spinner_start (GTK_SPINNER (self->priv->spinner_loading));
-}
-
-static void
-hide_contacts_loading (EmpathyRosterWindow *self)
-{
- gtk_spinner_stop (GTK_SPINNER (self->priv->spinner_loading));
-
- set_notebook_page (self);
-}
-
-static void
contacts_loaded_cb (EmpathyIndividualManager *manager,
EmpathyRosterWindow *self)
{
- hide_contacts_loading (self);
+ set_notebook_page (self);
}
static void
@@ -2281,14 +2275,8 @@ empathy_roster_window_init (EmpathyRosterWindow *self)
model = EMPATHY_ROSTER_MODEL (empathy_roster_model_manager_new (self->priv->individual_manager));
- if (!empathy_individual_manager_get_contacts_loaded (
- self->priv->individual_manager))
- {
- show_contacts_loading (self);
-
- tp_g_signal_connect_object (self->priv->individual_manager,
- "contacts-loaded", G_CALLBACK (contacts_loaded_cb), self, 0);
- }
+ tp_g_signal_connect_object (self->priv->individual_manager,
+ "contacts-loaded", G_CALLBACK (contacts_loaded_cb), self, 0);
self->priv->view = EMPATHY_ROSTER_VIEW (
empathy_roster_view_new (model));
@@ -2378,6 +2366,8 @@ empathy_roster_window_init (EmpathyRosterWindow *self)
G_CALLBACK (button_account_settings_clicked_cb), self);
g_signal_connect (self->priv->button_online, "clicked",
G_CALLBACK (button_online_clicked_cb), self);
+
+ set_notebook_page (self);
}
GtkWidget *