[gnome-control-center/gnome-3-20] mouse: Consolidate touchpad section visibility code



commit a3d62acfc5d9ba0f0a9e79abb666bcfa36a44943
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Apr 4 19:59:16 2016 +0200

    mouse: Consolidate touchpad section visibility code
    
    Do it all in a single place. No functional changes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764257

 panels/mouse/gnome-mouse-properties.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index 6f3fbf5..d90019e 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -79,6 +79,10 @@ setup_touchpad_options (CcMousePropertiesPrivate *d)
        gboolean have_edge_scrolling;
        gboolean have_tap_to_click;
 
+       gtk_widget_set_visible (WID ("touchpad-frame"), d->have_touchpad);
+       if (!d->have_touchpad)
+               return;
+
        cc_touchpad_check_capabilities (&have_two_finger_scrolling, &have_edge_scrolling, &have_tap_to_click);
 
        gtk_widget_show_all (WID ("touchpad-frame"));
@@ -87,7 +91,9 @@ setup_touchpad_options (CcMousePropertiesPrivate *d)
        gtk_widget_set_visible (WID ("tap-to-click-row"), have_tap_to_click);
 
        edge_scroll_enabled = g_settings_get_boolean (d->touchpad_settings, "edge-scrolling-enabled");
+       d->changing_scroll = TRUE;
        gtk_switch_set_active (GTK_SWITCH (WID ("edge-scrolling-switch")), edge_scroll_enabled);
+       d->changing_scroll = FALSE;
 }
 
 static void
@@ -210,7 +216,6 @@ setup_dialog (CcMousePropertiesPrivate *d)
        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"),
                                show_touchpad_enabling_switch (d));
 
@@ -239,8 +244,7 @@ setup_dialog (CcMousePropertiesPrivate *d)
                         WID ("tap-to-click-switch"), "active",
                         G_SETTINGS_BIND_DEFAULT);
 
-       if (d->have_touchpad)
-               setup_touchpad_options (d);
+       setup_touchpad_options (d);
 
        g_signal_connect (WID ("edge-scrolling-switch"), "state-set",
                          G_CALLBACK (edge_scrolling_changed_event), d);
@@ -255,13 +259,8 @@ device_changed (GsdDeviceManager *device_manager,
                CcMousePropertiesPrivate *d)
 {
        d->have_touchpad = touchpad_is_present ();
-       gtk_widget_set_visible (WID ("touchpad-frame"), d->have_touchpad);
 
-       if (d->have_touchpad) {
-               d->changing_scroll = TRUE;
-               setup_touchpad_options (d);
-               d->changing_scroll = FALSE;
-       }
+       setup_touchpad_options (d);
 
        d->have_mouse = mouse_is_present ();
        gtk_widget_set_visible (WID ("mouse-frame"), d->have_mouse);


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