Commit 691dd835 authored by Matthias Clasen's avatar Matthias Clasen

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
parent b9941d0d
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment