[gnome-control-center] mouse: Use AdwPreferencesGroup's listboxes



commit 7aae515cf65f8f9bb6b8b256fd85a7770e5a99f1
Author: Christopher Davis <christopherdavis gnome org>
Date:   Sat Jan 15 01:03:04 2022 -0800

    mouse: Use AdwPreferencesGroup's listboxes
    
    We don't need our own listboxes, because our rows
    here aren't dynamic.

 panels/mouse/cc-mouse-panel.c  |   6 --
 panels/mouse/cc-mouse-panel.ui | 210 ++++++++++++++++++-----------------------
 2 files changed, 93 insertions(+), 123 deletions(-)
---
diff --git a/panels/mouse/cc-mouse-panel.c b/panels/mouse/cc-mouse-panel.c
index 505c20fac..90b01bd5f 100644
--- a/panels/mouse/cc-mouse-panel.c
+++ b/panels/mouse/cc-mouse-panel.c
@@ -37,9 +37,7 @@ struct _CcMousePanel
 
   GtkListBoxRow     *edge_scrolling_row;
   GtkSwitch         *edge_scrolling_switch;
-  GtkListBox        *general_listbox;
   AdwPreferencesGroup *mouse_group;
-  GtkListBox        *mouse_listbox;
   GtkSwitch         *mouse_natural_scrolling_switch;
   GtkScale          *mouse_speed_scale;
   CcMouseTest       *mouse_test;
@@ -52,7 +50,6 @@ struct _CcMousePanel
   GtkSwitch         *tap_to_click_switch;
   GtkButton         *test_button;
   AdwPreferencesGroup *touchpad_group;
-  GtkListBox        *touchpad_listbox;
   GtkListBoxRow     *touchpad_natural_scrolling_row;
   GtkSwitch         *touchpad_natural_scrolling_switch;
   GtkListBoxRow     *touchpad_speed_row;
@@ -404,9 +401,7 @@ cc_mouse_panel_class_init (CcMousePanelClass *klass)
 
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, edge_scrolling_row);
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, edge_scrolling_switch);
-  gtk_widget_class_bind_template_child (widget_class, CcMousePanel, general_listbox);
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_group);
-  gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_listbox);
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_natural_scrolling_switch);
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_speed_scale);
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_test);
@@ -419,7 +414,6 @@ cc_mouse_panel_class_init (CcMousePanelClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, tap_to_click_switch);
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, test_button);
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_group);
-  gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_listbox);
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_natural_scrolling_row);
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_natural_scrolling_switch);
   gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_speed_row);
diff --git a/panels/mouse/cc-mouse-panel.ui b/panels/mouse/cc-mouse-panel.ui
index 08dd8b3e9..18cec305b 100644
--- a/panels/mouse/cc-mouse-panel.ui
+++ b/panels/mouse/cc-mouse-panel.ui
@@ -10,40 +10,32 @@
               <object class="AdwPreferencesGroup">
                 <property name="title" translatable="yes">General</property>
                 <child>
-                  <object class="GtkListBox" id="general_listbox">
-                    <property name="selection_mode">none</property>
-                    <style>
-                      <class name="boxed-list"/>
-                    </style>
+                  <object class="AdwActionRow" id="primary_button_row">
+                    <property name="title" translatable="yes">Primary Button</property>
+                    <property name="subtitle" translatable="yes">Sets the order of physical buttons on mice 
and touchpads.</property>
+                    <property name="subtitle-lines">0</property>
                     <child>
-                      <object class="AdwActionRow" id="primary_button_row">
-                        <property name="title" translatable="yes">Primary Button</property>
-                        <property name="subtitle" translatable="yes">Sets the order of physical buttons on 
mice and touchpads.</property>
-                        <property name="subtitle-lines">0</property>
+                      <object class="GtkBox" id="primary_button_box">
+                        <property name="valign">center</property>
+                        <property name="homogeneous">True</property>
+                        <property name="margin_top">12</property>
+                        <property name="margin_bottom">12</property>
+                        <style>
+                         <class name="linked"/>
+                        </style>
                         <child>
-                          <object class="GtkBox" id="primary_button_box">
-                            <property name="valign">center</property>
-                            <property name="homogeneous">True</property>
-                            <property name="margin_top">12</property>
-                            <property name="margin_bottom">12</property>
-                            <style>
-                             <class name="linked"/>
-                            </style>
-                            <child>
-                              <object class="GtkToggleButton" id="primary_button_left">
-                                <property name="hexpand">True</property>
-                                <property name="label" translatable="yes">Left</property>
-                                <property name="height_request">35</property>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkToggleButton" id="primary_button_right">
-                                <property name="hexpand">True</property>
-                                <property name="label" translatable="yes">Right</property>
-                                <property name="group">primary_button_left</property>
-                                <property name="height_request">35</property>
-                              </object>
-                            </child>
+                          <object class="GtkToggleButton" id="primary_button_left">
+                            <property name="hexpand">True</property>
+                            <property name="label" translatable="yes">Left</property>
+                            <property name="height_request">35</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkToggleButton" id="primary_button_right">
+                            <property name="hexpand">True</property>
+                            <property name="label" translatable="yes">Right</property>
+                            <property name="group">primary_button_left</property>
+                            <property name="height_request">35</property>
                           </object>
                         </child>
                       </object>
@@ -57,36 +49,28 @@
               <object class="AdwPreferencesGroup" id="mouse_group">
                 <property name="title" translatable="yes">Mouse</property>
                 <child>
-                  <object class="GtkListBox" id="mouse_listbox">
-                    <property name="selection_mode">none</property>
-                    <style>
-                      <class name="boxed-list"/>
-                    </style>
+                  <object class="AdwActionRow" id="mouse_row">
+                    <property name="title" translatable="yes">Mouse Speed</property>
                     <child>
-                      <object class="AdwActionRow" id="mouse_row">
-                        <property name="title" translatable="yes">Mouse Speed</property>
-                        <child>
-                          <object class="GtkScale" id="mouse_speed_scale">
-                            <property name="adjustment">mouse_speed_adjustment</property>
-                            <property name="draw_value">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="vexpand">True</property>
-                            <accessibility>
-                              <property name="label">Mouse speed</property>
-                            </accessibility>
-                          </object>
-                        </child>
+                      <object class="GtkScale" id="mouse_speed_scale">
+                        <property name="adjustment">mouse_speed_adjustment</property>
+                        <property name="draw_value">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <accessibility>
+                          <property name="label">Mouse speed</property>
+                        </accessibility>
                       </object>
                     </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="AdwActionRow" id="mouse_natural_scrolling_row">
+                    <property name="title" translatable="yes" comments="Translators: This switch reverses 
the scrolling direction for mices. The term used comes from OS X so use the same translation if 
possible.">Natural Scrolling</property>
+                    <property name="subtitle" translatable="yes">Scrolling moves the content, not the 
view.</property>
                     <child>
-                      <object class="AdwActionRow" id="mouse_natural_scrolling_row">
-                        <property name="title" translatable="yes" comments="Translators: This switch 
reverses the scrolling direction for mices. The term used comes from OS X so use the same translation if 
possible.">Natural Scrolling</property>
-                        <property name="subtitle" translatable="yes">Scrolling moves the content, not the 
view.</property>
-                        <child>
-                          <object class="GtkSwitch" id="mouse_natural_scrolling_switch">
-                            <property name="valign">center</property>
-                          </object>
-                        </child>
+                      <object class="GtkSwitch" id="mouse_natural_scrolling_switch">
+                        <property name="valign">center</property>
                       </object>
                     </child>
                   </object>
@@ -98,81 +82,73 @@
               <object class="AdwPreferencesGroup" id="touchpad_group">
                 <property name="title" translatable="yes">Touchpad</property>
                 <child>
-                  <object class="GtkListBox" id="touchpad_listbox">
-                    <property name="selection_mode">none</property>
-                    <style>
-                      <class name="boxed-list"/>
-                    </style>
+                  <object class="AdwActionRow" id="touchpad_toggle_row">
+                    <property name="title" translatable="yes">Touchpad</property>
                     <child>
-                      <object class="AdwActionRow" id="touchpad_toggle_row">
-                        <property name="title" translatable="yes">Touchpad</property>
-                        <child>
-                          <object class="GtkSwitch" id="touchpad_toggle_switch">
-                            <property name="valign">center</property>
-                          </object>
-                        </child>
+                      <object class="GtkSwitch" id="touchpad_toggle_switch">
+                        <property name="valign">center</property>
                       </object>
                     </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="AdwActionRow" id="touchpad_natural_scrolling_row">
+                    <property name="title" translatable="yes" comments="Translators: This switch reverses 
the scrolling direction for touchpads. The term used comes from OS X so use the same translation if possible. 
">Natural Scrolling</property>
+                    <property name="subtitle" translatable="yes">Scrolling moves the content, not the 
view.</property>
                     <child>
-                      <object class="AdwActionRow" id="touchpad_natural_scrolling_row">
-                        <property name="title" translatable="yes" comments="Translators: This switch 
reverses the scrolling direction for touchpads. The term used comes from OS X so use the same translation if 
possible. ">Natural Scrolling</property>
-                        <property name="subtitle" translatable="yes">Scrolling moves the content, not the 
view.</property>
-                        <child>
-                          <object class="GtkSwitch" id="touchpad_natural_scrolling_switch">
-                            <property name="valign">center</property>
-                          </object>
-                        </child>
+                      <object class="GtkSwitch" id="touchpad_natural_scrolling_switch">
+                        <property name="valign">center</property>
                       </object>
                     </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="AdwActionRow" id="touchpad_speed_row">
+                    <property name="title" translatable="yes">Touchpad Speed</property>
                     <child>
-                      <object class="AdwActionRow" id="touchpad_speed_row">
-                        <property name="title" translatable="yes">Touchpad Speed</property>
-                        <child>
-                          <object class="GtkScale" id="touchpad_speed_scale">
-                            <property name="adjustment">touchpad_speed_adjustment</property>
-                            <property name="draw_value">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="vexpand">True</property>
-                            <accessibility>
-                              <property name="label">Double-click timeout</property>
-                            </accessibility>
-                          </object>
-                        </child>
+                      <object class="GtkScale" id="touchpad_speed_scale">
+                        <property name="adjustment">touchpad_speed_adjustment</property>
+                        <property name="draw_value">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <accessibility>
+                          <property name="label">Double-click timeout</property>
+                        </accessibility>
                       </object>
                     </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="AdwActionRow" id="tap_to_click_row">
+                    <property name="visible">False</property>
+                    <property name="title" translatable="yes">Tap to Click</property>
                     <child>
-                      <object class="AdwActionRow" id="tap_to_click_row">
-                        <property name="visible">False</property>
-                        <property name="title" translatable="yes">Tap to Click</property>
-                        <child>
-                          <object class="GtkSwitch" id="tap_to_click_switch">
-                            <property name="valign">center</property>
-                          </object>
-                        </child>
+                      <object class="GtkSwitch" id="tap_to_click_switch">
+                        <property name="valign">center</property>
                       </object>
                     </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="AdwActionRow" id="two_finger_scrolling_row">
+                    <property name="visible">False</property>
+                    <property name="title" translatable="yes">Two-finger Scrolling</property>
                     <child>
-                      <object class="AdwActionRow" id="two_finger_scrolling_row">
-                        <property name="visible">False</property>
-                        <property name="title" translatable="yes">Two-finger Scrolling</property>
-                        <child>
-                          <object class="GtkSwitch" id="two_finger_scrolling_switch">
-                            <property name="valign">center</property>
-                            <signal name="state-set" handler="two_finger_scrolling_changed_event" 
object="CcMousePanel" swapped="yes"/>
-                          </object>
-                        </child>
+                      <object class="GtkSwitch" id="two_finger_scrolling_switch">
+                        <property name="valign">center</property>
+                        <signal name="state-set" handler="two_finger_scrolling_changed_event" 
object="CcMousePanel" swapped="yes"/>
                       </object>
                     </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="AdwActionRow" id="edge_scrolling_row">
+                    <property name="visible">False</property>
+                    <property name="title" translatable="yes">Edge Scrolling</property>
                     <child>
-                      <object class="AdwActionRow" id="edge_scrolling_row">
-                        <property name="visible">False</property>
-                        <property name="title" translatable="yes">Edge Scrolling</property>
-                        <child>
-                          <object class="GtkSwitch" id="edge_scrolling_switch">
-                            <property name="valign">center</property>
-                            <signal name="state-set" handler="edge_scrolling_changed_event" 
object="CcMousePanel" swapped="yes"/>
-                          </object>
-                        </child>
+                      <object class="GtkSwitch" id="edge_scrolling_switch">
+                        <property name="valign">center</property>
+                        <signal name="state-set" handler="edge_scrolling_changed_event" 
object="CcMousePanel" swapped="yes"/>
                       </object>
                     </child>
                   </object>


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