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:
Matthias Clasen 2014-06-28 00:00:16 -04:00
parent b9941d0dde
commit 691dd83580
2 changed files with 17 additions and 4 deletions

View File

@ -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;

View File

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