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



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

    ui: Show GamepadMapper on click in gamepad prefs
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780754

 src/ui/preferences-page-input.vala |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/ui/preferences-page-input.vala b/src/ui/preferences-page-input.vala
index 9f345ad..42a16a3 100644
--- a/src/ui/preferences-page-input.vala
+++ b/src/ui/preferences-page-input.vala
@@ -42,6 +42,20 @@ private class Games.PreferencesPageInput: 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]