[gnome-taquin] Add org.gnome.Taquin.Lib schema.



commit aa558ea58799f22e13a1702a6e2a424367a3047b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Jul 31 15:02:58 2019 +0200

    Add org.gnome.Taquin.Lib schema.

 data/org.gnome.Taquin.gschema.xml | 42 ++++++++++++++++++++++-----------------
 src/adaptative-window.vala        | 13 +++++++++++-
 src/game-window.vala              |  3 ++-
 3 files changed, 38 insertions(+), 20 deletions(-)
---
diff --git a/data/org.gnome.Taquin.gschema.xml b/data/org.gnome.Taquin.gschema.xml
index bfad1da..7cafdbe 100644
--- a/data/org.gnome.Taquin.gschema.xml
+++ b/data/org.gnome.Taquin.gschema.xml
@@ -1,4 +1,28 @@
 <schemalist>
+  <schema id="org.gnome.Taquin.Lib">
+    <key name="window-width" type="i">
+      <default>540</default>
+      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/taquin/window-width' -->
+      <summary>The width of the window</summary>
+      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/taquin/window-width' -->
+      <description>The width of the main window in pixels.</description>
+    </key>
+    <key name="window-height" type="i">
+      <default>500</default>
+      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/taquin/window-height' -->
+      <summary>The height of the window</summary>
+      <!-- Translators: description of a settings key, see 'dconf-editor /org/gnome/taquin/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/taquin/window-is-maximized' 
-->
+      <summary>A flag to enable maximized mode</summary>
+      <!-- Translators: description of a settings key, see 'dconf-editor 
/org/gnome/taquin/window-is-maximized' -->
+      <description>If “true”, the main window starts in maximized mode.</description>
+    </key>
+  </schema>
+
   <enum id="org.gnome.Taquin.GameType">
     <value value="0" nick="fifteen"/>
     <value value="1" nick="sixteen"/>
@@ -31,24 +55,6 @@
       <!-- Translators: description of a settings key, see 'dconf-editor /org/gnome/taquin/sound' -->
       <description>Whether or not to play event sounds.</description>
     </key>
-    <key name="window-width" type="i">
-      <default>540</default>
-      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/taquin/window-width' -->
-      <summary>Width of the window in pixels.</summary>
-      <!-- TODO add description? -->
-    </key>
-    <key name="window-height" type="i">
-      <default>500</default>
-      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/taquin/window-height' -->
-      <summary>Height of the window in pixels.</summary>
-      <!-- TODO add description? -->
-    </key>
-    <key name="window-is-maximized" type="b">
-      <default>false</default>
-      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/taquin/window-is-maximized' 
-->
-      <summary>true if the window is maximized.</summary>
-      <!-- TODO add description? -->
-    </key>
   </schema>
   <schema id="org.gnome.Taquin.NightLight">
     <key name="automatic-night-mode" type="b">
diff --git a/src/adaptative-window.vala b/src/adaptative-window.vala
index e182c5f..f095829 100644
--- a/src/adaptative-window.vala
+++ b/src/adaptative-window.vala
@@ -372,7 +372,18 @@ private abstract class AdaptativeWindow : ApplicationWindow
     * * manage window state
     \*/
 
-    private GLib.Settings settings = new GLib.Settings ("org.gnome.Taquin");
+    [CCode (notify = false)] public string schema_path
+    {
+        protected construct
+        {
+            string? _value = value;
+            if (_value == null)
+                assert_not_reached ();
+
+            settings = new GLib.Settings.with_path ("org.gnome.Taquin.Lib", value);
+        }
+    }
+    private GLib.Settings settings;
 
     private int window_width = 0;
     private int window_height = 0;
diff --git a/src/game-window.vala b/src/game-window.vala
index e6d4e55..f287d65 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -48,7 +48,8 @@ private class GameWindow : BaseWindow, AdaptativeWidget
                 base_view                   : (BaseView) _game_view,
                 window_title                : Taquin.PROGRAM_NAME,
                 specific_css_class_or_empty : "",
-                help_string_or_empty        : "help:gnome-taquin");
+                help_string_or_empty        : "help:gnome-taquin",
+                schema_path                 : "/org/gnome/taquin/");
 
         headerbar = _headerbar;
         game_view = _game_view;


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