[gnome-mines] Moved the overlay to the UI file



commit 5be79e4f2fbd1da412d6b079f7b89a55dd328a36
Author: Robert Roth <robert roth off gmail com>
Date:   Wed Apr 23 18:05:48 2014 +0300

    Moved the overlay to the UI file

 data/interface.ui    |   64 +++++++++++++++++++++++++-------------------------
 src/gnome-mines.vala |   13 +--------
 2 files changed, 34 insertions(+), 43 deletions(-)
---
diff --git a/data/interface.ui b/data/interface.ui
index 7daf1c4..5a57089 100644
--- a/data/interface.ui
+++ b/data/interface.ui
@@ -11,37 +11,6 @@
       <widget name="replay_button"/>
     </widgets>
   </object>
-  <object class="GtkAlignment" id="main_game_screen">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkBox" id="main_hbox">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="halign">center</property>
-        <property name="border_width">12</property>
-        <property name="spacing">12</property>
-        <child>
-          <object class="GtkOverlay" id="minefield_overlay">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="halign">end</property>
-            <child>
-              <placeholder/>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-    </child>
-  </object>
   <object class="GtkApplicationWindow" id="main_window">
     <property name="width_request">550</property>
     <property name="height_request">475</property>
@@ -79,7 +48,13 @@
                     <property name="shadow_type">none</property>
                     <property name="obey_child">False</property>
                     <child>
-                      <placeholder/>
+                      <object class="GtkOverlay" id="minefield_overlay">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
                     </child>
                   </object>
                   <packing>
@@ -455,4 +430,29 @@
       </object>
     </child>
   </object>
+  <object class="GtkBox" id="paused_box">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">12</property>
+    <child>
+      <object class="GtkLabel" id="paused_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="label" translatable="yes">Paused</property>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <style>
+      <class name="pausedOverlay"/>
+    </style>
+  </object>
 </interface>
diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
index 6b7b028..479ab31 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -175,23 +175,14 @@ public class Mines : Gtk.Application
         minefield_view = new MinefieldView (settings);
         minefield_view.show ();
 
-        minefield_overlay = new Gtk.Overlay ();
+        minefield_overlay = (Gtk.Overlay) ui_builder.get_object ("minefield_overlay");
         minefield_overlay.add (minefield_view);
         minefield_overlay.show ();
 
         minefield_aspect = (Gtk.AspectFrame) ui_builder.get_object ("minefield_aspect");
-        minefield_aspect.add (minefield_overlay);
         minefield_aspect.show ();
 
-        var paused_label = new Gtk.Label (_("Paused"));
-        paused_label.halign = Gtk.Align.CENTER;
-        paused_label.valign = Gtk.Align.CENTER;
-        paused_label.show ();
-
-        paused_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
-        paused_box.expand = true;
-        paused_box.pack_start (paused_label, true, true, 0);
-        paused_box.get_style_context ().add_class ("pausedOverlay");
+        paused_box = (Gtk.Box) ui_builder.get_object ("paused_box");
         paused_box.button_press_event.connect (view_button_press_event);
 
         minefield_overlay.add_overlay (paused_box);


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