[gnome-games/wip/abhinavsingh/gamepad-config: 11/22] ui: Show GamepadMapper on gamepad click in prefs



commit b8d200de54d7151e36cfbb9ba42ede3b28a730e3
Author: theawless <theawless gmail com>
Date:   Sun May 28 06:07:08 2017 +0530

    ui: Show GamepadMapper on gamepad click in prefs

 src/ui/preferences-page-gamepads.vala |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/ui/preferences-page-gamepads.vala b/src/ui/preferences-page-gamepads.vala
index 582e9b1..2485ac8 100644
--- a/src/ui/preferences-page-gamepads.vala
+++ b/src/ui/preferences-page-gamepads.vala
@@ -42,6 +42,20 @@ private class Games.PreferencesPageGamepads: Gtk.Bin, PreferencesPage {
 
        [GtkCallback]
        private void gamepads_list_box_row_activated (Gtk.ListBoxRow row_item) {
-               // open the gamepad configurer here
+               Gamepad? gamepad = null;
+               var i = 0;
+               gamepad_monitor.foreach_gamepad ((gamepad_) => {
+                       if (i == row_item.get_index ())
+                               gamepad = gamepad_;
+                       i++;
+               });
+
+               if (gamepad == null)
+                       return;
+
+               var mapper = new GamepadMapper(gamepad);
+               mapper.set_transient_for ((Gtk.Window) get_toplevel ());
+               mapper.start ();
+               mapper.destroy ();
        }
 }


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