[gnome-control-center] mouse: Use content style for listboxes



commit e09ecc41aae81efcf324cf7af65862e8158dd79c
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Wed May 12 18:24:13 2021 +0530

    mouse: Use content style for listboxes

 panels/mouse/cc-mouse-panel.c  |   5 -
 panels/mouse/cc-mouse-panel.ui | 367 +++++++++++++++++++----------------------
 2 files changed, 174 insertions(+), 198 deletions(-)
---
diff --git a/panels/mouse/cc-mouse-panel.c b/panels/mouse/cc-mouse-panel.c
index 2f545e692..ddf3fc1a8 100644
--- a/panels/mouse/cc-mouse-panel.c
+++ b/panels/mouse/cc-mouse-panel.c
@@ -231,9 +231,6 @@ setup_dialog (CcMousePanel *self)
        self->mouse_natural_scrolling_switch, "active",
        G_SETTINGS_BIND_DEFAULT);
 
-  gtk_list_box_set_header_func (self->general_listbox, cc_list_box_update_header_func, NULL, NULL);
-  gtk_list_box_set_header_func (self->touchpad_listbox, cc_list_box_update_header_func, NULL, NULL);
-
   /* Mouse section */
   gtk_widget_set_visible (GTK_WIDGET (self->mouse_frame), self->have_mouse);
 
@@ -241,8 +238,6 @@ setup_dialog (CcMousePanel *self)
                    gtk_range_get_adjustment (GTK_RANGE (self->mouse_speed_scale)), "value",
                    G_SETTINGS_BIND_DEFAULT);
 
-  gtk_list_box_set_header_func (self->mouse_listbox, cc_list_box_update_header_func, NULL, NULL);
-
   /* Touchpad section */
   gtk_widget_set_visible (GTK_WIDGET (self->touchpad_toggle_switch), show_touchpad_enabling_switch (self));
 
diff --git a/panels/mouse/cc-mouse-panel.ui b/panels/mouse/cc-mouse-panel.ui
index 4a6e9d555..883666361 100644
--- a/panels/mouse/cc-mouse-panel.ui
+++ b/panels/mouse/cc-mouse-panel.ui
@@ -42,63 +42,59 @@
                       </object>
                     </child>
                     <child>
-                      <object class="GtkFrame">
+                      <object class="GtkListBox" id="general_listbox">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="shadow_type">in</property>
+                        <property name="can_focus">True</property>
+                        <property name="selection_mode">none</property>
+                        <style>
+                          <class name="content"/>
+                        </style>
                         <child>
-                          <object class="GtkListBox" id="general_listbox">
+                          <object class="HdyActionRow" id="primary_button_row">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="selection_mode">none</property>
+                            <property name="activatable">false</property>
+                            <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="HdyActionRow" id="primary_button_row">
+                              <object class="GtkGrid">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="activatable">false</property>
-                                <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>
+                                <property name="can_focus">False</property>
+                                <property name="row_spacing">2</property>
+                                <property name="column_spacing">16</property>
+                                <property name="margin_start">20</property>
+                                <property name="margin_end">20</property>
+                                <property name="margin_top">12</property>
+                                <property name="margin_bottom">12</property>
                                 <child>
-                                  <object class="GtkGrid">
+                                  <object class="GtkBox" id="primary_button_box">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="row_spacing">2</property>
-                                    <property name="column_spacing">16</property>
-                                    <property name="margin_start">20</property>
-                                    <property name="margin_end">20</property>
-                                    <property name="margin_top">12</property>
-                                    <property name="margin_bottom">12</property>
+                                    <property name="valign">center</property>
+                                    <property name="homogeneous">True</property>
+                                    <style>
+                                     <class name="linked"/>
+                                    </style>
+                                    <child>
+                                      <object class="GtkRadioButton" id="primary_button_left">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="hexpand">True</property>
+                                        <property name="label" translatable="yes">Left</property>
+                                        <property name="draw-indicator">False</property>
+                                        <property name="height_request">35</property>
+                                      </object>
+                                    </child>
                                     <child>
-                                      <object class="GtkBox" id="primary_button_box">
+                                      <object class="GtkRadioButton" id="primary_button_right">
                                         <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="valign">center</property>
-                                        <property name="homogeneous">True</property>
-                                        <style>
-                                          <class name="linked"/>
-                                        </style>
-                                        <child>
-                                          <object class="GtkRadioButton" id="primary_button_left">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">True</property>
-                                            <property name="hexpand">True</property>
-                                            <property name="label" translatable="yes">Left</property>
-                                            <property name="draw-indicator">False</property>
-                                            <property name="height_request">35</property>
-                                          </object>
-                                        </child>
-                                        <child>
-                                          <object class="GtkRadioButton" id="primary_button_right">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">True</property>
-                                            <property name="hexpand">True</property>
-                                            <property name="label" translatable="yes">Right</property>
-                                            <property name="draw-indicator">False</property>
-                                            <property name="group">primary_button_left</property>
-                                            <property name="height_request">35</property>
-                                          </object>
-                                        </child>
+                                        <property name="can_focus">True</property>
+                                        <property name="hexpand">True</property>
+                                        <property name="label" translatable="yes">Right</property>
+                                        <property name="draw-indicator">False</property>
+                                        <property name="group">primary_button_left</property>
+                                        <property name="height_request">35</property>
                                       </object>
                                     </child>
                                   </object>
@@ -131,54 +127,50 @@
                       </object>
                     </child>
                     <child>
-                      <object class="GtkFrame">
+                      <object class="GtkListBox" id="mouse_listbox">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="shadow_type">in</property>
+                        <property name="can_focus">True</property>
+                        <property name="selection_mode">none</property>
+                        <style>
+                          <class name="content"/>
+                        </style>
                         <child>
-                          <object class="GtkListBox" id="mouse_listbox">
+                          <object class="HdyActionRow" id="mouse_row">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="selection_mode">none</property>
+                            <property name="activatable">false</property>
+                            <property name="title" translatable="yes">Mouse Speed</property>
                             <child>
-                              <object class="HdyActionRow" id="mouse_row">
+                              <object class="GtkScale" id="mouse_speed_scale">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="activatable">false</property>
-                                <property name="title" translatable="yes">Mouse Speed</property>
-                                <child>
-                                  <object class="GtkScale" id="mouse_speed_scale">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="adjustment">mouse_speed_adjustment</property>
-                                    <property name="draw_value">False</property>
-                                    <property name="width-request">300</property>
-                                    <property name="halign">end</property>
-                                    <property name="expand">True</property>
-                                    <child internal-child="accessible">
-                                      <object class="AtkObject">
-                                        <property name="AtkObject::accessible-description" 
translatable="yes">Double-click timeout</property>
-                                      </object>
-                                    </child>
+                                <property name="adjustment">mouse_speed_adjustment</property>
+                                <property name="draw_value">False</property>
+                                <property name="width-request">300</property>
+                                <property name="halign">end</property>
+                                <property name="expand">True</property>
+                                <child internal-child="accessible">
+                                  <object class="AtkObject">
+                                    <property name="AtkObject::accessible-description" 
translatable="yes">Double-click timeout</property>
                                   </object>
                                 </child>
                               </object>
                             </child>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="HdyActionRow" id="mouse_natural_scrolling_row">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="activatable">false</property>
+                            <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="HdyActionRow" id="mouse_natural_scrolling_row">
+                              <object class="GtkSwitch" id="mouse_natural_scrolling_switch">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="activatable">false</property>
-                                <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="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="halign">end</property>
-                                    <property name="valign">center</property>
-                                  </object>
-                                </child>
+                                <property name="halign">end</property>
+                                <property name="valign">center</property>
                               </object>
                             </child>
                           </object>
@@ -206,131 +198,120 @@
                       </object>
                     </child>
                     <child>
-                      <object class="GtkFrame" id="touchpad_frame_listbox">
+                      <object class="GtkListBox" id="touchpad_listbox">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="shadow_type">in</property>
+                        <property name="can_focus">True</property>
+                        <property name="selection_mode">none</property>
+                        <style>
+                          <class name="content"/>
+                        </style>
                         <child>
-                          <object class="GtkBox" id="touchpad_box">
+                          <object class="HdyActionRow" id="touchpad_toggle_row">
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="orientation">vertical</property>
+                            <property name="can_focus">True</property>
+                            <property name="activatable">false</property>
+                            <property name="title" translatable="yes">Touchpad</property>
                             <child>
-                              <object class="GtkListBox" id="touchpad_listbox">
+                              <object class="GtkSwitch" id="touchpad_toggle_switch">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="selection_mode">none</property>
-                                <child>
-                                  <object class="HdyActionRow" id="touchpad_toggle_row">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="activatable">false</property>
-                                    <property name="title" translatable="yes">Touchpad</property>
-                                    <child>
-                                      <object class="GtkSwitch" id="touchpad_toggle_switch">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="halign">end</property>
-                                        <property name="valign">center</property>
-                                        <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                      </object>
-                                    </child>
-                                  </object>
-                                </child>
-                                <child>
-                                  <object class="HdyActionRow" id="touchpad_natural_scrolling_row">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="activatable">false</property>
-                                    <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="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="halign">end</property>
-                                        <property name="valign">center</property>
-                                      </object>
-                                    </child>
-                                  </object>
-                                </child>
-                                <child>
-                                  <object class="HdyActionRow" id="touchpad_speed_row">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="activatable">false</property>
-                                    <property name="title" translatable="yes">Touchpad Speed</property>
-                                    <child>
-                                      <object class="GtkScale" id="touchpad_speed_scale">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="adjustment">touchpad_speed_adjustment</property>
-                                        <property name="draw_value">False</property>
-                                        <property name="expand">True</property>
-                                        <property name="halign">end</property>
-                                        <child internal-child="accessible">
-                                          <object class="AtkObject">
-                                            <property name="AtkObject::accessible-description" 
translatable="yes">Double-click timeout</property>
-                                          </object>
-                                        </child>
-                                      </object>
-                                    </child>
-                                  </object>
-                                </child>
-                                <child>
-                                  <object class="HdyActionRow" id="tap_to_click_row">
-                                    <property name="visible">False</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="activatable">false</property>
-                                    <property name="title" translatable="yes">Tap to Click</property>
-                                    <child>
-                                      <object class="GtkSwitch" id="tap_to_click_switch">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="halign">end</property>
-                                        <property name="valign">center</property>
-                                      </object>
-                                    </child>
-                                  </object>
-                                </child>
-                                <child>
-                                  <object class="HdyActionRow" id="two_finger_scrolling_row">
-                                    <property name="visible">False</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="activatable">false</property>
-                                    <property name="title" translatable="yes">Two-finger Scrolling</property>
-                                    <child>
-                                      <object class="GtkSwitch" id="two_finger_scrolling_switch">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="halign">end</property>
-                                        <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="HdyActionRow" id="edge_scrolling_row">
-                                    <property name="visible">False</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="activatable">false</property>
-                                    <property name="title" translatable="yes">Edge Scrolling</property>
-                                    <child>
-                                      <object class="GtkSwitch" id="edge_scrolling_switch">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="halign">end</property>
-                                        <property name="valign">center</property>
-                                        <signal name="state-set" handler="edge_scrolling_changed_event" 
object="CcMousePanel" swapped="yes"/>
-                                      </object>
-                                    </child>
+                                <property name="halign">end</property>
+                                <property name="valign">center</property>
+                                <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="HdyActionRow" id="touchpad_natural_scrolling_row">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="activatable">false</property>
+                            <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="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="halign">end</property>
+                                <property name="valign">center</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="HdyActionRow" id="touchpad_speed_row">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="activatable">false</property>
+                            <property name="title" translatable="yes">Touchpad Speed</property>
+                            <child>
+                              <object class="GtkScale" id="touchpad_speed_scale">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">touchpad_speed_adjustment</property>
+                                <property name="draw_value">False</property>
+                                <property name="expand">True</property>
+                                <property name="halign">end</property>
+                                <child internal-child="accessible">
+                                  <object class="AtkObject">
+                                    <property name="AtkObject::accessible-description" 
translatable="yes">Double-click timeout</property>
                                   </object>
                                 </child>
                               </object>
                             </child>
                           </object>
                         </child>
+                        <child>
+                          <object class="HdyActionRow" id="tap_to_click_row">
+                            <property name="visible">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="activatable">false</property>
+                            <property name="title" translatable="yes">Tap to Click</property>
+                            <child>
+                              <object class="GtkSwitch" id="tap_to_click_switch">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="halign">end</property>
+                                <property name="valign">center</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="HdyActionRow" id="two_finger_scrolling_row">
+                            <property name="visible">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="activatable">false</property>
+                            <property name="title" translatable="yes">Two-finger Scrolling</property>
+                            <child>
+                              <object class="GtkSwitch" id="two_finger_scrolling_switch">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="halign">end</property>
+                                <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="HdyActionRow" id="edge_scrolling_row">
+                            <property name="visible">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="activatable">false</property>
+                            <property name="title" translatable="yes">Edge Scrolling</property>
+                            <child>
+                              <object class="GtkSwitch" id="edge_scrolling_switch">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="halign">end</property>
+                                <property name="valign">center</property>
+                                <signal name="state-set" handler="edge_scrolling_changed_event" 
object="CcMousePanel" swapped="yes"/>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
                       </object>
                     </child>
                   </object>


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