[gnome-games/wip/exalm/controller-preferences: 6/6] ui: Simplify controller configurer layout



commit 6cd50292d2af9c68397fb6d9445bb15421ac0482
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Tue Sep 11 22:34:23 2018 +0500

    ui: Simplify controller configurer layout
    
    Remove tester and mapper holder boxes and put them directly into the
    gamepad_view_stack.

 data/ui/gamepad-configurer.ui   | 17 -----------------
 data/ui/keyboard-configurer.ui  | 17 -----------------
 src/ui/gamepad-configurer.vala  | 12 ++++--------
 src/ui/keyboard-configurer.vala | 12 ++++--------
 4 files changed, 8 insertions(+), 50 deletions(-)
---
diff --git a/data/ui/gamepad-configurer.ui b/data/ui/gamepad-configurer.ui
index e60322b0..98ab48de 100644
--- a/data/ui/gamepad-configurer.ui
+++ b/data/ui/gamepad-configurer.ui
@@ -6,24 +6,7 @@
     <child>
       <object class="GtkStack" id="gamepad_view_stack">
         <property name="visible">True</property>
-        <property name="hexpand">True</property>
         <property name="vexpand">True</property>
-        <child>
-          <object class="GtkBox" id="gamepad_mapper_holder">
-            <property name="visible">True</property>
-          </object>
-          <packing>
-            <property name="name">gamepad_mapper</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkBox" id="gamepad_tester_holder">
-            <property name="visible">True</property>
-          </object>
-          <packing>
-            <property name="name">gamepad_tester</property>
-          </packing>
-        </child>
       </object>
     </child>
     <child>
diff --git a/data/ui/keyboard-configurer.ui b/data/ui/keyboard-configurer.ui
index 0b6bd9b2..1f05ec60 100644
--- a/data/ui/keyboard-configurer.ui
+++ b/data/ui/keyboard-configurer.ui
@@ -7,24 +7,7 @@
     <child>
       <object class="GtkStack" id="gamepad_view_stack">
         <property name="visible">True</property>
-        <property name="hexpand">True</property>
         <property name="vexpand">True</property>
-        <child>
-          <object class="GtkBox" id="keyboard_mapper_holder">
-            <property name="visible">True</property>
-          </object>
-          <packing>
-            <property name="name">keyboard_mapper</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkBox" id="keyboard_tester_holder">
-            <property name="visible">True</property>
-          </object>
-          <packing>
-            <property name="name">keyboard_tester</property>
-          </packing>
-        </child>
       </object>
     </child>
     <child>
diff --git a/src/ui/gamepad-configurer.vala b/src/ui/gamepad-configurer.vala
index c3a45781..d60f33c6 100644
--- a/src/ui/gamepad-configurer.vala
+++ b/src/ui/gamepad-configurer.vala
@@ -76,7 +76,7 @@ private class Games.GamepadConfigurer : Gtk.Box {
                                /* translators: testing a gamepad, %s is its name */
                                header_bar.title = _("Testing %s").printf (device.get_name ());
                                header_bar.get_style_context ().remove_class ("selection-mode");
-                               gamepad_view_stack.visible_child = gamepad_tester_holder;
+                               gamepad_view_stack.visible_child = tester;
                                action_bar_stack.visible_child = tester_action_bar;
 
                                tester.start ();
@@ -88,7 +88,7 @@ private class Games.GamepadConfigurer : Gtk.Box {
                                /* translators: configuring a gamepad, %s is its name */
                                header_bar.title = _("Configuring %s").printf (device.get_name ());
                                header_bar.get_style_context ().add_class ("selection-mode");
-                               gamepad_view_stack.visible_child = gamepad_mapper_holder;
+                               gamepad_view_stack.visible_child = mapper;
                                action_bar_stack.visible_child = mapper_action_bar;
 
                                tester.stop ();
@@ -113,10 +113,6 @@ private class Games.GamepadConfigurer : Gtk.Box {
        [GtkChild]
        private Gtk.Stack gamepad_view_stack;
        [GtkChild]
-       private Gtk.Box gamepad_mapper_holder;
-       [GtkChild]
-       private Gtk.Box gamepad_tester_holder;
-       [GtkChild]
        private Gtk.Stack action_bar_stack;
        [GtkChild]
        private Gtk.ActionBar tester_action_bar;
@@ -140,9 +136,9 @@ private class Games.GamepadConfigurer : Gtk.Box {
        public GamepadConfigurer (Manette.Device device) {
                this.device = device;
                mapper = new GamepadMapper (device, STANDARD_GAMEPAD_VIEW_CONFIGURATION, 
STANDARD_GAMEPAD_INPUTS);
-               gamepad_mapper_holder.pack_start (mapper);
+               gamepad_view_stack.add (mapper);
                tester = new GamepadTester (device, STANDARD_GAMEPAD_VIEW_CONFIGURATION);
-               gamepad_tester_holder.pack_start (tester);
+               gamepad_view_stack.add (tester);
 
                info_message_binding = mapper.bind_property ("info-message", info_message, "label", 
BindingFlags.SYNC_CREATE);
 
diff --git a/src/ui/keyboard-configurer.vala b/src/ui/keyboard-configurer.vala
index 043a1fdc..e18588ef 100644
--- a/src/ui/keyboard-configurer.vala
+++ b/src/ui/keyboard-configurer.vala
@@ -66,7 +66,7 @@ private class Games.KeyboardConfigurer : Gtk.Box {
 
                                header_bar.title = _("Testing Keyboard");
                                header_bar.get_style_context ().remove_class ("selection-mode");
-                               gamepad_view_stack.visible_child = keyboard_tester_holder;
+                               gamepad_view_stack.visible_child = tester;
                                action_bar_stack.visible_child = tester_action_bar;
 
                                tester.start ();
@@ -77,7 +77,7 @@ private class Games.KeyboardConfigurer : Gtk.Box {
                        case State.CONFIGURE:
                                header_bar.title = _("Configuring Keyboard");
                                header_bar.get_style_context ().add_class ("selection-mode");
-                               gamepad_view_stack.visible_child = keyboard_mapper_holder;
+                               gamepad_view_stack.visible_child = mapper;
                                action_bar_stack.visible_child = mapper_action_bar;
 
                                tester.stop ();
@@ -101,10 +101,6 @@ private class Games.KeyboardConfigurer : Gtk.Box {
        [GtkChild]
        private Gtk.Stack gamepad_view_stack;
        [GtkChild]
-       private Gtk.Box keyboard_mapper_holder;
-       [GtkChild]
-       private Gtk.Box keyboard_tester_holder;
-       [GtkChild]
        private Gtk.Stack action_bar_stack;
        [GtkChild]
        private Gtk.ActionBar tester_action_bar;
@@ -127,9 +123,9 @@ private class Games.KeyboardConfigurer : Gtk.Box {
 
        public KeyboardConfigurer () {
                mapper = new KeyboardMapper (KEYBOARD_GAMEPAD_VIEW_CONFIGURATION, KEYBOARD_GAMEPAD_INPUTS);
-               keyboard_mapper_holder.pack_start (mapper);
+               gamepad_view_stack.add (mapper);
                tester = new KeyboardTester (KEYBOARD_GAMEPAD_VIEW_CONFIGURATION);
-               keyboard_tester_holder.pack_start (tester);
+               gamepad_view_stack.add (tester);
                mapping_manager = new KeyboardMappingManager ();
 
                tester.mapping = mapping_manager.mapping;


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