Blob Blame History Raw
From 6bd6f3b72eef27eee71b67755ad98490e20df6ee Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 11 Jun 2013 13:09:39 +0200
Subject: [PATCH 22/50] cheese-window: Make mode-toggle and effects button
 inactive when recording

While at it also fixup the indentation of enable_mode_change / disable, to
be 2 spaces like most other code in cheese-window.vala.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 src/cheese-window.vala | 43 ++++++++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 15 deletions(-)

diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 9ebb5e1..2e4e5a8 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -527,23 +527,37 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
         set_fullscreen_mode (fullscreen);
     }
 
-    /**
-     * Make the media capture mode actions sensitive.
-     */
-    private void enable_mode_change ()
-    {
-        // FIXME: Set the mode action to be sensitive
-        // FIXME: Set the effects action to be sensitive.
-    }
+  /**
+   * Make the media capture mode actions sensitive.
+   */
+  private void enable_mode_change ()
+  {
+    var mode = this.application.lookup_action ("mode") as SimpleAction;
+    mode.set_enabled (true);    
 
-    /**
-     * Make the media capture mode actions insensitive.
-     */
-    private void disable_mode_change ()
+    var effects = this.application.lookup_action ("effects") as SimpleAction;
+    effects.set_enabled (true);    
+  }
+
+  /**
+   * Make the media capture mode actions insensitive.
+   */
+  private void disable_mode_change ()
+  {
+    var mode = this.application.lookup_action ("mode") as SimpleAction;
+    mode.set_enabled (false);    
+
+    /* Allow changing the effects while recording a video */
+    if (current_mode != MediaMode.VIDEO)
     {
-        // FIXME: Set the mode action to be sensitive
-        // FIXME: Set the effects action to be insensitive.
+      var effects = this.application.lookup_action ("effects") as SimpleAction;
+      effects.set_enabled (false);    
+      if (is_effects_selector_active)
+      {
+        effects_toggle_button.set_active (false);
+      }
     }
+  }
 
   /**
    * Set the capture resolution, based on the current capture mode.
@@ -966,7 +980,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
     {
       is_bursting = true;
       this.disable_mode_change ();
-      // FIXME: Set the effects action to be inactive.
       take_action_button_label.label  = "<b>" + _("Stop _Taking Pictures") + "</b>";
       take_action_button.tooltip_text = _("Stop taking pictures");
       burst_take_photo ();
-- 
1.8.2.1