centerlayout: Invert :shrink-center-last
authorAlice Mikhaylenko <alicem@gnome.org>
Fri, 4 Aug 2023 00:30:55 +0000 (04:30 +0400)
committerAlice Mikhaylenko <alicem@gnome.org>
Fri, 4 Aug 2023 00:34:48 +0000 (04:34 +0400)
Make what it does match its name.

gtk/gtkcenterbox.c
gtk/gtkcenterlayout.c

index 1d9ab7caafcdebcaea48263a4d3957fad7b5252b..5f7bd39a2d5eb6be25686cf27c2d9d40b3406134 100644 (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
index 24c9ea8635c5005ee94d89fe4974c69750326d95..2660a4d47cc7d16583fba4dbb1bd99de139bbb22 100644 (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