[dconf-editor] Add ca.desrt.dconf-editor.Lib schema.



commit 2bfa828785464032a3472a521d78e538ca4c26d2
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Aug 4 11:36:54 2019 +0200

    Add ca.desrt.dconf-editor.Lib schema.

 editor/adaptative-window.vala            | 13 +++++-
 editor/ca.desrt.dconf-editor.gschema.xml | 71 ++++++++++++++++----------------
 editor/dconf-editor.vala                 |  2 +-
 editor/dconf-window.vala                 |  3 +-
 editor/night-light-monitor.vala          |  2 +-
 5 files changed, 51 insertions(+), 40 deletions(-)
---
diff --git a/editor/adaptative-window.vala b/editor/adaptative-window.vala
index 2140f0f..7f60d13 100644
--- a/editor/adaptative-window.vala
+++ b/editor/adaptative-window.vala
@@ -361,7 +361,18 @@ private abstract class AdaptativeWindow : ApplicationWindow
     * * manage window state
     \*/
 
-    private GLib.Settings settings = new GLib.Settings ("ca.desrt.dconf-editor.Settings");
+    [CCode (notify = false)] public string schema_path
+    {
+        protected construct
+        {
+            string? _value = value;
+            if (_value == null)
+                assert_not_reached ();
+
+            settings = new GLib.Settings.with_path ("ca.desrt.dconf-editor.Lib", value);
+        }
+    }
+    private GLib.Settings settings;
 
     private int window_width = 0;
     private int window_height = 0;
diff --git a/editor/ca.desrt.dconf-editor.gschema.xml b/editor/ca.desrt.dconf-editor.gschema.xml
index 1d5229a..d463b71 100644
--- a/editor/ca.desrt.dconf-editor.gschema.xml
+++ b/editor/ca.desrt.dconf-editor.gschema.xml
@@ -82,6 +82,41 @@
 ]>
 
 <schemalist gettext-domain='dconf-editor'>
+  <schema id="ca.desrt.dconf-editor.Lib">
+    <key name="automatic-night-mode" type="b">
+      <default>false</default>
+      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/iagno/automatic-night-mode' 
-->
+      <summary>A flag to follow system night light</summary>
+      <!-- Translators: description of a settings key, see 'dconf-editor 
/org/gnome/iagno/automatic-night-mode' -->
+      <description>Use GNOME night light setting to activate night-mode.</description>
+    </key>
+    <key name="window-width" type="i">
+      <default>540</default>
+      <!-- see AdaptativeWindow.width-request at data/ui/adaptative-window.ui:22 -->
+      <!-- range min="350"/ FIXME -->
+      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/iagno/window-width' -->
+      <summary>The width of the window</summary>
+      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/iagno/window-width' -->
+      <description>The width of the main window in pixels.</description>
+    </key>
+    <key name="window-height" type="i">
+      <default>500</default>
+      <!-- see AdaptativeWindow.height-request at data/ui/adaptative-window.ui:21 -->
+      <!-- range min="284"/ FIXME -->
+      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/iagno/window-height' -->
+      <summary>The height of the window</summary>
+      <!-- Translators: description of a settings key, see 'dconf-editor /org/gnome/iagno/window-height' -->
+      <description>The height of the main window in pixels.</description>
+    </key>
+    <key name="window-is-maximized" type="b">
+      <default>false</default>
+      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/iagno/window-is-maximized' 
-->
+      <summary>A flag to enable maximized mode</summary>
+      <!-- Translators: description of a settings key, see 'dconf-editor 
/org/gnome/iagno/window-is-maximized' -->
+      <description>If “true”, the main window starts in maximized mode.</description>
+    </key>
+  </schema>
+
   <enum id="ca.desrt.dconf-editor.Behaviour">
     <value value="0" nick="unsafe"/>
     <value value="1" nick="safe"/>
@@ -97,33 +132,6 @@
   </flags>
   <schema id="ca.desrt.dconf-editor.Settings" path="/ca/desrt/dconf-editor/">
     <child schema="ca.desrt.dconf-editor.Demo" name="demo"/>
-    <key name="window-width" type="i">
-      <!-- start in "usual window" size (notably for pathbar items spacing), so with a large enough width -->
-      <default>800</default>
-      <!-- see AdaptativeWindow.width-request at adaptative-window.ui:22 -->
-      <!-- range min="284"/ FIXME -->
-      <!-- Translators: summary of a settings key, see 'dconf-editor /ca/desrt/dconf-editor/window-width' -->
-      <summary>The width of the window</summary>
-      <!-- Translators: description of a settings key, see 'dconf-editor 
/ca/desrt/dconf-editor/window-width' -->
-      <description>The width of the main window in pixels.</description>
-    </key>
-    <key name="window-height" type="i">
-      <!-- first launch is at root, that only contains few subfolders, so start with a not-too-big height -->
-      <default>420</default>
-      <!-- see AdaptativeWindow.height-request at adaptative-window.ui:21 -->
-      <!-- range min="350"/ FIXME -->
-      <!-- Translators: summary of a settings key, see 'dconf-editor /ca/desrt/dconf-editor/window-height' 
-->
-      <summary>The height of the window</summary>
-      <!-- Translators: description of a settings key, see 'dconf-editor 
/ca/desrt/dconf-editor/window-height' -->
-      <description>The height of the main window in pixels.</description>
-    </key>
-    <key name="window-is-maximized" type="b">
-      <default>false</default>
-      <!-- Translators: summary of a settings key, see 'dconf-editor 
/ca/desrt/dconf-editor/window-is-maximized' -->
-      <summary>A flag to enable maximized mode</summary>
-      <!-- Translators: description of a settings key, see 'dconf-editor 
/ca/desrt/dconf-editor/window-is-maximized' -->
-      <description>A flag to enable maximized mode</description>
-    </key>
     <key name="restore-view" type="b">
       <default>true</default>
       <!-- Translators: summary of a settings key, see 'dconf-editor /ca/desrt/dconf-editor/restore-view' -->
@@ -225,15 +233,6 @@
       <description>When a folder only contains one subfolder and no keys, Dconf Editor can jump to that 
subfolder directly. This flag enables that behaviour.</description>
     </key>
   </schema>
-  <schema id="ca.desrt.dconf-editor.NightLight">
-    <key name="automatic-night-mode" type="b">
-      <default>false</default>
-      <!-- Translators: summary of a settings key, see 'dconf-editor 
/ca/desrt/dconf-editor/automatic-night-mode' -->
-      <summary>Follow system night light</summary>
-      <!-- Translators: description of a settings key, see 'dconf-editor 
/ca/desrt/dconf-editor/automatic-night-mode' -->
-      <description>Use GNOME night light setting to activate night-mode.</description>
-    </key>
-  </schema>
   <schema id="ca.desrt.dconf-editor.Bookmarks">
     <key name="bookmarks" type="as">
       <default>[]</default>
diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala
index bc48af2..3f0f258 100644
--- a/editor/dconf-editor.vala
+++ b/editor/dconf-editor.vala
@@ -23,7 +23,7 @@ private class ConfigurationEditor : Gtk.Application, BaseApplication
     internal static string [,] internal_mappings = {
             {"ca.desrt.dconf-editor.Bookmarks",
                 "/ca/desrt/dconf-editor/"},
-            {"ca.desrt.dconf-editor.NightLight",
+            {"ca.desrt.dconf-editor.Lib",
                 "/ca/desrt/dconf-editor/"},
 
             {"ca.desrt.dconf-editor.Demo.EmptyRelocatable",
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 8a8f9b3..ce6197d 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -51,7 +51,8 @@ private class DConfWindow : BookmarksWindow, AdaptativeWidget
         Object (nta_headerbar               : (NightTimeAwareHeaderBar) _headerbar,
                 base_view                   : (BaseView) _main_view,
                 window_title                : ConfigurationEditor.PROGRAM_NAME,
-                specific_css_class_or_empty : "dconf-editor");
+                specific_css_class_or_empty : "dconf-editor",
+                schema_path                 : "/ca/desrt/dconf-editor/");
 
         model = _model;
         modifications_handler = _modifications_handler;
diff --git a/editor/night-light-monitor.vala b/editor/night-light-monitor.vala
index 95a3e4d..034d80f 100644
--- a/editor/night-light-monitor.vala
+++ b/editor/night-light-monitor.vala
@@ -37,7 +37,7 @@ private class NightLightMonitor : Object
     "Something went wrong getting GtkSettings default object, doing nothing.";
 
     // schema static things
-    private const string schema_name = "ca.desrt.dconf-editor.NightLight";  // TODO put in a library
+    private const string schema_name = "ca.desrt.dconf-editor.Lib";
     private const string automatic_night_mode_key = "automatic-night-mode";
 
     /*\


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