From a2b853f3f87579d32a835c22bfcdedeab965df8c Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 29 Aug 2013 11:49:48 +0200 Subject: roster-group: inherit from GtkListBoxRow Need to be pack in a GtkListBox. https://bugzilla.gnome.org/show_bug.cgi?id=706988 --- libempathy-gtk/empathy-roster-group.c | 13 +++++++++---- libempathy-gtk/empathy-roster-group.h | 7 +++++-- libempathy-gtk/empathy-roster-view.c | 6 +++--- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/libempathy-gtk/empathy-roster-group.c b/libempathy-gtk/empathy-roster-group.c index 9ca53a8e9..753655ab5 100644 --- a/libempathy-gtk/empathy-roster-group.c +++ b/libempathy-gtk/empathy-roster-group.c @@ -3,7 +3,7 @@ #include -G_DEFINE_TYPE (EmpathyRosterGroup, empathy_roster_group, GTK_TYPE_EXPANDER) +G_DEFINE_TYPE (EmpathyRosterGroup, empathy_roster_group, GTK_TYPE_LIST_BOX_ROW) enum { @@ -116,7 +116,7 @@ empathy_roster_group_constructed (GObject *object) gtk_widget_show_all (box); - gtk_expander_set_label_widget (GTK_EXPANDER (self), box); + gtk_expander_set_label_widget (self->expander, box); } static void @@ -181,6 +181,13 @@ empathy_roster_group_init (EmpathyRosterGroup *self) EMPATHY_TYPE_ROSTER_GROUP, EmpathyRosterGroupPriv); self->priv->widgets = g_hash_table_new (NULL, NULL); + + self->expander = GTK_EXPANDER (gtk_expander_new (NULL)); + gtk_expander_set_use_markup (self->expander, TRUE); + gtk_expander_set_expanded (self->expander, TRUE); + gtk_widget_show (GTK_WIDGET (self->expander)); + + gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (self->expander)); } GtkWidget * @@ -190,8 +197,6 @@ empathy_roster_group_new (const gchar *name, return g_object_new (EMPATHY_TYPE_ROSTER_GROUP, "name", name, "icon", icon, - "use-markup", TRUE, - "expanded", TRUE, NULL); } diff --git a/libempathy-gtk/empathy-roster-group.h b/libempathy-gtk/empathy-roster-group.h index 405455bf5..d5ad70e57 100644 --- a/libempathy-gtk/empathy-roster-group.h +++ b/libempathy-gtk/empathy-roster-group.h @@ -12,14 +12,17 @@ typedef struct _EmpathyRosterGroupPriv EmpathyRosterGroupPriv; struct _EmpathyRosterGroupClass { /**/ - GtkExpanderClass parent_class; + GtkListBoxRowClass parent_class; }; struct _EmpathyRosterGroup { /**/ - GtkExpander parent; + GtkListBoxRow parent; EmpathyRosterGroupPriv *priv; + + /**/ + GtkExpander *expander; }; GType empathy_roster_group_get_type (void); diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c index bf2a4697e..595681f8d 100644 --- a/libempathy-gtk/empathy-roster-view.c +++ b/libempathy-gtk/empathy-roster-view.c @@ -211,7 +211,7 @@ group_expanded_cb (EmpathyRosterGroup *group, g_list_free (widgets); empathy_contact_group_set_expanded (empathy_roster_group_get_name (group), - gtk_expander_get_expanded (GTK_EXPANDER (group))); + gtk_expander_get_expanded (group->expander)); } static EmpathyRosterGroup * @@ -238,7 +238,7 @@ ensure_roster_group (EmpathyRosterView *self, else roster_group = empathy_roster_group_new (group, NULL); - gtk_expander_set_expanded (GTK_EXPANDER (roster_group), + gtk_expander_set_expanded (EMPATHY_ROSTER_GROUP (roster_group)->expander, empathy_contact_group_get_expanded (group)); g_signal_connect (roster_group, "notify::expanded", @@ -900,7 +900,7 @@ filter_contact (EmpathyRosterView *self, { /* When searching, always display even if the group is closed */ if (!is_searching (self) && - !gtk_expander_get_expanded (GTK_EXPANDER (group))) + !gtk_expander_get_expanded (group->expander)) displayed = FALSE; } } -- cgit