diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-04-22 22:16:46 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-04-22 22:16:46 -0400 |
commit | ba45d7a991178e29ff747702b32f750850e896eb (patch) | |
tree | ac59992c6745cf819941c663a7b9f2791215c371 /gtk/gtkmenusectionbox.c | |
parent | 8b1e857a67333f826625d512ee5a224200f9a6c3 (diff) | |
download | gtk+-ba45d7a991178e29ff747702b32f750850e896eb.tar.gz |
menusectionbox: Improve circular button spacing
In the n == 2 case, we want to avoid the buttons being
drawn all the way out to the ends of the box, but in the
n >= 3 case, that is exactly what we want for the first
and last button.
Diffstat (limited to 'gtk/gtkmenusectionbox.c')
-rw-r--r-- | gtk/gtkmenusectionbox.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gtk/gtkmenusectionbox.c b/gtk/gtkmenusectionbox.c index 413789a274..e6a55fae55 100644 --- a/gtk/gtkmenusectionbox.c +++ b/gtk/gtkmenusectionbox.c @@ -393,6 +393,26 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item, gtk_box_reorder_child_after (GTK_BOX (box->item_box), widget, sibling); } + if (box->circular) + { + GtkWidget *c1, *c2, *c3; + + /* special-case the n > 2 case */ + c1 = gtk_widget_get_first_child (GTK_WIDGET (box->item_box)); + if ((c2 = gtk_widget_get_next_sibling (c1)) != NULL && + (c3 = gtk_widget_get_next_sibling (c2)) != NULL) + { + gtk_widget_set_halign (c1, GTK_ALIGN_START); + while (c3 != NULL) + { + gtk_widget_set_halign (c2, GTK_ALIGN_CENTER); + c2 = c3; + c3 = gtk_widget_get_next_sibling (c3); + } + gtk_widget_set_halign (c2, GTK_ALIGN_END); + } + } + gtk_menu_section_box_schedule_separator_sync (box); } |