[gnome-games/wip/abhinavsingh/gamepad-config: 14/25] ui: Add skip button to GamepadMapper



commit 4b4c05c4305c86c6dba365fd7e70f7632ff213dc
Author: theawless <theawless gmail com>
Date:   Sat Jun 3 16:31:49 2017 +0530

    ui: Add skip button to GamepadMapper
    
    Many gamepads do not possess all the inputs from a standard gamepad,
    hence the user should be allowed to skip those inputs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780754

 data/ui/gamepad-mapper.ui  |   10 ++++++++++
 src/ui/gamepad-mapper.vala |    9 ++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/gamepad-mapper.ui b/data/ui/gamepad-mapper.ui
index 0b91ddd..1628876 100644
--- a/data/ui/gamepad-mapper.ui
+++ b/data/ui/gamepad-mapper.ui
@@ -77,5 +77,15 @@
         <property name="pack-type">end</property>
       </packing>
     </child>
+    <child>
+      <object class="GtkButton" id="skip_button">
+        <property name="visible">True</property>
+        <property name="label" translatable="yes">Skip</property>
+        <signal name="clicked" handler="on_skip_clicked"/>
+      </object>
+      <packing>
+        <property name="pack-type">end</property>
+      </packing>
+    </child>
   </object>
 </interface>
diff --git a/src/ui/gamepad-mapper.vala b/src/ui/gamepad-mapper.vala
index 3a07a80..e64a5b5 100644
--- a/src/ui/gamepad-mapper.vala
+++ b/src/ui/gamepad-mapper.vala
@@ -10,7 +10,6 @@ private class Games.GamepadMapper : Gtk.Box {
                FINISH,
        }
 
-       // TODO: Add skip button
        private State? _state;
        private State? state {
                set {
@@ -28,6 +27,7 @@ private class Games.GamepadMapper : Gtk.Box {
                        case State.CONFIGURE:
                                break;
                        case State.FINISH:
+                               skip_button.set_sensitive (false);
                                apply_button.set_sensitive (true);
                                title.label = _("Finished configuration");
                                disconnect_from_gamepad ();
@@ -81,6 +81,8 @@ private class Games.GamepadMapper : Gtk.Box {
        [GtkChild]
        private Gtk.Button apply_button;
        [GtkChild]
+       private Gtk.Button skip_button;
+       [GtkChild]
        private Gtk.Label title;
 
        private Gamepad gamepad;
@@ -104,6 +106,11 @@ private class Games.GamepadMapper : Gtk.Box {
        }
 
        [GtkCallback]
+       private void on_skip_clicked () {
+               next_input ();
+       }
+
+       [GtkCallback]
        private void on_back_clicked () {
                back ();
        }


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