[dconf-editor] Refactor the multiple schemas detection



commit a8a4e95169bd6d8e263f65f2befccd89a3c1ce57
Author: Davi da Silva Böger <dsboger gmail com>
Date:   Sun Nov 26 06:01:28 2017 -0200

    Refactor the multiple schemas detection

 editor/dconf-model.vala |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index 2f15cab..391421d 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -102,7 +102,10 @@ public class Directory : SettingObject
 
     public void init_gsettings_keys (SettingsSchema _settings_schema)
     {
-        settings_schema = _settings_schema;
+        if (settings_schema == null)
+            settings_schema = _settings_schema;
+        else if (_settings_schema.get_id () != ((!) settings_schema).get_id ())
+            warning_multiple_schemas = true;
     }
 
     private void create_gsettings_keys ()
@@ -576,8 +579,6 @@ public class SettingsModel : Object
         string [] non_relocatable_schemas;
         string [] relocatable_schemas;
 
-        HashTable<string, Directory> path_and_schema = new HashTable<string, Directory> (str_hash, 
str_equal);
-
         settings_schema_source.list_schemas (true, out non_relocatable_schemas, out relocatable_schemas);
 
         foreach (string schema_id in non_relocatable_schemas)
@@ -590,15 +591,6 @@ public class SettingsModel : Object
 
             Directory view = create_gsettings_views (root, schema_path [1:schema_path.length]);
             view.init_gsettings_keys ((!) settings_schema);
-
-            Directory? schema_already_installed_there = path_and_schema.lookup (schema_path);
-            if (schema_already_installed_there != null)
-            {
-                ((!) schema_already_installed_there).warning_multiple_schemas = true;
-                view.warning_multiple_schemas = true;
-            }
-            else
-                path_and_schema.insert (schema_path, view);
         }
     }
 


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