[dconf-editor] Support disabling relocatable schemas mappings



commit 9b60646d3d88ee2cee9cf660572c26fd95d78620
Author: Davi da Silva Böger <dsboger gmail com>
Date:   Wed Dec 6 02:52:28 2017 -0200

    Support disabling relocatable schemas mappings
    
    Add a flags setting "relocatable-schemas-enabled-mappings" with entries
    'User', 'Built-in' and 'Internal'.
    
    Currently only 'User' and 'Built-in' are used.

 editor/ca.desrt.dconf-editor.gschema.xml |   10 ++++++++++
 editor/dconf-model.vala                  |   16 ++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/editor/ca.desrt.dconf-editor.gschema.xml b/editor/ca.desrt.dconf-editor.gschema.xml
index 09f607b..fdc005f 100644
--- a/editor/ca.desrt.dconf-editor.gschema.xml
+++ b/editor/ca.desrt.dconf-editor.gschema.xml
@@ -97,6 +97,11 @@
     <value value="1" nick="first"/>
     <value value="2" nick="last"/>
   </enum>
+  <flags id="ca.desrt.dconf-editor.RelocatableSchemasEnabledMappings">
+    <value value="1" nick="User"/>
+    <value value="2" nick="Built-in"/>
+    <value value="4" nick="Internal"/>
+  </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">
@@ -181,6 +186,11 @@
       <summary>Mouse button to activate the “Forward” command in browser window</summary>
       <description>For users with mice that have buttons for “Forward” and “Back”, this key will set which 
button activates the “Forward” command in a browser window. Possible values range between 6 and 
14.</description>
     </key>
+    <key name="relocatable-schemas-enabled-mappings" 
flags="ca.desrt.dconf-editor.RelocatableSchemasEnabledMappings">
+      <default>['User', 'Built-in', 'Internal']</default>
+      <summary>Enabled relocatable schema mapping facilities</summary>
+      <description>Flags for the relocatable schemas mapping facilities. 'User' enables mappings from 
setting 'relocatable-schemas-user-paths'; 'Built-in' enables well-known mappings hardcoded into Dconf Editor; 
'Internal' is reserved for future use of Dconf Editor.</description>
+    </key>
     <key name="relocatable-schemas-user-paths" type="a{ss}">
       
<default>{'ca.desrt.dconf-editor.Demo.Relocatable':'/ca/desrt/dconf-editor/Demo/relocatable/'}</default>
       <summary>Mapping of paths to manually associated schemas</summary>
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index 9f6b2a5..eb2a2ee 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -568,6 +568,14 @@ public class GSettingsKey : Key
     } */
 }
 
+[Flags]
+enum RelocatableSchemasEnabledMappings
+{
+    USER,
+    BUILT_IN,
+    INTERNAL
+}
+
 class RelocatableSchemaInfo
 {
     public SettingsSchema schema;
@@ -646,6 +654,10 @@ public class SettingsModel : Object
 
     private void parse_relocatable_schemas_user_paths (HashTable<string, RelocatableSchemaInfo> 
relocatable_schema_paths)
     {
+        RelocatableSchemasEnabledMappings enabled_mappings_flags = (RelocatableSchemasEnabledMappings) 
application_settings.get_flags ("relocatable-schemas-enabled-mappings");
+        if (!(RelocatableSchemasEnabledMappings.USER in enabled_mappings_flags))
+            return;
+
         if (settings_schema_source == null)
             return;
 
@@ -660,6 +672,10 @@ public class SettingsModel : Object
 
     private void create_relocatable_schemas_built_in_paths (HashTable<string, RelocatableSchemaInfo> 
relocatable_schema_paths)
     {
+        RelocatableSchemasEnabledMappings enabled_mappings_flags = (RelocatableSchemasEnabledMappings) 
application_settings.get_flags ("relocatable-schemas-enabled-mappings");
+        if (!(RelocatableSchemasEnabledMappings.BUILT_IN in enabled_mappings_flags))
+            return;
+
         if (settings_schema_source == null)
             return;
 


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