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.

https://bugzilla.gnome.org/show_bug.cgi?id=752131
This commit is contained in:
Lars Uebernickel 2015-07-08 16:36:07 +02:00
parent 0f479deb5e
commit 2dda89cbd5
5 changed files with 8 additions and 6 deletions

View File

@ -359,6 +359,7 @@ gtk_button_box_set_layout (GtkButtonBox *widget,
if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
{
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (widget)), "linked");
gtk_box_set_spacing (GTK_BOX (widget), 0);
gtk_box_set_homogeneous (GTK_BOX (widget), TRUE);
}
else

View File

@ -81,7 +81,10 @@ struct _GtkButtonBoxClass
* @GTK_BUTTONBOX_END: Buttons are grouped towards the end of the box,
* (on the right for a HBox, or the bottom for a VBox).
* @GTK_BUTTONBOX_CENTER: Buttons are centered in the box. Since 2.12.
* @GTK_BUTTONBOX_EXPAND: Buttons expand to fill the box. Since 3.12.
* @GTK_BUTTONBOX_EXPAND: Buttons expand to fill the box. This entails giving
* buttons a "linked" appearance, making button sizes homogeneous, and
* setting spacing to 0 (same as calling gtk_box_set_homogeneous() and
* gtk_box_set_spacing() manually). Since 3.12.
*
* Used to dictate the style that a #GtkButtonBox uses to layout the buttons it
* contains.

View File

@ -696,8 +696,9 @@ update_spacings (GtkDialog *dialog)
_gtk_box_set_spacing_set (GTK_BOX (priv->vbox), FALSE);
}
gtk_box_set_spacing (GTK_BOX (priv->action_area),
button_spacing);
/* don't set spacing when buttons are linked */
if (gtk_button_box_get_layout (GTK_BUTTON_BOX (priv->action_area)) != GTK_BUTTONBOX_EXPAND)
gtk_box_set_spacing (GTK_BOX (priv->action_area), button_spacing);
if (!_gtk_container_get_border_width_set (GTK_CONTAINER (priv->action_area)))
{

View File

@ -2761,8 +2761,6 @@ GtkCalendar {
}
.message-dialog { // Message Dialog styling
-GtkDialog-button-spacing: 0;
@if $variant==light {
// the bright variant as a slightly darker bg which in this case clashes with the window decoration, overriding
&.background { background-color: $bg_color; }

View File

@ -1998,7 +1998,6 @@ GtkCalendar {
}
.message-dialog { // Message Dialog styling
-GtkDialog-button-spacing: 0;
.titlebar {
border-style: none;
box-shadow: inset 0 1px $borders_edge;