[shotwell/wip/libdazzle] Persist extended properties width



commit 1a1d1bfa3a9245f78bb3f994a1c5dc03911fb1c9
Author: Jens Georg <mail jensge org>
Date:   Sat Apr 4 14:51:57 2020 +0200

    Persist extended properties width

 data/gsettings/org.yorba.shotwell.gschema.xml |  6 ++++++
 src/Properties.vala                           |  5 +++++
 src/config/ConfigurationInterfaces.vala       | 22 ++++++++++++++++++++++
 src/config/GSettingsEngine.vala               |  2 ++
 src/library/LibraryWindow.vala                | 27 +++++++++++++++------------
 5 files changed, 50 insertions(+), 12 deletions(-)
---
diff --git a/data/gsettings/org.yorba.shotwell.gschema.xml b/data/gsettings/org.yorba.shotwell.gschema.xml
index 4c5d3947..70f4efce 100644
--- a/data/gsettings/org.yorba.shotwell.gschema.xml
+++ b/data/gsettings/org.yorba.shotwell.gschema.xml
@@ -150,6 +150,12 @@
         <description>The width, in pixels, of the sidebar</description>
     </key>
 
+    <key name="extended-properties-position" type="i">
+        <default>360</default>
+        <summary>extended properties positions</summary>
+        <description>The width, in pixels of the extended properties sidebar.</description>
+    </key>
+
     <key name="photo-thumbnail-scale" type="i">
         <default>128</default>
         <summary>photo thumbnail scale</summary>
diff --git a/src/Properties.vala b/src/Properties.vala
index 1b4d0efe..206081d7 100644
--- a/src/Properties.vala
+++ b/src/Properties.vala
@@ -497,6 +497,11 @@ private class ExtendedProperties : Properties {
     public ExtendedProperties() {
         base();
         grid.row_spacing = 6;
+        vexpand = true;
+        set_margin_top(9);
+        set_margin_bottom(9);
+        set_margin_start(9);
+        set_margin_end(9);
     }
 
     // Event stuff
diff --git a/src/config/ConfigurationInterfaces.vala b/src/config/ConfigurationInterfaces.vala
index 195a28f7..563cc93a 100644
--- a/src/config/ConfigurationInterfaces.vala
+++ b/src/config/ConfigurationInterfaces.vala
@@ -85,6 +85,7 @@ public enum ConfigurableProperty {
     RAW_DEVELOPER_DEFAULT,
     SHOW_WELCOME_DIALOG,
     SIDEBAR_POSITION,
+    EXTENDED_PROPERTIES_POSITION,
     SLIDESHOW_DELAY,
     SLIDESHOW_TRANSITION_DELAY,
     SLIDESHOW_TRANSITION_EFFECT_ID,
@@ -292,6 +293,9 @@ public enum ConfigurableProperty {
                 
             case SIDEBAR_POSITION:
                 return "SIDEBAR_POSITION";
+
+            case EXTENDED_PROPERTIES_POSITION:
+                return "EXTENDED_PROPERTIES_POSITION";
                 
             case SLIDESHOW_DELAY:
                 return "SLIDESHOW_DELAY";
@@ -1692,6 +1696,24 @@ public abstract class ConfigurationFacade : Object {
         }
     }
 
+    public virtual int get_extended_properties_position() {
+        try {
+            return get_engine().get_int_property(ConfigurableProperty.EXTENDED_PROPERTIES_POSITION);
+        } catch (ConfigurationError err) {
+            on_configuration_error(err);
+
+            return 360;
+        }
+    }
+
+    public virtual void set_extended_properties_position(int position) {
+        try {
+            get_engine().set_int_property(ConfigurableProperty.EXTENDED_PROPERTIES_POSITION, position);
+        } catch (ConfigurationError err) {
+            on_configuration_error(err);
+        }
+    }
+
     //
     // slideshow delay
     //
diff --git a/src/config/GSettingsEngine.vala b/src/config/GSettingsEngine.vala
index 8541f853..d5b716b8 100644
--- a/src/config/GSettingsEngine.vala
+++ b/src/config/GSettingsEngine.vala
@@ -98,6 +98,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
         schema_names[ConfigurableProperty.RAW_DEVELOPER_DEFAULT] = FILES_PREFS_SCHEMA_NAME;;
         schema_names[ConfigurableProperty.SHOW_WELCOME_DIALOG] = UI_PREFS_SCHEMA_NAME;
         schema_names[ConfigurableProperty.SIDEBAR_POSITION] = UI_PREFS_SCHEMA_NAME;
+        schema_names[ConfigurableProperty.EXTENDED_PROPERTIES_POSITION] = UI_PREFS_SCHEMA_NAME;
         schema_names[ConfigurableProperty.SLIDESHOW_DELAY] = SLIDESHOW_PREFS_SCHEMA_NAME;
         schema_names[ConfigurableProperty.SLIDESHOW_TRANSITION_DELAY] = SLIDESHOW_PREFS_SCHEMA_NAME;
         schema_names[ConfigurableProperty.SLIDESHOW_TRANSITION_EFFECT_ID] = SLIDESHOW_PREFS_SCHEMA_NAME;
@@ -173,6 +174,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
         key_names[ConfigurableProperty.RAW_DEVELOPER_DEFAULT] = "raw-developer-default";
         key_names[ConfigurableProperty.SHOW_WELCOME_DIALOG] = "show-welcome-dialog";
         key_names[ConfigurableProperty.SIDEBAR_POSITION] = "sidebar-position";
+        key_names[ConfigurableProperty.EXTENDED_PROPERTIES_POSITION] = "extended-properties-position";
         key_names[ConfigurableProperty.SLIDESHOW_DELAY] = "delay";
         key_names[ConfigurableProperty.SLIDESHOW_TRANSITION_DELAY] = "transition-delay";
         key_names[ConfigurableProperty.SLIDESHOW_TRANSITION_EFFECT_ID] = "transition-effect-id";
diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala
index 53160273..de1856c6 100644
--- a/src/library/LibraryWindow.vala
+++ b/src/library/LibraryWindow.vala
@@ -410,9 +410,11 @@ public class LibraryWindow : AppWindow {
         Config.Facade.get_instance().set_library_window_state(maximized, dimensions);
 
         var sidebar = (Dazzle.DockRevealer) client_paned.get_left_edge();
-
         Config.Facade.get_instance().set_sidebar_position(sidebar.position);
 
+        sidebar = (Dazzle.DockRevealer) client_paned.get_right_edge();
+        Config.Facade.get_instance().set_extended_properties_position(sidebar.position);
+
         base.on_quit();
     }
 
@@ -1089,31 +1091,32 @@ public class LibraryWindow : AppWindow {
         sidebar_paned.pack2(bottom_frame, false, false);
         sidebar_paned.set_position(1000);
 
-        var left_pane = client_paned.get_left_edge();
-        
         ((Gtk.Container)client_paned.get_top_edge()).add(search_toolbar);
         search_toolbar.hexpand = true;
-        ((Gtk.Container)left_pane).add(sidebar_paned);
+
+        var left_pane = (Dazzle.DockRevealer) client_paned.get_left_edge();
+        left_pane.add(sidebar_paned);
 
         sidebar_tree.set_size_request(SIDEBAR_MIN_WIDTH, -1);
         var position = Config.Facade.get_instance().get_sidebar_position();
-        ((Dazzle.DockRevealer)left_pane).set_position(position);
+        left_pane.set_position(position);
+
+        // Center widget
         client_paned.add(stack);
 
         // TODO: Calc according to layout's size, to give sidebar a maximum width
         stack.set_size_request(PAGE_MIN_WIDTH, -1);
+
+        // Right pane - Extended Properties
         var scrolled = new Gtk.ScrolledWindow(null, null);
         scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
         scrolled.add(extended_properties);
-        ((Gtk.Container)client_paned.get_right_edge()).add(scrolled);
-
-        extended_properties.vexpand = true;
-        extended_properties.set_margin_top (9);
-        extended_properties.set_margin_bottom (9);
-        extended_properties.set_margin_start (9);
-        extended_properties.set_margin_end (9);
         scrolled.set_size_request(EXTENDED_INFO_MIN_WIDTH, -1);
 
+        var right_edge = (Dazzle.DockRevealer) client_paned.get_right_edge();
+        right_edge.add(scrolled);
+        position = Config.Facade.get_instance().get_extended_properties_position();
+        right_edge.set_position(position);
         client_paned.right_visible = Config.Facade.get_instance().get_display_extended_properties();
 
         add(client_paned);


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