[cheese/wip/gtkapplication-refactor: 5/9] Remove wide-mode and fullscreen GSettings keys



commit 7b816647d3ae9ce8975ac5aaf014f78f4da28794
Author: David King <amigadave amigadave com>
Date:   Sat Jun 29 16:48:46 2013 +0100

    Remove wide-mode and fullscreen GSettings keys
    
    Both wide mode and fullscreen mode can be set with toggle actions, and
    there is little reason for the state to persist across application
    restart.

 data/cheese-actions.ui            |   11 -----
 data/org.gnome.Cheese.gschema.xml |   12 ------
 src/cheese-application.vala       |    2 -
 src/cheese-window.vala            |   75 +++----------------------------------
 4 files changed, 6 insertions(+), 94 deletions(-)
---
diff --git a/data/cheese-actions.ui b/data/cheese-actions.ui
index 9e9ff4d..e80ab13 100644
--- a/data/cheese-actions.ui
+++ b/data/cheese-actions.ui
@@ -48,17 +48,6 @@
       </object>
     </child>
     <child>
-      <object class="GtkActionGroup" id="layout_actions">
-        <child>
-          <object class="GtkToggleAction" id="wide_mode">
-            <property name="name">WideMode</property>
-            <property name="label" translatable="yes">_Wide Mode</property>
-            <signal name="toggled" handler="cheese_main_window_on_layout_wide_mode"/>
-          </object>
-        </child>
-      </object>
-    </child>
-    <child>
       <object class="GtkActionGroup" id="effects_actions">
         <child>
           <object class="GtkAction" id="effects_page_prev">
diff --git a/data/org.gnome.Cheese.gschema.xml b/data/org.gnome.Cheese.gschema.xml
index b8a39f6..12cc4ee 100644
--- a/data/org.gnome.Cheese.gschema.xml
+++ b/data/org.gnome.Cheese.gschema.xml
@@ -100,18 +100,6 @@
       <default>''</default>
     </key>
 
-    <key type='b' name='wide-mode'>
-      <summary>Whether to start in wide mode</summary>
-      <description>If set to true, Cheese will start up in wide mode, with the image collection placed on 
the right-hand side. Useful with small screens.</description>
-      <default>false</default>
-    </key>
-
-    <key type='b' name='fullscreen'>
-      <summary>Whether to start in fullscreen</summary>
-      <description>If set to true, Cheese will start up in fullscreen mode.</description>
-      <default>false</default>
-    </key>
-
     <key type='i' name='burst-delay'>
       <summary>Time between photos in burst mode</summary>
       <description>The length of time, in milliseconds, to delay between taking each photo in a burst 
sequence of photos. If the burst delay is less than the countdown duration, the countdown duration will be 
used instead.</description>
diff --git a/src/cheese-application.vala b/src/cheese-application.vala
index 80b3a27..069b1da 100644
--- a/src/cheese-application.vala
+++ b/src/cheese-application.vala
@@ -434,7 +434,6 @@ public class Cheese.Application : Gtk.Application
 
         main_window.set_fullscreen (state);
 
-        settings.set_boolean ("fullscreen", state);
         action.set_state (value);
     }
 
@@ -455,7 +454,6 @@ public class Cheese.Application : Gtk.Application
 
         main_window.set_wide_mode (state);
 
-        settings.set_boolean ("wide-mode", state);
         action.set_state (value);
     }
 
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 1f094d9..6852ebd 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -73,7 +73,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
   private List<Clutter.Actor> effects_grids;
 
   private HashTable<string, bool> action_sensitivities;
-  private Gtk.ToggleAction wide_mode_action;
   private Gtk.Action       countdown_action;
   private Gtk.Action       effects_page_prev_action;
   private Gtk.Action       effects_page_next_action;
@@ -85,7 +84,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
   private bool is_effects_selector_active;
   private bool is_camera_actions_sensitive;
   private bool action_cancelled;
-  private bool is_command_line_startup;
 
   private Gtk.Button[] buttons;
 
@@ -411,38 +409,13 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
     save_as_dialog.destroy ();
   }
 
-  /**
-   * Toggle wide mode and save the preference to GSettings.
-   *
-   * @param action the action that emitted the signal
-   */
-  [CCode (instance_pos = -1)]
-  public void on_layout_wide_mode (ToggleAction action)
-  {
-    if (!is_command_line_startup)
-    {
-     /* Don't save to settings when using -w mode from command-line, so
-      * command-line options change the mode for one run only. */
-      settings.set_boolean ("wide-mode", action.active);
-    }
-    set_wide_mode (action.active);
-  }
-
     /**
-     * Toggle fullscreen mode and save the preference to GSettings.
+     * Toggle fullscreen mode.
      *
-     * @param fullscreen whether the window should be fullscreean
+     * @param fullscreen whether the window should be fullscreen
      */
-    [CCode (instance_pos = -1)]
     public void set_fullscreen (bool fullscreen)
     {
-        if (!is_command_line_startup)
-        {
-            /* Don't save to settings when using -f mode from command-line, so
-             * command-line options change the mode for one run only. */
-            settings.set_boolean ("fullscreen", fullscreen);
-        }
-
         set_fullscreen_mode (fullscreen);
     }
 
@@ -569,15 +542,15 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
    *
    * @param fullscreen_mode whether to enable or disable fullscreen mode
    */
-  private void set_fullscreen_mode (bool fullscreen_mode)
+  private void set_fullscreen_mode (bool fullscreen)
   {
     /* After the first time the window has been shown using this.show_all (),
      * the value of leave_fullscreen_button_container.no_show_all should be set to false
      * 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 */
 
-    is_fullscreen = fullscreen_mode;
-    if (fullscreen_mode)
+    is_fullscreen = fullscreen;
+    if (fullscreen)
     {
       if (is_wide_mode)
       {
@@ -1292,34 +1265,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
     }
 
   /**
-   * Set wide mode active when started from the command line (and do not change
-   * the GSetting).
-   */
-  public void set_startup_wide_mode ()
-  {
-    if (is_wide_mode)
-    {
-      /* Cheese was already in wide mode, avoid setting it again. */
-      return;
-    }
-
-    is_command_line_startup = true;
-    wide_mode_action.set_active (true);
-    is_command_line_startup = false;
-  }
-
-  /**
-   * Set fullscreen mode active when started from the command line (and do not
-   * change the GSetting).
-   */
-  public void set_startup_fullscreen_mode ()
-  {
-    is_command_line_startup = true;
-    set_fullscreen (true);
-    is_command_line_startup = false;
-  }
-
-  /**
    * Load the UI from the GtkBuilder description.
    */
   public void setup_ui ()
@@ -1360,7 +1305,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
     thumbnail_popup                   = gtk_builder.get_object ("thumbnail_popup") as Gtk.Menu;
 
     countdown_action         = gtk_builder.get_object ("countdown") as Gtk.Action;
-    wide_mode_action         = gtk_builder.get_object ("wide_mode") as Gtk.ToggleAction;
     effects_page_next_action = gtk_builder.get_object ("effects_page_next") as Gtk.Action;
     effects_page_prev_action = gtk_builder.get_object ("effects_page_prev") as Gtk.Action;
 
@@ -1416,14 +1360,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
      * if the widget is not realized */
     viewport_widget.realize ();
 
-    /* call set_active instead of our set_wide_mode so that the toggle
-     * action state is updated */
-    wide_mode_action.set_active (settings.get_boolean ("wide-mode"));
-
-    /* apparently set_active doesn't emit toggled nothing has
-     * changed, do it manually */
-    if (!settings.get_boolean ("wide-mode"))
-      wide_mode_action.toggled ();
+    set_wide_mode (false);
 
     set_mode (MediaMode.PHOTO);
     setup_effects_selector ();


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