[shotwell] Remeber "pin toolbar" state in fullscreen: Closes bgo#719111



commit f5609d893cd23b9d581925d7c366cf11353b076c
Author: Wolfgang Steitz <wolfer7 web de>
Date:   Tue Mar 4 12:25:14 2014 -0800

    Remeber "pin toolbar" state in fullscreen: Closes bgo#719111

 misc/org.yorba.shotwell.gschema.xml     |    6 ++++++
 src/AppWindow.vala                      |    7 ++++++-
 src/config/ConfigurationInterfaces.vala |   24 ++++++++++++++++++++++++
 src/config/GSettingsEngine.vala         |    2 ++
 4 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/misc/org.yorba.shotwell.gschema.xml b/misc/org.yorba.shotwell.gschema.xml
index 4c7e649..e0e9448 100644
--- a/misc/org.yorba.shotwell.gschema.xml
+++ b/misc/org.yorba.shotwell.gschema.xml
@@ -142,6 +142,12 @@
         <summary>photo thumbnail scale</summary>
         <description>The scale of photo thumbnails, ranging from 72 to 360.</description>
     </key>
+
+    <key name="pin-toolbar-state" type="b">
+        <default>false</default>
+        <summary>pin toolbar state</summary>
+        <description>Pin toolbar in fullscreen, or not.</description>
+    </key>
     
     <key name="background-color" type="s">
         <default>'#444'</default>
diff --git a/src/AppWindow.vala b/src/AppWindow.vala
index 79b8901..f628383 100644
--- a/src/AppWindow.vala
+++ b/src/AppWindow.vala
@@ -16,7 +16,7 @@ public class FullscreenWindow : PageWindow {
     private bool waiting_for_invoke = false;
     private time_t left_toolbar_time = 0;
     private bool switched_to = false;
-    private bool is_toolbar_dismissal_enabled = true;
+    private bool is_toolbar_dismissal_enabled;
 
     public FullscreenWindow(Page page) {
         set_current_page(page);
@@ -45,9 +45,13 @@ public class FullscreenWindow : PageWindow {
         move(monitor.x, monitor.y);
         
         set_border_width(0);
+
+        // restore pin state
+        is_toolbar_dismissal_enabled = Config.Facade.get_instance().get_pin_toolbar_state();
         
         pin_button.set_label(_("Pin Toolbar"));
         pin_button.set_tooltip_text(_("Pin the toolbar open"));
+        pin_button.set_active(!is_toolbar_dismissal_enabled);
         pin_button.clicked.connect(update_toolbar_dismissal);
         
         close_button.set_tooltip_text(_("Leave fullscreen"));
@@ -150,6 +154,7 @@ public class FullscreenWindow : PageWindow {
     }
     
     private void on_close() {
+        Config.Facade.get_instance().set_pin_toolbar_state(is_toolbar_dismissal_enabled);
         hide_toolbar();
         toolbar_window = null;
         
diff --git a/src/config/ConfigurationInterfaces.vala b/src/config/ConfigurationInterfaces.vala
index a69e770..97f41cc 100644
--- a/src/config/ConfigurationInterfaces.vala
+++ b/src/config/ConfigurationInterfaces.vala
@@ -59,6 +59,7 @@ public enum ConfigurableProperty {
     LIBRARY_WINDOW_WIDTH,
     MODIFY_ORIGINALS,
     PHOTO_THUMBNAIL_SCALE,
+    PIN_TOOLBAR_STATE,
     PRINTING_CONTENT_HEIGHT,
     PRINTING_CONTENT_LAYOUT,
     PRINTING_CONTENT_PPI,
@@ -202,6 +203,9 @@ public enum ConfigurableProperty {
             case PHOTO_THUMBNAIL_SCALE:
                 return "PHOTO_THUMBNAIL_SCALE";
                 
+            case PIN_TOOLBAR_STATE:
+                return "PIN_TOOLBAR_STATE";
+                
             case PRINTING_CONTENT_HEIGHT:
                 return "PRINTING_CONTENT_HEIGHT";
 
@@ -900,7 +904,27 @@ public abstract class ConfigurationFacade : Object {
             on_configuration_error(err);
         }
     }
+    
+    //
+    // pin toolbar state
+    //
+    public virtual bool get_pin_toolbar_state() {
+        try {
+            return get_engine().get_bool_property(ConfigurableProperty.PIN_TOOLBAR_STATE);
+        } catch (ConfigurationError err) {
+            on_configuration_error(err);
+            return false;
+        }
+    }
 
+    public virtual void set_pin_toolbar_state(bool state) {
+        try {
+            get_engine().set_bool_property(ConfigurableProperty.PIN_TOOLBAR_STATE, state);
+        } catch (ConfigurationError err) {
+            on_configuration_error(err);
+        }
+    }
+    
     //
     // last crop height
     //
diff --git a/src/config/GSettingsEngine.vala b/src/config/GSettingsEngine.vala
index b178014..3a55648 100644
--- a/src/config/GSettingsEngine.vala
+++ b/src/config/GSettingsEngine.vala
@@ -72,6 +72,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
         schema_names[ConfigurableProperty.LIBRARY_WINDOW_WIDTH] = WINDOW_PREFS_SCHEMA_NAME;
         schema_names[ConfigurableProperty.MODIFY_ORIGINALS] = UI_PREFS_SCHEMA_NAME;
         schema_names[ConfigurableProperty.PHOTO_THUMBNAIL_SCALE] = UI_PREFS_SCHEMA_NAME;
+        schema_names[ConfigurableProperty.PIN_TOOLBAR_STATE] = UI_PREFS_SCHEMA_NAME;
         schema_names[ConfigurableProperty.PRINTING_CONTENT_HEIGHT] = PRINTING_SCHEMA_NAME;
         schema_names[ConfigurableProperty.PRINTING_CONTENT_LAYOUT] = PRINTING_SCHEMA_NAME;
         schema_names[ConfigurableProperty.PRINTING_CONTENT_PPI] = PRINTING_SCHEMA_NAME;
@@ -134,6 +135,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
         key_names[ConfigurableProperty.LIBRARY_WINDOW_WIDTH] = "library-width";
         key_names[ConfigurableProperty.MODIFY_ORIGINALS] = "modify-originals";
         key_names[ConfigurableProperty.PHOTO_THUMBNAIL_SCALE] = "photo-thumbnail-scale";
+        key_names[ConfigurableProperty.PIN_TOOLBAR_STATE] = "pin-toolbar-state";
         key_names[ConfigurableProperty.PRINTING_CONTENT_HEIGHT] = "content-height";
         key_names[ConfigurableProperty.PRINTING_CONTENT_LAYOUT] = "content-layout";
         key_names[ConfigurableProperty.PRINTING_CONTENT_PPI] = "content-ppi";


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