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



commit 9aea0c631aed0847c6cfcba5ad16a00f2570b60c
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]