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



commit 36bffa81b85c1d6f142979c0f7c9a4d4babf2848
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]