[quadrapassel] Added frame around preview area



commit 50d7034193f25105d266f1c81a7d5e89faa0456b
Author: Mario Wenzel <maweki gmail com>
Date:   Tue Nov 19 09:37:14 2013 +0100

    Added frame around preview area
    
    As part of the new design explained in
    https://bugzilla.gnome.org/show_bug.cgi?id=710618

 src/preview.vala      |   15 ++++++++++++++-
 src/quadrapassel.vala |   10 +++++++---
 2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/preview.vala b/src/preview.vala
index 8e14ed3..f75c2a7 100644
--- a/src/preview.vala
+++ b/src/preview.vala
@@ -16,6 +16,8 @@ public class Preview : GtkClutter.Embed
     /* Clutter representation of a piece */
     private Clutter.Actor? piece = null;
 
+    private Gtk.Frame? parent_frame = null;
+
     public string theme
     {
         set
@@ -52,10 +54,12 @@ public class Preview : GtkClutter.Embed
         set { _enabled = value; update_block (); }
     }
 
-    public Preview ()
+    public Preview (Gtk.Frame? parent)
     {
         size_allocate.connect (size_allocate_cb);
 
+        parent_frame = parent;
+
         /* FIXME: We should scale with the rest of the UI, but that requires
          * changes to the widget layout - i.e. wrap the preview in an
          * fixed-aspect box. */
@@ -124,6 +128,15 @@ public class Preview : GtkClutter.Embed
         piece.restore_easing_state ();
     }
 
+    public void set_visible(bool visible)
+    {
+        base.set_visible (visible);
+        if (parent_frame != null)
+        {
+            parent_frame.set_visible (visible);
+        }
+    }
+
     private void size_allocate_cb (Gtk.Allocation allocation)
     {
         foreach (var texture in block_textures)
diff --git a/src/quadrapassel.vala b/src/quadrapassel.vala
index acfb0bd..69afb0e 100644
--- a/src/quadrapassel.vala
+++ b/src/quadrapassel.vala
@@ -174,11 +174,15 @@ public class Quadrapassel : Gtk.Application
         vb2.show ();
         hb.pack_end (vb2, true, false, 0);
 
-        preview = new Preview ();
+        var preview_frame = new Gtk.Frame (_("Next:"));
+        preview_frame.set_label_align (0.5f, 1.0f);
+        preview = new Preview (preview_frame);
         preview.theme = settings.get_string ("theme");
         preview.enabled = settings.get_boolean ("do-preview");
+        preview_frame.add (preview);
+        preview_frame.show ();
         preview.show ();
-        vb2.pack_start (preview, false, false, 0);
+        vb2.pack_start (preview_frame, false, false, 0);
 
         var score_grid = new Gtk.Grid ();
         score_grid.set_row_homogeneous (true);
@@ -476,7 +480,7 @@ public class Quadrapassel : Gtk.Application
 
         theme_combo.changed.connect (theme_combo_changed_cb);
 
-        theme_preview = new Preview ();
+        theme_preview = new Preview (null);
         theme_preview.game = new Game ();
         theme_preview.theme = settings.get_string ("theme");
         vbox.pack_start (theme_preview, true, true, 0);


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