[quadrapassel] Make preview area available at the start of the game (if it is enabled)



commit 264ae3269bfe452ec387275e5c1facd477a0871e
Author: Mario Wenzel <maweki gmail com>
Date:   Sun Nov 10 21:40:39 2013 +0100

    Make preview area available at the start of the game (if it is enabled)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710618

 src/preview.vala      |    3 ++-
 src/quadrapassel.vala |   13 ++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/preview.vala b/src/preview.vala
index 611a674..8e14ed3 100644
--- a/src/preview.vala
+++ b/src/preview.vala
@@ -88,7 +88,8 @@ public class Preview : GtkClutter.Embed
 
         if (game == null || game.next_shape == null || !enabled)
         {
-            set_visible(false);
+            // If the game is set up for preview but no preview is available, still show preview field
+            set_visible(enabled);
             return;
         }
 
diff --git a/src/quadrapassel.vala b/src/quadrapassel.vala
index 7605a1d..de6b2c3 100644
--- a/src/quadrapassel.vala
+++ b/src/quadrapassel.vala
@@ -487,15 +487,22 @@ public class Quadrapassel : Gtk.Application
 
     private void do_preview_toggle_toggled_cb ()
     {
-        var do_preview = do_preview_toggle.get_active ();
-        settings.set_boolean ("do-preview", do_preview);
-        preview.enabled = do_preview;
+        settings.set_boolean ("do-preview", do_preview_toggle.get_active ());
+        update_preview_settings ();
     }
 
     private void difficult_blocks_toggled_cb ()
     {
         settings.set_boolean ("pick-difficult-blocks", difficult_blocks_toggle.get_active ());
         do_preview_toggle.set_sensitive(!settings.get_boolean ("pick-difficult-blocks"));
+        update_preview_settings ();
+    }
+
+    private void update_preview_settings ()
+    {
+        var do_preview = do_preview_toggle.get_active ();
+        var difficult_block_mode = difficult_blocks_toggle.get_active ();
+        preview.enabled = do_preview && !difficult_block_mode;
     }
 
     private void set_rotate_counter_clock_wise ()


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