After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 752131 - GtkButtonBox has spacing between buttons by default when set to EXPAND
GtkButtonBox has spacing between buttons by default when set to EXPAND
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-07-08 15:07 UTC by Lars Karlitski
Modified: 2015-07-14 13:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkButtonBox: remove spacing when buttons are linked (2.96 KB, patch)
2015-07-08 15:07 UTC, Lars Karlitski
none Details | Review
GtkButtonBox: remove spacing when buttons are linked (3.79 KB, patch)
2015-07-13 12:37 UTC, Lars Karlitski
committed Details | Review

Description Lars Karlitski 2015-07-08 15:07:46 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.
Comment 1 Lars Karlitski 2015-07-08 15:07:50 UTC
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.
Comment 2 Matthias Clasen 2015-07-11 19:31:04 UTC
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
Comment 3 Matthias Clasen 2015-07-11 19:32:50 UTC
I'm be fine with GtkDialog controlling the spacing of its action_area, but maybe that should all be done in gtkdialog.c
Comment 4 Lars Karlitski 2015-07-13 09:37:24 UTC
(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?
Comment 5 Matthias Clasen 2015-07-13 11:50:37 UTC
(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.
Comment 6 Lars Karlitski 2015-07-13 12:37:29 UTC
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.
Comment 7 Matthias Clasen 2015-07-14 04:13:54 UTC
Review of attachment 307342 [details] [review]:

ok
Comment 8 Lars Karlitski 2015-07-14 13:13:56 UTC
Attachment 307342 [details] pushed as 2dda89c - GtkButtonBox: remove spacing when buttons are linked