centerlayout: Invert :shrink-center-last

Make what it does match its name.
This commit is contained in:
Alice Mikhaylenko 2023-08-04 04:30:55 +04:00
parent 24714cb91c
commit d4a5872fb0
2 changed files with 9 additions and 8 deletions

View File

@ -309,14 +309,14 @@ gtk_center_box_class_init (GtkCenterBoxClass *klass)
* natural widths, the start and end widgets start shrinking and the
* center child keeps natural width until they reach minimum width.
*
* If set to `TRUE`, start and end widgets keep natural width and the
* If set to `FALSE`, start and end widgets keep natural width and the
* center widget starts shrinking instead.
*
* Since: 4.12
*/
props[PROP_SHRINK_CENTER_LAST] =
g_param_spec_boolean ("shrink-center-last", NULL, NULL,
FALSE,
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, LAST_PROP, props);
@ -554,7 +554,7 @@ gtk_center_box_get_baseline_position (GtkCenterBox *self)
* natural widths, the start and end widgets start shrinking and the
* center child keeps natural width until they reach minimum width.
*
* If set to `TRUE`, start and end widgets keep natural width and the
* If set to `FALSE`, start and end widgets keep natural width and the
* center widget starts shrinking instead.
*
* Since: 4.12

View File

@ -150,9 +150,9 @@ gtk_center_layout_distribute (GtkCenterLayout *self,
avail = size - needed_spacing - (sizes[0].minimum_size + sizes[2].minimum_size);
if (self->shrink_center_last)
natural_size = CLAMP (size - needed_spacing - (sizes[0].natural_size + sizes[2].natural_size), sizes[1].minimum_size, sizes[1].natural_size);
else
natural_size = sizes[1].natural_size;
else
natural_size = CLAMP (size - needed_spacing - (sizes[0].natural_size + sizes[2].natural_size), sizes[1].minimum_size, sizes[1].natural_size);
center_size = CLAMP (avail, sizes[1].minimum_size, natural_size);
center_expand = gtk_widget_compute_expand (self->center_widget, self->orientation);
@ -607,14 +607,14 @@ gtk_center_layout_class_init (GtkCenterLayoutClass *klass)
* natural widths, the start and end widgets start shrinking and the
* center child keeps natural width until they reach minimum width.
*
* If set to `TRUE`, start and end widgets keep natural width and the
* If set to `FALSE`, start and end widgets keep natural width and the
* center widget starts shrinking instead.
*
* Since: 4.12
*/
props[PROP_SHRINK_CENTER_LAST] =
g_param_spec_boolean ("shrink-center-last", NULL, NULL,
FALSE,
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, LAST_PROP, props);
@ -625,6 +625,7 @@ gtk_center_layout_init (GtkCenterLayout *self)
{
self->orientation = GTK_ORIENTATION_HORIZONTAL;
self->baseline_pos = GTK_BASELINE_POSITION_CENTER;
self->shrink_center_last = TRUE;
}
/**
@ -831,7 +832,7 @@ gtk_center_layout_get_end_widget (GtkCenterLayout *self)
* natural widths, the start and end widgets start shrinking and the
* center child keeps natural width until they reach minimum width.
*
* If set to `TRUE`, start and end widgets keep natural width and the
* If set to `FALSE`, start and end widgets keep natural width and the
* center widget starts shrinking instead.
*
* Since: 4.12