GNOME Bugzilla – Bug 752131
GtkButtonBox has spacing between buttons by default when set to EXPAND
Last modified: 2015-07-14 13:14:03 UTC
This means that applications setting layout mode to GTK_BUTTONBOX_EXPAND must take care to also set spacing to 0, or they'll get buttons that the theme draws linked, but with spacing between them. See file-roller's summary dialog for an example of how this looks like.
Created attachment 307078 [details] [review] GtkButtonBox: remove spacing when buttons are linked GtkButtonBox adds the "linked" class to its style context when its layout is set to GTK_BUTTONBOX_EXPAND. It shouldn't ever make sense to have spacing between buttons in that case, as themes generally draw linked elements with a continuous border. Thus, always set spacing to 0 and ignore GtkDialog's button-spacing style property when the layout is set to EXPAND. Also remove the now-redundant css rules which set button-spacing to 0 for message dialogs.
Review of attachment 307078 [details] [review]: Dunno. This mangles the semantics of spacing and introduces ordering dependencies: gtk_box_set_spacing (...5) gtk_box_set_style (...EXPAND) gtk_box_set_style (...END) will now leave you with a spacing of 0, instead of 5
I'm be fine with GtkDialog controlling the spacing of its action_area, but maybe that should all be done in gtkdialog.c
(In reply to Matthias Clasen from comment #2) > Review of attachment 307078 [details] [review] [review]: > > Dunno. This mangles the semantics of spacing and introduces ordering > dependencies: > > gtk_box_set_spacing (...5) > gtk_box_set_style (...EXPAND) > gtk_box_set_style (...END) > > will now leave you with a spacing of 0, instead of 5 I know. I figured that's a very uncommon case and we already have those ordering dependencies due to the call to gtk_box_set_homogeneous(): gtk_box_set_homogeneous (..., TRUE) gtk_box_set_layout (...EXPAND) gtk_box_set_layout (...END) will leave homogeneous as FALSE. It also seemed like the logical place to me, because the "linked" style class is also set there. Also, putting it in gtkdialog.c (I guess you mean in update_spacing()?) doesn't work for the case I initially filed the bug for: file-roller calls gtk_button_box_set_layout (gtk_dialog_get_action_area (), GTK_BUTTONBOX_EXPAND) after creating the dialog. At that point, update_spacing() has already run. Do you propose fixing all apps that do it this way?
(In reply to Lars Uebernickel from comment #4) > > Do you propose fixing all apps that do it this way? I think apps that start poking at the packing details of dialog internals (including those that are exported, like the action area), are on their own. You really can't support that in a meaningful way.
Created attachment 307342 [details] [review] GtkButtonBox: remove spacing when buttons are linked > You really can't support that in a meaningful way. I agree with this point, but not having the set_spacing() call in the set_layout() means that every call site of set_layout() would also have to call set_spacing(). As discussed on irc, I've added a note to GTK_BUTTONBOX_EXPAND which explains that these calls are made.
Review of attachment 307342 [details] [review]: ok
Attachment 307342 [details] pushed as 2dda89c - GtkButtonBox: remove spacing when buttons are linked