[gtk+] separatormenuitem: Don't create label widget in get_label



commit de6c0037b79ecaa245811193bb7dd03fd71c9b66
Author: Timm Bäder <mail baedert org>
Date:   Mon Feb 5 10:38:37 2018 +0100

    separatormenuitem: Don't create label widget in get_label
    
    Calling gtk_menu_item_get_label on a GtkSeparatorMenuItem would
    otherwise create a GtkLabel child, increasing the vertical size request
    to that of the child label.

 gtk/gtkseparatormenuitem.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkseparatormenuitem.c b/gtk/gtkseparatormenuitem.c
index 96a1faa..f000283 100644
--- a/gtk/gtkseparatormenuitem.c
+++ b/gtk/gtkseparatormenuitem.c
@@ -45,11 +45,20 @@
 
 G_DEFINE_TYPE (GtkSeparatorMenuItem, gtk_separator_menu_item, GTK_TYPE_MENU_ITEM)
 
+
+static const char *
+gtk_separator_menu_item_get_label (GtkMenuItem *item)
+{
+  return "";
+}
+
 static void
 gtk_separator_menu_item_class_init (GtkSeparatorMenuItemClass *class)
 {
   GTK_CONTAINER_CLASS (class)->child_type = NULL;
 
+  GTK_MENU_ITEM_CLASS (class)->get_label = gtk_separator_menu_item_get_label;
+
   gtk_widget_class_set_accessible_role (GTK_WIDGET_CLASS (class), ATK_ROLE_SEPARATOR);
   gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (class), I_("separator"));
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]