[libhandy] clamp: Rename maximum-width into maximum-size



commit 3fc0b5c0bc6752a58da71ae9f11b4a0429b5ebdc
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Jun 8 21:31:29 2020 +0200

    clamp: Rename maximum-width into maximum-size
    
    This property represents the height when the HdyClamp is vertical.

 debian/libhandy-1-0.symbols   |  4 ++--
 examples/hdy-demo-window.ui   | 24 +++++++++----------
 glade/libhandy.xml            |  2 +-
 src/hdy-clamp.c               | 55 +++++++++++++++++++++++--------------------
 src/hdy-clamp.h               |  6 ++---
 src/hdy-preferences-page.ui   |  2 +-
 src/hdy-preferences-window.ui |  4 ++--
 7 files changed, 50 insertions(+), 47 deletions(-)
---
diff --git a/debian/libhandy-1-0.symbols b/debian/libhandy-1-0.symbols
index 3cb4544f..92e50b14 100644
--- a/debian/libhandy-1-0.symbols
+++ b/debian/libhandy-1-0.symbols
@@ -75,11 +75,11 @@ libhandy-1.so.0 libhandy-1-0 #MINVER#
  hdy_carousel_set_spacing@LIBHANDY_1_0 0.80.0
  hdy_centering_policy_get_type@LIBHANDY_1_0 0.0.10
  hdy_clamp_get_linear_growth_width@LIBHANDY_1_0 0.82.0
- hdy_clamp_get_maximum_width@LIBHANDY_1_0 0.82.0
+ hdy_clamp_get_maximum_size@LIBHANDY_1_0 0.82.0
  hdy_clamp_get_type@LIBHANDY_1_0 0.82.0
  hdy_clamp_new@LIBHANDY_1_0 0.82.0
  hdy_clamp_set_linear_growth_width@LIBHANDY_1_0 0.82.0
- hdy_clamp_set_maximum_width@LIBHANDY_1_0 0.82.0
+ hdy_clamp_set_maximum_size@LIBHANDY_1_0 0.82.0
  hdy_combo_row_bind_model@LIBHANDY_1_0 0.0.6
  hdy_combo_row_bind_name_model@LIBHANDY_1_0 0.0.6
  hdy_combo_row_get_model@LIBHANDY_1_0 0.0.6
diff --git a/examples/hdy-demo-window.ui b/examples/hdy-demo-window.ui
index 0b5c839a..d9bccdcf 100644
--- a/examples/hdy-demo-window.ui
+++ b/examples/hdy-demo-window.ui
@@ -457,7 +457,7 @@
                         <property name="margin-end">12</property>
                         <property name="margin-top">32</property>
                         <property name="expand">True</property>
-                        <property name="maximum-width">400</property>
+                        <property name="maximum-size">400</property>
                         <property name="linear-growth-width">300</property>
                         <child>
                           <object class="GtkBox">
@@ -599,7 +599,7 @@
                             <property name="margin-end">12</property>
                             <property name="margin-top">32</property>
                             <property name="expand">True</property>
-                            <property name="maximum-width">400</property>
+                            <property name="maximum-size">400</property>
                             <property name="linear-growth-width">300</property>
                             <child>
                               <object class="GtkBox">
@@ -797,7 +797,7 @@
                         <property name="margin-end">12</property>
                         <property name="margin-top">32</property>
                         <property name="expand">True</property>
-                        <property name="maximum-width">400</property>
+                        <property name="maximum-size">400</property>
                         <property name="linear-growth-width">300</property>
                         <child>
                           <object class="GtkBox">
@@ -883,7 +883,7 @@
                               <object class="HdyClamp">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="maximum-width">300</property>
+                                <property name="maximum-size">300</property>
                                 <property name="linear-growth-width">300</property>
                                 <child>
                                   <object class="GtkBox" id="box_keypad">
@@ -983,7 +983,7 @@
                         <property name="margin-end">12</property>
                         <property name="margin-top">32</property>
                         <property name="expand">True</property>
-                        <property name="maximum-width" bind-source="clamp_width_adjustment" 
bind-property="value" bind-flags="sync-create"/>
+                        <property name="maximum-size" bind-source="clamp_maximum_size_adjustment" 
bind-property="value" bind-flags="sync-create"/>
                         <property name="linear-growth-width" bind-source="clamp_linear_width_adjustment" 
bind-property="value" bind-flags="sync-create"/>
                         <child>
                           <object class="GtkBox">
@@ -1095,7 +1095,7 @@
                                     <property name="visible">True</property>
                                     <child>
                                       <object class="GtkSpinButton">
-                                        <property name="adjustment">clamp_width_adjustment</property>
+                                        <property name="adjustment">clamp_maximum_size_adjustment</property>
                                         <property name="valign">center</property>
                                         <property name="visible">True</property>
                                       </object>
@@ -1137,7 +1137,7 @@
                         <property name="margin-end">12</property>
                         <property name="margin-top">32</property>
                         <property name="expand">True</property>
-                        <property name="maximum-width">400</property>
+                        <property name="maximum-size">400</property>
                         <property name="linear-growth-width">300</property>
                         <child>
                           <object class="GtkBox">
@@ -1442,7 +1442,7 @@
                               <object class="HdyClamp">
                                 <property name="visible">True</property>
                                 <property name="hexpand">True</property>
-                                <property name="maximum-width">600</property>
+                                <property name="maximum-size">600</property>
                                 <child>
                                   <object class="GtkSearchEntry" id="search_entry">
                                     <property name="visible">True</property>
@@ -1736,7 +1736,7 @@
                             <property name="margin-start">12</property>
                             <property name="margin-end">12</property>
                             <property name="expand">True</property>
-                            <property name="maximum-width">400</property>
+                            <property name="maximum-size">400</property>
                             <property name="linear-growth-width">300</property>
                             <child>
                               <object class="GtkListBox" id="carousel_listbox">
@@ -1893,7 +1893,7 @@
                           <object class="HdyClamp">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="maximum-width">400</property>
+                            <property name="maximum-size">400</property>
                             <property name="linear-growth-width">300</property>
                             <child>
                               <object class="GtkBox">
@@ -2015,7 +2015,7 @@
                         <property name="margin-end">12</property>
                         <property name="margin-top">32</property>
                         <property name="expand">True</property>
-                        <property name="maximum-width">400</property>
+                        <property name="maximum-size">400</property>
                         <property name="linear-growth-width">300</property>
                         <child>
                           <object class="GtkBox">
@@ -2222,7 +2222,7 @@
       <swipeable name="content_deck"/>
     </swipeables>
   </object>
-  <object class="GtkAdjustment" id="clamp_width_adjustment">
+  <object class="GtkAdjustment" id="clamp_maximum_size_adjustment">
     <property name="lower">0</property>
     <property name="upper">10000</property>
     <property name="value">600</property>
diff --git a/glade/libhandy.xml b/glade/libhandy.xml
index 06df1eb5..8ec53530 100644
--- a/glade/libhandy.xml
+++ b/glade/libhandy.xml
@@ -77,7 +77,7 @@
     </glade-widget-class>
     <glade-widget-class name="HdyClamp" generic-name="clamp" title="Clamp" since="1.0">
       <properties>
-        <property id="maximum-width" default="650"/>
+        <property id="maximum-size" default="650"/>
         <property id="linear-growth-width" default="400"/>
       </properties>
     </glade-widget-class>
diff --git a/src/hdy-clamp.c b/src/hdy-clamp.c
index b7fd731c..64ba2926 100644
--- a/src/hdy-clamp.c
+++ b/src/hdy-clamp.c
@@ -39,7 +39,7 @@
 
 enum {
   PROP_0,
-  PROP_MAXIMUM_WIDTH,
+  PROP_MAXIMUM_SIZE,
   PROP_LINEAR_GROWTH_WIDTH,
 
   /* Overridden properties */
@@ -52,7 +52,7 @@ struct _HdyClamp
 {
   GtkBin parent_instance;
 
-  gint maximum_width;
+  gint maximum_size;
   gint linear_growth_width;
 
   GtkOrientation orientation;
@@ -84,8 +84,8 @@ hdy_clamp_get_property (GObject    *object,
   HdyClamp *self = HDY_CLAMP (object);
 
   switch (prop_id) {
-  case PROP_MAXIMUM_WIDTH:
-    g_value_set_int (value, hdy_clamp_get_maximum_width (self));
+  case PROP_MAXIMUM_SIZE:
+    g_value_set_int (value, hdy_clamp_get_maximum_size (self));
     break;
   case PROP_LINEAR_GROWTH_WIDTH:
     g_value_set_int (value, hdy_clamp_get_linear_growth_width (self));
@@ -107,8 +107,8 @@ hdy_clamp_set_property (GObject      *object,
   HdyClamp *self = HDY_CLAMP (object);
 
   switch (prop_id) {
-  case PROP_MAXIMUM_WIDTH:
-    hdy_clamp_set_maximum_width (self, g_value_get_int (value));
+  case PROP_MAXIMUM_SIZE:
+    hdy_clamp_set_maximum_size (self, g_value_get_int (value));
     break;
   case PROP_LINEAR_GROWTH_WIDTH:
     hdy_clamp_set_linear_growth_width (self, g_value_get_int (value));
@@ -160,8 +160,8 @@ get_child_size (HdyClamp *self,
       gtk_widget_get_preferred_height (child, &min, NULL);
   }
 
-  lower = MAX (MIN (self->linear_growth_width, self->maximum_width), min);
-  max = MAX (lower, self->maximum_width);
+  lower = MAX (MIN (self->linear_growth_width, self->maximum_size), min);
+  max = MAX (lower, self->maximum_size);
   amplitude = max - lower;
   upper = HDY_EASE_OUT_TAN_CUBIC * amplitude + lower;
 
@@ -405,16 +405,17 @@ hdy_clamp_class_init (HdyClampClass *klass)
                                     "orientation");
 
   /**
-   * HdyClamp:maximum_width:
+   * HdyClamp:maximum-size:
    *
-   * The maximum width to allocate to the child.
+   * The maximum size to allocate to the child. It is the width if the clamp is
+   * horizontal, or the height if it is vertical.
    *
    * Since: 1.0
    */
-  props[PROP_MAXIMUM_WIDTH] =
-      g_param_spec_int ("maximum-width",
-                        _("Maximum width"),
-                        _("The maximum width allocated to the child"),
+  props[PROP_MAXIMUM_SIZE] =
+      g_param_spec_int ("maximum-size",
+                        _("Maximum size"),
+                        _("The maximum size allocated to the child"),
                         0, G_MAXINT, 0,
                         G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
 
@@ -458,46 +459,48 @@ hdy_clamp_new (void)
 }
 
 /**
- * hdy_clamp_get_maximum_width:
+ * hdy_clamp_get_maximum_size:
  * @self: a #HdyClamp
  *
- * Gets the maximum width to allocate to the contained child.
+ * Gets the maximum size to allocate to the contained child. It is the width if
+ * @self is horizontal, or the height if it is vertical.
  *
  * Returns: the maximum width to allocate to the contained child.
  *
  * Since: 1.0
  */
 gint
-hdy_clamp_get_maximum_width (HdyClamp *self)
+hdy_clamp_get_maximum_size (HdyClamp *self)
 {
   g_return_val_if_fail (HDY_IS_CLAMP (self), 0);
 
-  return self->maximum_width;
+  return self->maximum_size;
 }
 
 /**
- * hdy_clamp_set_maximum_width:
+ * hdy_clamp_set_maximum_size:
  * @self: a #HdyClamp
- * @maximum_width: the maximum width
+ * @maximum_size: the maximum size
  *
- * Sets the maximum width to allocate to the contained child.
+ * Sets the maximum size to allocate to the contained child. It is the width if
+ * @self is horizontal, or the height if it is vertical.
  *
  * Since: 1.0
  */
 void
-hdy_clamp_set_maximum_width (HdyClamp *self,
-                             gint      maximum_width)
+hdy_clamp_set_maximum_size (HdyClamp *self,
+                            gint      maximum_size)
 {
   g_return_if_fail (HDY_IS_CLAMP (self));
 
-  if (self->maximum_width == maximum_width)
+  if (self->maximum_size == maximum_size)
     return;
 
-  self->maximum_width = maximum_width;
+  self->maximum_size = maximum_size;
 
   gtk_widget_queue_resize (GTK_WIDGET (self));
 
-  g_object_notify_by_pspec (G_OBJECT (self), props[PROP_MAXIMUM_WIDTH]);
+  g_object_notify_by_pspec (G_OBJECT (self), props[PROP_MAXIMUM_SIZE]);
 }
 
 /**
diff --git a/src/hdy-clamp.h b/src/hdy-clamp.h
index 0d3103e9..f9a30a0c 100644
--- a/src/hdy-clamp.h
+++ b/src/hdy-clamp.h
@@ -19,9 +19,9 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (HdyClamp, hdy_clamp, HDY, CLAMP, GtkBin)
 
 GtkWidget *hdy_clamp_new (void);
-gint hdy_clamp_get_maximum_width (HdyClamp *self);
-void hdy_clamp_set_maximum_width (HdyClamp *self,
-                                  gint      maximum_width);
+gint hdy_clamp_get_maximum_size (HdyClamp *self);
+void hdy_clamp_set_maximum_size (HdyClamp *self,
+                                 gint      maximum_size);
 gint hdy_clamp_get_linear_growth_width (HdyClamp *self);
 void hdy_clamp_set_linear_growth_width (HdyClamp *self,
                                         gint      linear_growth_width);
diff --git a/src/hdy-preferences-page.ui b/src/hdy-preferences-page.ui
index 4e99f6bd..d18ac061 100644
--- a/src/hdy-preferences-page.ui
+++ b/src/hdy-preferences-page.ui
@@ -17,7 +17,7 @@
                 <property name="margin-end">12</property>
                 <property name="margin-start">12</property>
                 <property name="margin-top">18</property>
-                <property name="maximum-width">600</property>
+                <property name="maximum-size">600</property>
                 <property name="visible">True</property>
                 <child>
                   <object class="GtkBox" id="box">
diff --git a/src/hdy-preferences-window.ui b/src/hdy-preferences-window.ui
index 519c8b70..911b1e16 100644
--- a/src/hdy-preferences-window.ui
+++ b/src/hdy-preferences-window.ui
@@ -40,7 +40,7 @@
                 <child>
                   <object class="HdyClamp">
                     <property name="linear-growth-width">300</property>
-                    <property name="maximum-width">400</property>
+                    <property name="maximum-size">400</property>
                     <property name="visible">True</property>
                     <child>
                       <object class="GtkSearchEntry" id="search_entry">
@@ -134,7 +134,7 @@
                         <property name="margin_end">12</property>
                         <property name="margin_start">12</property>
                         <property name="margin_top">18</property>
-                        <property name="maximum_width">600</property>
+                        <property name="maximum_size">600</property>
                         <property name="visible">True</property>
                         <child>
                           <object class="GtkListBox" id="search_results">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]