[cheese/wip/hans-fixes: 29/35] cheese: Make widemode controllable from the app menu



commit 8d3cd05fd27df003032a6913292ed4604100a02e
Author: Hans de Goede <hdegoede redhat com>
Date:   Thu Jun 13 09:40:18 2013 +0200

    cheese: Make widemode controllable from the app menu
    
    Signed-off-by: Hans de Goede <hdegoede redhat com>

 src/cheese-main.vala |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/cheese-main.vala b/src/cheese-main.vala
index 032e8cb..2adfdc0 100644
--- a/src/cheese-main.vala
+++ b/src/cheese-main.vala
@@ -49,6 +49,7 @@ public class Cheese.Main : Gtk.Application
         { "shoot", on_shoot },
         { "mode", on_action_radio, "s", "'photo'", on_mode_change },
         { "fullscreen", on_action_toggle, null, "false", on_fullscreen_change },
+        { "widemode", on_action_toggle, null, "false", on_widemode_change },
         { "effects", on_action_toggle, null, "false", on_effects_change },
         { "preferences", on_preferences },
         { "about", on_about },
@@ -103,6 +104,9 @@ public class Cheese.Main : Gtk.Application
             item = new GLib.MenuItem (_("_Fullscreen"), "app.fullscreen");
             item.set_attribute ("accel", "s", "F11");
             section.append_item (item);
+            item = new GLib.MenuItem (_("_Wide Mode"), "app.widemode");
+            item.set_attribute ("accel", "s", "w");
+            section.append_item (item);
             section = new GLib.Menu ();
             menu.append_section (null, section);
             section.append (_("_Effects"), "app.effects");
@@ -126,7 +130,7 @@ public class Cheese.Main : Gtk.Application
       main_window.start_thumbview_monitors ();
 
       if (wide)
-        main_window.set_wide_mode (true);
+        change_action_state("widemode", true);
       if (fullscreen)
         change_action_state("fullscreen", true);
 
@@ -324,6 +328,23 @@ public class Cheese.Main : Gtk.Application
     }
 
     /**
+     * Handle wide mode being toggled on / off.
+     *
+     * @param action the action that emitted the signal
+     * @param value the state to switch to
+     */
+    private void on_widemode_change (SimpleAction action, Variant? value)
+    {
+        return_if_fail (value != null);
+
+        var state = value.get_boolean ();
+
+        main_window.set_wide_mode (state);
+
+        action.set_state (value);
+    }
+
+    /**
      * Handle the effects state being changed.
      *
      * @param action the action that emitted the signal


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