[libdazzle/libdazzle-3-30] menus: hide separator for empty sections
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle/libdazzle-3-30] menus: hide separator for empty sections
- Date: Thu, 20 Sep 2018 21:25:25 +0000 (UTC)
commit 0ed6ffa7cbb6b376caa72dbd233766b673b5ac63
Author: Christian Hergert <chergert redhat com>
Date: Thu Sep 20 14:22:14 2018 -0700
menus: hide separator for empty sections
src/menus/dzl-menu-button-section.c | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/src/menus/dzl-menu-button-section.c b/src/menus/dzl-menu-button-section.c
index d1e74ba..03ab722 100644
--- a/src/menus/dzl-menu-button-section.c
+++ b/src/menus/dzl-menu-button-section.c
@@ -37,6 +37,7 @@ struct _DzlMenuButtonSection
/* Template references */
GtkLabel *label;
DzlBox *items_box;
+ GtkSeparator *separator;
guint show_accels : 1;
guint show_icons : 1;
@@ -152,6 +153,11 @@ dzl_menu_button_section_items_changed (DzlMenuButtonSection *self,
"position", i,
NULL);
}
+
+ if (added || g_menu_model_get_n_items (menu))
+ gtk_widget_show (GTK_WIDGET (self->separator));
+ else
+ gtk_widget_hide (GTK_WIDGET (self->separator));
}
static void
@@ -287,6 +293,7 @@ dzl_menu_button_section_class_init (DzlMenuButtonSectionClass *klass)
"/org/gnome/dazzle/ui/dzl-menu-button-section.ui");
gtk_widget_class_bind_template_child (widget_class, DzlMenuButtonSection, label);
gtk_widget_class_bind_template_child (widget_class, DzlMenuButtonSection, items_box);
+ gtk_widget_class_bind_template_child (widget_class, DzlMenuButtonSection, separator);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]