mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-16 21:50:34 +00:00
Improve popover menu spacing
Make iconic buttons have a more reasonable height, and add some space above an iconic row. https://bugzilla.gnome.org/show_bug.cgi?id=732229
This commit is contained in:
parent
b9941d0dde
commit
691dd83580
@ -91,6 +91,14 @@ gtk_menu_section_box_sync_separators (GtkMenuSectionBox *box,
|
||||
|
||||
gtk_container_foreach (GTK_CONTAINER (box->item_box), gtk_menu_section_box_sync_item, n_items);
|
||||
|
||||
if (box->iconic)
|
||||
{
|
||||
if (n_items_before > 0)
|
||||
gtk_widget_set_margin_top (GTK_WIDGET (box->item_box), 10);
|
||||
else
|
||||
gtk_widget_set_margin_top (GTK_WIDGET (box->item_box), 0);
|
||||
}
|
||||
|
||||
if (box->separator == NULL)
|
||||
return;
|
||||
|
||||
|
@ -171,17 +171,21 @@ static void
|
||||
gtk_model_button_set_iconic (GtkModelButton *button,
|
||||
gboolean iconic)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
|
||||
button->iconic = iconic;
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (button));
|
||||
if (iconic)
|
||||
{
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (button)),
|
||||
GTK_STYLE_CLASS_MENUITEM);
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_MENUITEM);
|
||||
gtk_style_context_add_class (context, "image-button");
|
||||
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NORMAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (button)),
|
||||
GTK_STYLE_CLASS_MENUITEM);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MENUITEM);
|
||||
gtk_style_context_remove_class (context, "image-button");
|
||||
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
|
||||
}
|
||||
|
||||
@ -727,6 +731,7 @@ gtk_model_button_init (GtkModelButton *button)
|
||||
gtk_widget_set_halign (button->box, GTK_ALIGN_FILL);
|
||||
gtk_widget_show (button->box);
|
||||
button->image = gtk_image_new ();
|
||||
g_object_set (button->image, "margin", 4, NULL);
|
||||
button->label = gtk_label_new ("");
|
||||
gtk_container_add (GTK_CONTAINER (button->box), button->image);
|
||||
gtk_container_add (GTK_CONTAINER (button->box), button->label);
|
||||
|
Loading…
Reference in New Issue
Block a user