aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-08-31 16:30:12 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-08-31 19:32:03 +0800
commit0e2a232f2ed90f04a2245c5241e471c865f756ae (patch)
treea5cb7099a6a70e8c34fe570343620bf76e1e9ce6
parent1ff28ec682cd537f7626e1fac53457139301b64f (diff)
downloadgsoc2013-empathy-0e2a232f2ed90f04a2245c5241e471c865f756ae.tar
gsoc2013-empathy-0e2a232f2ed90f04a2245c5241e471c865f756ae.tar.gz
gsoc2013-empathy-0e2a232f2ed90f04a2245c5241e471c865f756ae.tar.bz2
gsoc2013-empathy-0e2a232f2ed90f04a2245c5241e471c865f756ae.tar.lz
gsoc2013-empathy-0e2a232f2ed90f04a2245c5241e471c865f756ae.tar.xz
gsoc2013-empathy-0e2a232f2ed90f04a2245c5241e471c865f756ae.tar.zst
gsoc2013-empathy-0e2a232f2ed90f04a2245c5241e471c865f756ae.zip
roster-view: check_if_empty(): check groups as well
The roster is empty if there is no group displayed as well. We don't want to display an empty message just because the user collapsed all his groups. https://bugzilla.gnome.org/show_bug.cgi?id=682926
-rw-r--r--libempathy-gtk/empathy-roster-view.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c
index 30e6c98d2..205b11a66 100644
--- a/libempathy-gtk/empathy-roster-view.c
+++ b/libempathy-gtk/empathy-roster-view.c
@@ -257,11 +257,40 @@ update_empty (EmpathyRosterView *self,
g_object_notify (G_OBJECT (self), "empty");
}
+static gboolean filter_group (EmpathyRosterView *self,
+ EmpathyRosterGroup *group);
+
+static gboolean
+at_least_one_group_displayed (EmpathyRosterView *self)
+{
+ GHashTableIter iter;
+ gpointer v;
+
+ g_hash_table_iter_init (&iter, self->priv->roster_groups);
+ while (g_hash_table_iter_next (&iter, NULL, &v))
+ {
+ EmpathyRosterGroup *group = EMPATHY_ROSTER_GROUP (v);
+
+ if (filter_group (self, group))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
check_if_empty (EmpathyRosterView *self)
{
- if (g_hash_table_size (self->priv->displayed_contacts) == 0)
- update_empty (self, TRUE);
+ /* Roster is considered as empty if there is no contact *and* no group
+ * currently displayed. */
+ if (g_hash_table_size (self->priv->displayed_contacts) != 0 ||
+ at_least_one_group_displayed (self))
+ {
+ update_empty (self, FALSE);
+ return;
+ }
+
+ update_empty (self, TRUE);
}
static void
@@ -280,7 +309,11 @@ update_group_widgets (EmpathyRosterView *self,
count = empathy_roster_group_remove_widget (group, GTK_WIDGET (contact));
if (count != old_count)
- egg_list_box_child_changed (EGG_LIST_BOX (self), GTK_WIDGET (group));
+ {
+ egg_list_box_child_changed (EGG_LIST_BOX (self), GTK_WIDGET (group));
+
+ check_if_empty (self);
+ }
}
static void