diff --git a/src/Views/Touchpad.vala b/src/Views/Touchpad.vala index 3623acf7..699a3514 100644 --- a/src/Views/Touchpad.vala +++ b/src/Views/Touchpad.vala @@ -4,6 +4,9 @@ */ public class MouseTouchpad.TouchpadView : Switchboard.SettingsPage { + private GLib.Settings glib_settings; + private Gtk.CheckButton drag_lock_check; + public TouchpadView () { Object ( icon: new ThemedIcon ("input-touchpad"), @@ -69,16 +72,27 @@ public class MouseTouchpad.TouchpadView : Switchboard.SettingsPage { click_method_box.append (areas_click_method_radio); var tap_to_click_check = new Gtk.CheckButton.with_label (_("Tap to click")) { - halign = Gtk.Align.START + halign = START }; var tap_and_drag_check = new Gtk.CheckButton.with_label (_("Double-tap and move to drag")) { - halign = Gtk.Align.START + halign = START + }; + + drag_lock_check = new Gtk.CheckButton.with_label (_("Continue dragging if the finger is only lifted briefly")) { + halign = START }; - var tap_box = new Gtk.Box (HORIZONTAL, 24); + var tap_box = new Gtk.Box (VERTICAL, 6) { + accessible_role = LIST + }; tap_box.append (tap_to_click_check); tap_box.append (tap_and_drag_check); + tap_box.append (drag_lock_check); + + var tapping_header = new Granite.HeaderLabel (_("Tapping")) { + mnemonic_widget = tap_box + }; var scroll_method_label = new Granite.HeaderLabel (_("Scroll Method")); @@ -145,7 +159,7 @@ public class MouseTouchpad.TouchpadView : Switchboard.SettingsPage { content_box.append (pointer_speed_scale); content_box.append (disable_label); content_box.append (disable_box); - content_box.append (new Granite.HeaderLabel (_("Tapping"))); + content_box.append (tapping_header); content_box.append (tap_box); content_box.append (click_method_label); content_box.append (click_method_box); @@ -155,7 +169,7 @@ public class MouseTouchpad.TouchpadView : Switchboard.SettingsPage { child = content_box; - var glib_settings = new GLib.Settings ("org.gnome.desktop.peripherals.touchpad"); + glib_settings = new GLib.Settings ("org.gnome.desktop.peripherals.touchpad"); glib_settings.bind ( "disable-while-typing", disable_while_typing_check, @@ -193,6 +207,12 @@ public class MouseTouchpad.TouchpadView : Switchboard.SettingsPage { BindingFlags.SYNC_CREATE ); + glib_settings.bind ("tap-and-drag-lock", drag_lock_check, "active", DEFAULT); + + update_drag_lock_sensitive (); + glib_settings.changed["tap-to-click"].connect (update_drag_lock_sensitive); + glib_settings.changed["tap-and-drag"].connect (update_drag_lock_sensitive); + glib_settings.bind_with_mapping ( "send-events", disable_with_mouse_check, "active", DEFAULT, (value, variant, user_data) => { @@ -244,4 +264,8 @@ public class MouseTouchpad.TouchpadView : Switchboard.SettingsPage { edge_scroll_radio.active = true; } } + + private void update_drag_lock_sensitive () { + drag_lock_check.sensitive = glib_settings.get_boolean ("tap-to-click") && glib_settings.get_boolean ("tap-and-drag"); + } }