[libadwaita/wip/cdavis/spin-row: 2/2] demo: Use AdwSpinRow for demo pages




commit 90f68b1910ff79f22536c34df52211440d718336
Author: Christopher Davis <christopherdavis gnome org>
Date:   Fri Jul 22 20:48:45 2022 -0400

    demo: Use AdwSpinRow for demo pages

 demo/pages/animations/adw-demo-page-animations.c  |  20 +--
 demo/pages/animations/adw-demo-page-animations.ui | 182 +++++++++-------------
 demo/pages/avatar/adw-demo-page-avatar.ui         |  25 ++-
 demo/pages/clamp/adw-demo-page-clamp.ui           |  46 +++---
 4 files changed, 111 insertions(+), 162 deletions(-)
---
diff --git a/demo/pages/animations/adw-demo-page-animations.c 
b/demo/pages/animations/adw-demo-page-animations.c
index 4dcce4d8..02408fa3 100644
--- a/demo/pages/animations/adw-demo-page-animations.c
+++ b/demo/pages/animations/adw-demo-page-animations.c
@@ -10,17 +10,17 @@ struct _AdwDemoPageAnimations
   AdwAnimation *timed_animation;
   GtkWidget *timed_animation_sample;
   GtkWidget *timed_animation_button_box;
-  GtkSpinButton *timed_animation_repeat_count;
+  AdwSpinRow *timed_animation_repeat_count;
   GtkSwitch *timed_animation_reverse;
   GtkSwitch *timed_animation_alternate;
-  GtkSpinButton *timed_animation_duration;
+  AdwSpinRow *timed_animation_duration;
   AdwComboRow *timed_animation_easing;
   AdwAnimation *spring_animation;
-  GtkSpinButton *spring_animation_velocity;
-  GtkSpinButton *spring_animation_damping;
-  GtkSpinButton *spring_animation_mass;
-  GtkSpinButton *spring_animation_stiffness;
-  GtkSpinButton *spring_animation_epsilon;
+  AdwSpinRow *spring_animation_velocity;
+  AdwSpinRow *spring_animation_damping;
+  AdwSpinRow *spring_animation_mass;
+  AdwSpinRow *spring_animation_stiffness;
+  AdwSpinRow *spring_animation_epsilon;
   GtkSwitch *spring_animation_clamp_switch;
 };
 
@@ -243,9 +243,9 @@ static void
 notify_spring_params_change (AdwDemoPageAnimations *self)
 {
   AdwSpringParams *spring_params =
-    adw_spring_params_new_full (gtk_spin_button_get_value (self->spring_animation_damping),
-                                gtk_spin_button_get_value (self->spring_animation_mass),
-                                gtk_spin_button_get_value (self->spring_animation_stiffness));
+    adw_spring_params_new_full (adw_spin_row_get_value (self->spring_animation_damping),
+                                adw_spin_row_get_value (self->spring_animation_mass),
+                                adw_spin_row_get_value (self->spring_animation_stiffness));
 
   adw_spring_animation_set_spring_params (ADW_SPRING_ANIMATION (self->spring_animation), spring_params);
 
diff --git a/demo/pages/animations/adw-demo-page-animations.ui 
b/demo/pages/animations/adw-demo-page-animations.ui
index 4ed71e7c..5d10b102 100644
--- a/demo/pages/animations/adw-demo-page-animations.ui
+++ b/demo/pages/animations/adw-demo-page-animations.ui
@@ -173,43 +173,33 @@
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="AdwActionRow">
+                                  <object class="AdwSpinRow" id="timed_animation_duration">
                                     <property name="title" translatable="yes">Duration</property>
-                                    <child>
-                                      <object class="GtkSpinButton" id="timed_animation_duration">
-                                        <property name="valign">center</property>
-                                        <property name="numeric">True</property>
-                                        <property name="adjustment">
-                                          <object class="GtkAdjustment">
-                                            <property name="lower">100</property>
-                                            <property name="upper">4000</property>
-                                            <property name="value">500</property>
-                                            <property name="page-increment">100</property>
-                                            <property name="step-increment">50</property>
-                                          </object>
-                                        </property>
+                                    <property name="numeric">True</property>
+                                    <property name="adjustment">
+                                      <object class="GtkAdjustment">
+                                        <property name="lower">100</property>
+                                        <property name="upper">4000</property>
+                                        <property name="value">500</property>
+                                        <property name="page-increment">100</property>
+                                        <property name="step-increment">50</property>
                                       </object>
-                                    </child>
+                                    </property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="AdwActionRow">
+                                  <object class="AdwSpinRow" id="timed_animation_repeat_count">
                                     <property name="title" translatable="yes">Repeat Count</property>
-                                    <child>
-                                      <object class="GtkSpinButton" id="timed_animation_repeat_count">
-                                        <property name="valign">center</property>
-                                        <property name="numeric">True</property>
-                                        <property name="adjustment">
-                                          <object class="GtkAdjustment">
-                                            <property name="lower">0</property>
-                                            <property name="upper">10</property>
-                                            <property name="value">1</property>
-                                            <property name="page-increment">1</property>
-                                            <property name="step-increment">1</property>
-                                          </object>
-                                        </property>
+                                    <property name="numeric">True</property>
+                                    <property name="adjustment">
+                                      <object class="GtkAdjustment">
+                                        <property name="lower">0</property>
+                                        <property name="upper">10</property>
+                                        <property name="value">1</property>
+                                        <property name="page-increment">1</property>
+                                        <property name="step-increment">1</property>
                                       </object>
-                                    </child>
+                                    </property>
                                   </object>
                                 </child>
                                 <child>
@@ -247,107 +237,81 @@
                             <property name="child">
                               <object class="AdwPreferencesGroup">
                                 <child>
-                                  <object class="AdwActionRow">
+                                  <object class="AdwSpinRow" id="spring_animation_velocity">
                                     <property name="title" translatable="yes">Initial Velocity</property>
-                                    <child>
-                                      <object class="GtkSpinButton" id="spring_animation_velocity">
-                                        <property name="valign">center</property>
-                                        <property name="numeric">True</property>
-                                        <property name="adjustment">
-                                          <object class="GtkAdjustment">
-                                            <property name="lower">-1000</property>
-                                            <property name="upper">1000</property>
-                                            <property name="value">0</property>
-                                            <property name="page-increment">10</property>
-                                            <property name="step-increment">1</property>
-                                          </object>
-                                        </property>
+                                    <property name="numeric">True</property>
+                                    <property name="adjustment">
+                                      <object class="GtkAdjustment">
+                                        <property name="lower">-1000</property>
+                                        <property name="upper">1000</property>
+                                        <property name="value">0</property>
+                                        <property name="page-increment">10</property>
+                                        <property name="step-increment">1</property>
                                       </object>
-                                    </child>
+                                    </property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="AdwActionRow">
+                                  <object class="AdwSpinRow" id="spring_animation_damping">
                                     <property name="title" translatable="yes">Damping</property>
-                                    <child>
-                                      <object class="GtkSpinButton" id="spring_animation_damping">
-                                        <property name="valign">center</property>
-                                        <property name="numeric">True</property>
-                                        <property name="adjustment">
-                                          <object class="GtkAdjustment">
-                                            <property name="lower">0</property>
-                                            <property name="upper">1000</property>
-                                            <property name="value">10</property>
-                                            <property name="page-increment">10</property>
-                                            <property name="step-increment">1</property>
-                                          </object>
-                                        </property>
-                                        <signal name="value-changed" handler="notify_spring_params_change" 
swapped="yes"/>
+                                    <property name="numeric">True</property>
+                                    <property name="adjustment">
+                                      <object class="GtkAdjustment">
+                                        <property name="lower">0</property>
+                                        <property name="upper">1000</property>
+                                        <property name="value">10</property>
+                                        <property name="page-increment">10</property>
+                                        <property name="step-increment">1</property>
                                       </object>
-                                    </child>
+                                    </property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="AdwActionRow">
+                                  <object class="AdwSpinRow" id="spring_animation_mass">
                                     <property name="title" translatable="yes">Mass</property>
-                                    <child>
-                                      <object class="GtkSpinButton" id="spring_animation_mass">
-                                        <property name="valign">center</property>
-                                        <property name="numeric">True</property>
-                                        <property name="adjustment">
-                                          <object class="GtkAdjustment">
-                                            <property name="lower">0</property>
-                                            <property name="upper">100</property>
-                                            <property name="value">1</property>
-                                            <property name="page-increment">10</property>
-                                            <property name="step-increment">1</property>
-                                          </object>
-                                        </property>
-                                        <signal name="value-changed" handler="notify_spring_params_change" 
swapped="yes"/>
+                                    <property name="numeric">True</property>
+                                    <property name="adjustment">
+                                      <object class="GtkAdjustment">
+                                        <property name="lower">0</property>
+                                        <property name="upper">100</property>
+                                        <property name="value">1</property>
+                                        <property name="page-increment">10</property>
+                                        <property name="step-increment">1</property>
                                       </object>
-                                    </child>
+                                    </property>
+                                    <signal name="value-changed" handler="notify_spring_params_change" 
swapped="yes"/>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="AdwActionRow">
+                                  <object class="AdwSpinRow" id="spring_animation_stiffness">
                                     <property name="title" translatable="yes">Stiffness</property>
-                                    <child>
-                                      <object class="GtkSpinButton" id="spring_animation_stiffness">
-                                        <property name="valign">center</property>
-                                        <property name="numeric">True</property>
-                                        <property name="adjustment">
-                                          <object class="GtkAdjustment">
-                                            <property name="lower">0</property>
-                                            <property name="upper">1000</property>
-                                            <property name="value">100</property>
-                                            <property name="page-increment">10</property>
-                                            <property name="step-increment">1</property>
-                                          </object>
-                                        </property>
-                                        <signal name="value-changed" handler="notify_spring_params_change" 
swapped="yes"/>
+                                    <property name="numeric">True</property>
+                                    <property name="adjustment">
+                                      <object class="GtkAdjustment">
+                                        <property name="lower">0</property>
+                                        <property name="upper">1000</property>
+                                        <property name="value">100</property>
+                                        <property name="page-increment">10</property>
+                                        <property name="step-increment">1</property>
                                       </object>
-                                    </child>
+                                    </property>
+                                    <signal name="value-changed" handler="notify_spring_params_change" 
swapped="yes"/>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="AdwActionRow">
+                                  <object class="AdwSpinRow" id="spring_animation_epsilon">
                                     <property name="title" translatable="yes">Epsilon</property>
-                                    <child>
-                                      <object class="GtkSpinButton" id="spring_animation_epsilon">
-                                        <property name="valign">center</property>
-                                        <property name="numeric">True</property>
-                                        <property name="digits">5</property>
-                                        <property name="adjustment">
-                                          <object class="GtkAdjustment">
-                                            <property name="lower">0.0001</property>
-                                            <property name="upper">0.01</property>
-                                            <property name="value">0.001</property>
-                                            <property name="page-increment">0.001</property>
-                                            <property name="step-increment">0.001</property>
-                                          </object>
-                                        </property>
+                                    <property name="numeric">True</property>
+                                    <property name="digits">5</property>
+                                    <property name="adjustment">
+                                      <object class="GtkAdjustment">
+                                        <property name="lower">0.0001</property>
+                                        <property name="upper">0.01</property>
+                                        <property name="value">0.001</property>
+                                        <property name="page-increment">0.001</property>
+                                        <property name="step-increment">0.001</property>
                                       </object>
-                                    </child>
+                                    </property>
                                   </object>
                                 </child>
                                 <child>
diff --git a/demo/pages/avatar/adw-demo-page-avatar.ui b/demo/pages/avatar/adw-demo-page-avatar.ui
index 0bd9ff94..a8d696b7 100644
--- a/demo/pages/avatar/adw-demo-page-avatar.ui
+++ b/demo/pages/avatar/adw-demo-page-avatar.ui
@@ -119,23 +119,18 @@
                               </object>
                             </child>
                             <child>
-                              <object class="AdwActionRow">
+                              <object class="AdwSpinRow" id="size">
                                 <property name="title" translatable="yes">Size</property>
-                                <child>
-                                  <object class="GtkSpinButton" id="size">
-                                    <property name="valign">center</property>
-                                    <property name="numeric">True</property>
-                                    <property name="adjustment">
-                                      <object class="GtkAdjustment">
-                                        <property name="lower">24</property>
-                                        <property name="upper">320</property>
-                                        <property name="value">128</property>
-                                        <property name="page-increment">8</property>
-                                        <property name="step-increment">8</property>
-                                      </object>
-                                    </property>
+                                <property name="numeric">True</property>
+                                <property name="adjustment">
+                                  <object class="GtkAdjustment">
+                                    <property name="lower">24</property>
+                                    <property name="upper">320</property>
+                                    <property name="value">128</property>
+                                    <property name="page-increment">8</property>
+                                    <property name="step-increment">8</property>
                                   </object>
-                                </child>
+                                </property>
                               </object>
                             </child>
                             <child>
diff --git a/demo/pages/clamp/adw-demo-page-clamp.ui b/demo/pages/clamp/adw-demo-page-clamp.ui
index e8f02f4b..10e1e0f1 100644
--- a/demo/pages/clamp/adw-demo-page-clamp.ui
+++ b/demo/pages/clamp/adw-demo-page-clamp.ui
@@ -15,41 +15,31 @@
             <property name="child">
               <object class="AdwPreferencesGroup">
                 <child>
-                  <object class="AdwActionRow">
+                  <object class="AdwSpinRow">
                     <property name="title" translatable="yes">Maximum Width</property>
-                    <child>
-                      <object class="GtkSpinButton">
-                        <property name="valign">center</property>
-                        <property name="adjustment">
-                          <object class="GtkAdjustment" id="maximum_size_adjustment">
-                            <property name="lower">0</property>
-                            <property name="upper">10000</property>
-                            <property name="value">600</property>
-                            <property name="page-increment">100</property>
-                            <property name="step-increment">10</property>
-                          </object>
-                        </property>
+                    <property name="adjustment">
+                      <object class="GtkAdjustment" id="maximum_size_adjustment">
+                        <property name="lower">0</property>
+                        <property name="upper">10000</property>
+                        <property name="value">600</property>
+                        <property name="page-increment">100</property>
+                        <property name="step-increment">10</property>
                       </object>
-                    </child>
+                    </property>
                   </object>
                 </child>
                 <child>
-                  <object class="AdwActionRow">
+                  <object class="AdwSpinRow">
                     <property name="title" translatable="yes">Tightening Threshold</property>
-                    <child>
-                      <object class="GtkSpinButton">
-                        <property name="valign">center</property>
-                        <property name="adjustment">
-                          <object class="GtkAdjustment" id="tightening_threshold_adjustment">
-                            <property name="lower">0</property>
-                            <property name="upper">10000</property>
-                            <property name="value">500</property>
-                            <property name="page-increment">100</property>
-                            <property name="step-increment">10</property>
-                          </object>
-                        </property>
+                    <property name="adjustment">
+                      <object class="GtkAdjustment" id="tightening_threshold_adjustment">
+                        <property name="lower">0</property>
+                        <property name="upper">10000</property>
+                        <property name="value">500</property>
+                        <property name="page-increment">100</property>
+                        <property name="step-increment">10</property>
                       </object>
-                    </child>
+                    </property>
                   </object>
                 </child>
               </object>


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