diff --git a/src/Views/Gestures.vala b/src/Views/Gestures.vala index 7851fabd..ca2c169a 100644 --- a/src/Views/Gestures.vala +++ b/src/Views/Gestures.vala @@ -29,28 +29,42 @@ public class MouseTouchpad.GesturesView : Switchboard.SettingsPage { construct { show_end_title_buttons = true; - var three_swipe_horizontal_combo = new Gtk.ComboBoxText () { + var horizontal_liststore = new ListStore (typeof (GestureOption)); + horizontal_liststore.append (new GestureOption ("none", _("Do nothing"))); + horizontal_liststore.append (new GestureOption ("switch-to-workspace", _("Switch to workspace"))); + horizontal_liststore.append (new GestureOption ("move-to-workspace", _("Move active window to workspace"))); + horizontal_liststore.append (new GestureOption ("switch-windows", _("Cycle windows"))); + + var up_liststore = new ListStore (typeof (GestureOption)); + up_liststore.append (new GestureOption ("none", _("Do nothing"))); + up_liststore.append (new GestureOption ("multitasking-view", _("Multitasking View"))); + + var pinch_liststore = new ListStore (typeof (GestureOption)); + pinch_liststore.append (new GestureOption ("none", _("Do nothing"))); + pinch_liststore.append (new GestureOption ("multitasking-view", _("Multitasking View"))); + + var expression = new Gtk.PropertyExpression ( + typeof (GestureOption), + null, + "label" + ); + + var three_swipe_horizontal_dropdown = new Gtk.DropDown (horizontal_liststore, expression) { hexpand = true }; - three_swipe_horizontal_combo.append ("none", _("Do nothing")); - three_swipe_horizontal_combo.append ("switch-to-workspace", _("Switch to workspace")); - three_swipe_horizontal_combo.append ("move-to-workspace", _("Move active window to workspace")); - three_swipe_horizontal_combo.append ("switch-windows", _("Cycle windows")); var three_swipe_horizontal_label = new Gtk.Label (_("Three fingers:")) { halign = END, - mnemonic_widget = three_swipe_horizontal_combo + mnemonic_widget = three_swipe_horizontal_dropdown }; - var four_swipe_horizontal_combo = new Gtk.ComboBoxText (); - four_swipe_horizontal_combo.append ("none", _("Do nothing")); - four_swipe_horizontal_combo.append ("switch-to-workspace", _("Switch to workspace")); - four_swipe_horizontal_combo.append ("move-to-workspace", _("Move active window to workspace")); - four_swipe_horizontal_combo.append ("switch-windows", _("Cycle windows")); + var four_swipe_horizontal_dropdown = new Gtk.DropDown (horizontal_liststore, expression) { + hexpand = true + }; var four_swipe_horizontal_label = new Gtk.Label (_("Four fingers:")) { halign = END, - mnemonic_widget = four_swipe_horizontal_combo + mnemonic_widget = four_swipe_horizontal_dropdown }; var horizontal_swipe_grid = new Gtk.Grid () { @@ -59,9 +73,9 @@ public class MouseTouchpad.GesturesView : Switchboard.SettingsPage { row_spacing = 12 }; horizontal_swipe_grid.attach (three_swipe_horizontal_label, 0, 1); - horizontal_swipe_grid.attach (three_swipe_horizontal_combo, 1, 1); + horizontal_swipe_grid.attach (three_swipe_horizontal_dropdown, 1, 1); horizontal_swipe_grid.attach (four_swipe_horizontal_label, 0, 2); - horizontal_swipe_grid.attach (four_swipe_horizontal_combo, 1, 2); + horizontal_swipe_grid.attach (four_swipe_horizontal_dropdown, 1, 2); var horizontal_swipe_header = new Granite.HeaderLabel (_("Swipe Horizontally")) { mnemonic_widget = horizontal_swipe_grid @@ -148,8 +162,9 @@ public class MouseTouchpad.GesturesView : Switchboard.SettingsPage { child = content_area; var glib_settings = new GLib.Settings ("io.elementary.desktop.wm.gestures"); - glib_settings.bind ("three-finger-swipe-horizontal", three_swipe_horizontal_combo, "active-id", GLib.SettingsBindFlags.DEFAULT); - glib_settings.bind ("four-finger-swipe-horizontal", four_swipe_horizontal_combo, "active-id", GLib.SettingsBindFlags.DEFAULT); + glib_settings.bind ("three-finger-swipe-horizontal", three_swipe_horizontal_dropdown, "selected", DEFAULT); + glib_settings.bind ("four-finger-swipe-horizontal", four_swipe_horizontal_dropdown, "selected", DEFAULT); + glib_settings.bind ("three-finger-swipe-up", three_swipe_up_combo, "active-id", GLib.SettingsBindFlags.DEFAULT); glib_settings.bind ("four-finger-swipe-up", four_swipe_up_combo, "active-id", GLib.SettingsBindFlags.DEFAULT); glib_settings.bind ("three-finger-pinch", three_pinch_combo, "active-id", GLib.SettingsBindFlags.DEFAULT); @@ -183,4 +198,13 @@ public class MouseTouchpad.GesturesView : Switchboard.SettingsPage { }); } } + + private class GestureOption : Object { + public string name { get; construct; } + public string label { get; construct; } + + public GestureOption (string name, string label) { + Object (name: name, label: label); + } + } }