[gnome-control-center] mouse: decouple Natural Scrolling for mice and touchpads



commit c1318c634f1e97228584c451262d2f7ff18ad838
Author: Felipe Borges <feborges redhat com>
Date:   Tue Oct 27 15:37:55 2015 +0100

    mouse: decouple Natural Scrolling for mice and touchpads
    
    Now each kind of device has its own entry.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756863

 panels/mouse/gnome-mouse-properties.c  |   25 ++----
 panels/mouse/gnome-mouse-properties.ui |  164 +++++++++++++++++++-------------
 2 files changed, 106 insertions(+), 83 deletions(-)
---
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index 0b1b5ae..e336a73 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -90,18 +90,6 @@ orientation_button_release_event (GtkWidget   *widget,
 }
 
 static void
-natural_scrolling_state_set (GtkSwitch *button,
-                            gboolean   state,
-                            gpointer user_data)
-{
-       CcMousePropertiesPrivate *d = user_data;
-
-       g_settings_set_boolean (d->mouse_settings, "natural-scroll", state);
-       g_settings_set_boolean (d->touchpad_settings, "natural-scroll", state);
-       gtk_switch_set_state (button, state);
-}
-
-static void
 setup_touchpad_options (CcMousePropertiesPrivate *d)
 {
        GsdTouchpadScrollMethod method;
@@ -230,12 +218,9 @@ setup_dialog (CcMousePropertiesPrivate *d)
        g_signal_connect (WID ("primary-button-left"), "button_release_event",
                G_CALLBACK (orientation_button_release_event), NULL);
 
-       /* bind natural-scroll setting for mice and touchpad */
-       g_settings_bind (d->touchpad_settings, "natural-scroll",
-                        WID ("natural-scrolling-switch"), "active",
+       g_settings_bind (d->mouse_settings, "natural-scroll",
+                        WID ("mouse-natural-scrolling-switch"), "active",
                         G_SETTINGS_BIND_DEFAULT);
-       g_signal_connect (WID ("natural-scrolling-switch"), "state-set",
-                         G_CALLBACK (natural_scrolling_state_set), d);
 
        gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("general-listbox")), cc_list_box_update_header_func, 
NULL, NULL);
 
@@ -248,6 +233,8 @@ setup_dialog (CcMousePropertiesPrivate *d)
                         gtk_range_get_adjustment (GTK_RANGE (WID ("mouse-speed-scale"))), "value",
                         G_SETTINGS_BIND_DEFAULT);
 
+       gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("mouse-listbox")), cc_list_box_update_header_func, 
NULL, NULL);
+
        /* Touchpad section */
        gtk_widget_set_visible (WID ("touchpad-frame"), d->have_touchpad);
        gtk_widget_set_visible (WID ("touchpad-toggle-switch"),
@@ -266,6 +253,10 @@ setup_dialog (CcMousePropertiesPrivate *d)
                                      touchpad_enabled_set_mapping,
                                      NULL, NULL);
 
+       g_settings_bind (d->touchpad_settings, "natural-scroll",
+                         WID ("touchpad-natural-scrolling-switch"), "active",
+                         G_SETTINGS_BIND_DEFAULT);
+
        gtk_scale_add_mark (GTK_SCALE (WID ("touchpad-speed-scale")), 0,
                            GTK_POS_TOP, NULL);
        g_settings_bind (d->touchpad_settings, "speed",
diff --git a/panels/mouse/gnome-mouse-properties.ui b/panels/mouse/gnome-mouse-properties.ui
index 81430bf..0d40330 100644
--- a/panels/mouse/gnome-mouse-properties.ui
+++ b/panels/mouse/gnome-mouse-properties.ui
@@ -148,72 +148,6 @@
                         </child>
                       </object>
                     </child>
-                    <child>
-                      <object class="GtkListBoxRow" id="natural-scrolling-row">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <child>
-                          <object class="GtkGrid" id="natural-scrolling-grid">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="row_spacing">0</property>
-                            <property name="column_spacing">16</property>
-                            <property name="margin_start">12</property>
-                            <property name="margin_end">6</property>
-                            <property name="margin_top">6</property>
-                            <property name="margin_bottom">6</property>
-                            <child>
-                              <object class="GtkLabel" id="natural-scrolling-label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="xalign">0</property>
-                                <property name="label" 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="use_underline">True</property>
-                                <property name="mnemonic_widget">natural-scrolling-switch</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="natural-scrolling-description">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">For mice and touchpads.</property>
-                                <style>
-                                  <class name="dim-label"/>
-                                </style>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">1</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkSwitch" id="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>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">2</property>
-                              </packing>
-                            </child>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
                   </object>
                 </child>
               </object>
@@ -303,6 +237,55 @@
                         </child>
                       </object>
                     </child>
+                    <child>
+                      <object class="GtkListBoxRow" id="mouse-natural-scrolling-row">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <child>
+                          <object class="GtkGrid" id="mouse-natural-scrolling-grid">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="row_spacing">0</property>
+                            <property name="column_spacing">16</property>
+                            <property name="margin_start">12</property>
+                            <property name="margin_end">6</property>
+                            <property name="margin_top">6</property>
+                            <property name="margin_bottom">6</property>
+                            <child>
+                              <object class="GtkLabel" id="mouse-natural-scrolling-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" 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="use_underline">True</property>
+                                <property name="mnemonic_widget">mouse-natural-scrolling-switch</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <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>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">2</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
                   </object>
                 </child>
               </object>
@@ -421,6 +404,55 @@
                             <property name="can_focus">True</property>
                             <property name="selection_mode">none</property>
                             <child>
+                              <object class="GtkListBoxRow" id="touchpad-natural-scrolling-row">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <child>
+                                  <object class="GtkGrid" id="touchpad-natural-scrolling-grid">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="row_spacing">0</property>
+                                    <property name="column_spacing">16</property>
+                                    <property name="margin_start">12</property>
+                                    <property name="margin_end">6</property>
+                                    <property name="margin_top">6</property>
+                                    <property name="margin_bottom">6</property>
+                                    <child>
+                                      <object class="GtkLabel" id="touchpad-natural-scrolling-label">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="hexpand">True</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" 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="use_underline">True</property>
+                                        <property 
name="mnemonic_widget">touchpad-natural-scrolling-switch</property>
+                                      </object>
+                                      <packing>
+                                        <property name="left_attach">0</property>
+                                        <property name="top_attach">0</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
+                                      </packing>
+                                    </child>
+                                    <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>
+                                      <packing>
+                                        <property name="left_attach">1</property>
+                                        <property name="top_attach">0</property>
+                                        <property name="width">1</property>
+                                        <property name="height">2</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
                               <object class="GtkListBoxRow" id="touchpad-speed-row">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>


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