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.
This commit is contained in:
Timm Bäder 2018-02-05 10:38:37 +01:00
parent 1a9a0c2577
commit de6c0037b7

View File

@ -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"));
}