[cheese/wip/hans-fixes: 26/35] cheese: Protect set_wide_mode / set_fullscreen against double calls



commit 36c638e42d252dbf3a640c05b278629460b31a8c
Author: Hans de Goede <hdegoede redhat com>
Date:   Wed Jun 12 17:54:02 2013 +0200

    cheese: Protect set_wide_mode / set_fullscreen against double calls
    
    Make it safe to call set_wide_mode / set_fullscreen twice with the same
    value.
    
    Signed-off-by: Hans de Goede <hdegoede redhat com>

 src/cheese-window.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 6425a7f..906105b 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -86,6 +86,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
 
   private bool is_fullscreen;
   private bool is_wide_mode;
+  private bool is_wide_mode_initialized;
   private bool is_recording;       /* Video Recording Flag */
   private bool is_bursting;
   private bool is_effects_selector_active;
@@ -633,6 +634,10 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
      * So that the next time leave_fullscreen_button_container.show_all () is called, the button is actually 
shown
      * FIXME: If this code can be made cleaner/clearer, please do */
 
+    if (is_fullscreen == fullscreen)
+    {
+      return;
+    }
     is_fullscreen = fullscreen;
 
     if (!is_command_line_startup)
@@ -703,6 +708,11 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
   [CCode (instance_pos = -1)]
   public void set_wide_mode (bool wide_mode)
   {
+    if (is_wide_mode_initialized && is_wide_mode == wide_mode)
+    {
+      return;
+    }
+    is_wide_mode_initialized = true;
     is_wide_mode = wide_mode;
 
     if (!is_command_line_startup)


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