[gnome-nibbles/wip/vala: 42/64] Add basic controls screen



commit 99de992716c58cbda477d4008e198a02af2bd23d
Author: Iulian Radu <iulian radu67 gmail com>
Date:   Sun Jul 12 15:59:58 2015 +0300

    Add basic controls screen

 data/nibbles.ui        |   58 ++++++++++++++++++++++++++++++++++++++++++++++-
 src/gnome-nibbles.vala |   18 ++++++++++-----
 2 files changed, 68 insertions(+), 8 deletions(-)
---
diff --git a/data/nibbles.ui b/data/nibbles.ui
index d7b314c..d826747 100644
--- a/data/nibbles.ui
+++ b/data/nibbles.ui
@@ -16,6 +16,8 @@
                         <property name="homogeneous">True</property>
                         <property name="margin">25</property>
                         <property name="expand">True</property>
+                        <property name="transition-type">5</property> <!-- SLIDE_UP -->
+                        <property name="transition-duration">500</property>
                         <child>
                             <object class="GtkBox" id="first_run">
                                 <property name="visible">True</property>
@@ -143,7 +145,7 @@
                                     </packing>
                                 </child>
                                 <child>
-                                    <object class="GtkRevealer" id="next_button_1_revealer">
+                                    <object class="GtkRevealer" id="next_button_revealer">
                                         <property name="visible">True</property>
                                         <property name="transition-type">4</property> <!-- SLIDE_UP -->
                                         <property name="transition-duration">500</property>
@@ -152,7 +154,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="use-underline">True</property>
                                                 <property name="label" translatable="yes">_Next</property>
-                                                <property name="action-name">app.start-game</property>
+                                                <property 
name="action-name">app.show-controls-screen</property>
                                                 <property name="halign">3</property>
                                                 <property name="valign">3</property>
                                                 <property name="width-request">140</property>
@@ -173,6 +175,58 @@
                                 <property name="name">number_of_players</property>
                             </packing>
                         </child>
+                        <child>
+                            <object class="GtkBox">
+                                <property name="visible">True</property>
+                                <property name="orientation">vertical</property>
+                                <property name="width-request">350</property>
+                                <property name="height-request">350</property>
+                                <child>
+                                    <object class="GtkLabel">
+                                        <property name="visible">True</property>
+                                        <property name="label" translatable="yes">Controls</property>
+                                        <property name="valign">3</property>
+                                        <style><class name="title"/></style>
+                                    </object>
+                                    <packing>
+                                        <property name="pack-type">start</property>
+                                    </packing>
+                                </child>
+                                <child>
+                                    <object class="GtkLabel">
+                                        <property name="visible">True</property>
+                                        <property name="label" translatable="yes">TODO</property>
+                                        <property name="valign">3</property>
+                                        <style><class name="title"/></style>
+                                    </object>
+                                    <packing>
+                                        <property name="pack-type">start</property>
+                                    </packing>
+                                </child>
+                                <child>
+                                    <object class="GtkButton">
+                                        <property name="visible">True</property>
+                                        <property name="use-underline">True</property>
+                                        <property name="label" translatable="yes">_Start</property>
+                                        <property name="action-name">app.start-game</property>
+                                        <property name="halign">3</property>
+                                        <property name="valign">3</property>
+                                        <property name="width-request">140</property>
+                                        <property name="height-request">40</property>
+                                        <style>
+                                            <class name="suggested-action"/>
+                                            <class name="play"/>
+                                        </style>
+                                    </object>
+                                    <packing>
+                                        <property name="pack-type">end</property>
+                                    </packing>
+                                </child>
+                            </object>
+                            <packing>
+                                <property name="name">controls</property>
+                            </packing>
+                        </child>
                     </object> <!-- End of main_stack -->
                     <packing>
                         <property name="pack-type">end</property>
diff --git a/src/gnome-nibbles.vala b/src/gnome-nibbles.vala
index 75c0db2..a82f3b2 100644
--- a/src/gnome-nibbles.vala
+++ b/src/gnome-nibbles.vala
@@ -32,7 +32,8 @@ public class Nibbles : Gtk.Application
     private Games.GridFrame frame;
 
     private Gee.LinkedList<Gtk.ToggleButton> number_of_players_buttons;
-    private Gtk.Revealer next_button_1_revealer;
+    private Gtk.Revealer next_button_revealer;
+
 
     private NibblesView? view;
     private NibblesGame? game = null;
@@ -45,7 +46,8 @@ public class Nibbles : Gtk.Application
 
     private const ActionEntry menu_entries[] =
     {
-        {"show-new-game-screen", show_new_game_screen_cb}
+        {"show-new-game-screen", show_new_game_screen_cb},
+        {"show-controls-screen", show_controls_screen_cb}
     };
 
     private static const OptionEntry[] option_entries =
@@ -115,7 +117,8 @@ public class Nibbles : Gtk.Application
             button.toggled.connect (change_number_of_players_cb);
             number_of_players_buttons.add (button);
         }
-        next_button_1_revealer = (Gtk.Revealer) builder.get_object ("next_button_1_revealer");
+        next_button_revealer = (Gtk.Revealer) builder.get_object ("next_button_revealer");
+
 
         window.set_titlebar (headerbar);
 
@@ -208,11 +211,14 @@ public class Nibbles : Gtk.Application
 
     private void show_new_game_screen_cb ()
     {
-        main_stack.set_transition_type (Gtk.StackTransitionType.SLIDE_UP);
-        main_stack.set_transition_duration (500);
         main_stack.set_visible_child_name ("number_of_players");
     }
 
+    private void show_controls_screen_cb ()
+    {
+        main_stack.set_visible_child_name ("controls");
+    }
+
     private void show_game_view ()
     {
         main_stack.set_visible_child_name ("frame");
@@ -268,7 +274,7 @@ public class Nibbles : Gtk.Application
         }
         else if (button.get_active () && !button.get_style_context ().has_class ("suggested-action"))
         {
-            next_button_1_revealer.set_reveal_child (true);
+            next_button_revealer.set_reveal_child (true);
             button.get_style_context ().add_class ("suggested-action");
             foreach (var other_button in number_of_players_buttons)
             {


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