65a8849
From 29a1bab965e67b39eb0eef44038a1400d6de6029 Mon Sep 17 00:00:00 2001
65a8849
From: Hans de Goede <hdegoede@redhat.com>
65a8849
Date: Wed, 12 Jun 2013 17:26:25 +0200
65a8849
Subject: [PATCH 25/35] cheese: Remove last remnants of the old menu code
65a8849
65a8849
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
65a8849
---
65a8849
 data/cheese-actions.ui | 18 -----------
65a8849
 src/cheese-window.vala | 85 +++++++++++++++++---------------------------------
65a8849
 2 files changed, 29 insertions(+), 74 deletions(-)
65a8849
65a8849
diff --git a/data/cheese-actions.ui b/data/cheese-actions.ui
65a8849
index 2374c36..8657c08 100644
65a8849
--- a/data/cheese-actions.ui
65a8849
+++ b/data/cheese-actions.ui
65a8849
@@ -46,24 +46,6 @@
65a8849
           </object>
65a8849
           <accelerator key="Delete" modifiers="GDK_SHIFT_MASK"/>
65a8849
         </child>
65a8849
-        <child>
65a8849
-          <object class="GtkAction" id="move_all_to_trash">
65a8849
-            <property name="name">RemoveAll</property>
65a8849
-            <property name="label" translatable="yes">Move _All to Trash</property>
65a8849
-            <signal name="activate" handler="cheese_main_window_on_file_move_to_trash_all"/>
65a8849
-          </object>
65a8849
-        </child>
65a8849
-      </object>
65a8849
-    </child>
65a8849
-    <child>
65a8849
-      <object class="GtkActionGroup" id="layout_actions">
65a8849
-        <child>
65a8849
-          <object class="GtkToggleAction" id="wide_mode">
65a8849
-            <property name="name">WideMode</property>
65a8849
-            <property name="label" translatable="yes">_Wide Mode</property>
65a8849
-            <signal name="toggled" handler="cheese_main_window_on_layout_wide_mode"/>
65a8849
-          </object>
65a8849
-        </child>
65a8849
       </object>
65a8849
     </child>
65a8849
     <child>
65a8849
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
65a8849
index e8ccb47..6425a7f 100644
65a8849
--- a/src/cheese-window.vala
65a8849
+++ b/src/cheese-window.vala
65a8849
@@ -79,7 +79,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
65a8849
   private List<Clutter.Box> effects_grids;
65a8849
 
65a8849
   private HashTable<string, bool> action_sensitivities;
65a8849
-  private Gtk.ToggleAction wide_mode_action;
65a8849
   private Gtk.Action       countdown_action;
65a8849
   private Gtk.Action       effects_page_prev_action;
65a8849
   private Gtk.Action       effects_page_next_action;
65a8849
@@ -494,41 +493,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
65a8849
   }
65a8849
 
65a8849
   /**
65a8849
-   * Toggle wide mode and save the preference to GSettings.
65a8849
-   *
65a8849
-   * @param action the action that emitted the signal
65a8849
-   */
65a8849
-  [CCode (instance_pos = -1)]
65a8849
-  public void on_layout_wide_mode (ToggleAction action)
65a8849
-  {
65a8849
-    if (!is_command_line_startup)
65a8849
-    {
65a8849
-     /* Don't save to settings when using -w mode from command-line, so
65a8849
-      * command-line options change the mode for one run only. */
65a8849
-      settings.set_boolean ("wide-mode", action.active);
65a8849
-    }
65a8849
-    set_wide_mode (action.active);
65a8849
-  }
65a8849
-
65a8849
-    /**
65a8849
-     * Toggle fullscreen mode and save the preference to GSettings.
65a8849
-     *
65a8849
-     * @param fullscreen whether the window should be fullscreean
65a8849
-     */
65a8849
-    [CCode (instance_pos = -1)]
65a8849
-    public void set_fullscreen (bool fullscreen)
65a8849
-    {
65a8849
-        if (!is_command_line_startup)
65a8849
-        {
65a8849
-            /* Don't save to settings when using -f mode from command-line, so
65a8849
-             * command-line options change the mode for one run only. */
65a8849
-            settings.set_boolean ("fullscreen", fullscreen);
65a8849
-        }
65a8849
-
65a8849
-        set_fullscreen_mode (fullscreen);
65a8849
-    }
65a8849
-
65a8849
-  /**
65a8849
    * Make the media capture mode actions sensitive.
65a8849
    */
65a8849
   private void enable_mode_change ()
65a8849
@@ -657,19 +621,28 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
65a8849
   }
65a8849
 
65a8849
   /**
65a8849
-   * Enable or disable fullscreen mode to the requested state.
65a8849
+   * Enable or disable fullscreen mode
65a8849
    *
65a8849
-   * @param fullscreen_mode whether to enable or disable fullscreen mode
65a8849
+   * @param fullscreen whether the window should be fullscreean
65a8849
    */
65a8849
-  private void set_fullscreen_mode (bool fullscreen_mode)
65a8849
+  [CCode (instance_pos = -1)]
65a8849
+  public void set_fullscreen (bool fullscreen)
65a8849
   {
65a8849
     /* After the first time the window has been shown using this.show_all (),
65a8849
      * the value of leave_fullscreen_button_container.no_show_all should be set to false
65a8849
      * So that the next time leave_fullscreen_button_container.show_all () is called, the button is actually shown
65a8849
      * FIXME: If this code can be made cleaner/clearer, please do */
65a8849
 
65a8849
-    is_fullscreen = fullscreen_mode;
65a8849
-    if (fullscreen_mode)
65a8849
+    is_fullscreen = fullscreen;
65a8849
+
65a8849
+    if (!is_command_line_startup)
65a8849
+    {
65a8849
+      /* Don't save to settings when using -f mode from command-line, so
65a8849
+       * command-line options change the mode for one run only. */
65a8849
+      settings.set_boolean ("fullscreen", is_fullscreen);
65a8849
+    }
65a8849
+
65a8849
+    if (is_fullscreen)
65a8849
     {
65a8849
       if (is_wide_mode)
65a8849
       {
65a8849
@@ -722,14 +695,23 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
65a8849
   }
65a8849
 
65a8849
   /**
65a8849
-   * Enable or disable wide mode to the requested state.
65a8849
+   * Enable or disable wide mode to the requested state and save the
65a8849
+   * preference to GSettings.
65a8849
    *
65a8849
    * @param wide_mode whether to enable or disable wide mode
65a8849
    */
65a8849
-  private void set_wide_mode (bool wide_mode)
65a8849
+  [CCode (instance_pos = -1)]
65a8849
+  public void set_wide_mode (bool wide_mode)
65a8849
   {
65a8849
     is_wide_mode = wide_mode;
65a8849
 
65a8849
+    if (!is_command_line_startup)
65a8849
+    {
65a8849
+     /* Don't save to settings when using -w mode from command-line, so
65a8849
+      * command-line options change the mode for one run only. */
65a8849
+      settings.set_boolean ("wide-mode", is_wide_mode);
65a8849
+    }
65a8849
+
65a8849
     /* keep the viewport to its current size while rearranging the ui,
65a8849
      * so that thumbview moves from right to bottom and viceversa
65a8849
      * while the rest of the window stays unchanged */
65a8849
@@ -1298,13 +1280,12 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
65a8849
 
65a8849
           /* Keep only these actions sensitive. */
65a8849
           string [] active_actions = { "quit",
65a8849
-                                       "help_contents",
65a8849
+                                       "help",
65a8849
                                        "about",
65a8849
                                        "open",
65a8849
                                        "save_as",
65a8849
                                        "move_to_trash",
65a8849
-                                       "delete",
65a8849
-                                       "move_all_to_trash"};
65a8849
+                                       "delete"};
65a8849
 
65a8849
           /* Gross hack because Vala's `in` operator doesn't really work */
65a8849
           bool flag;
65a8849
@@ -1358,7 +1339,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
65a8849
     }
65a8849
 
65a8849
     is_command_line_startup = true;
65a8849
-    wide_mode_action.set_active (true);
65a8849
+    set_wide_mode (true);
65a8849
     is_command_line_startup = false;
65a8849
   }
65a8849
 
65a8849
@@ -1414,7 +1395,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
65a8849
     thumbnail_popup                   = gtk_builder.get_object ("thumbnail_popup") as Gtk.Menu;
65a8849
 
65a8849
     countdown_action         = gtk_builder.get_object ("countdown") as Gtk.Action;
65a8849
-    wide_mode_action         = gtk_builder.get_object ("wide_mode") as Gtk.ToggleAction;
65a8849
     effects_page_next_action = gtk_builder.get_object ("effects_page_next") as Gtk.Action;
65a8849
     effects_page_prev_action = gtk_builder.get_object ("effects_page_prev") as Gtk.Action;
65a8849
     share_action             = gtk_builder.get_object ("share") as Gtk.Action;
65a8849
@@ -1477,14 +1457,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
65a8849
      * if the widget is not realized */
65a8849
     viewport_widget.realize ();
65a8849
 
65a8849
-    /* call set_active instead of our set_wide_mode so that the toggle
65a8849
-     * action state is updated */
65a8849
-    wide_mode_action.set_active (settings.get_boolean ("wide-mode"));
65a8849
-
65a8849
-    /* apparently set_active doesn't emit toggled nothing has
65a8849
-     * changed, do it manually */
65a8849
-    if (!settings.get_boolean ("wide-mode"))
65a8849
-      wide_mode_action.toggled ();
65a8849
+    set_wide_mode (settings.get_boolean ("wide-mode"));
65a8849
 
65a8849
     set_mode (MediaMode.PHOTO);
65a8849
     setup_effects_selector ();
65a8849
-- 
65a8849
1.8.2.1
65a8849