[dconf-editor] Hide “org.gnome.d-feet” schema.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Hide “org.gnome.d-feet” schema.
- Date: Sat, 10 Feb 2018 10:51:43 +0000 (UTC)
commit bab0900fccfcf67f773658d6ed6bb7e6325c5c44
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sat Feb 10 11:50:46 2018 +0100
Hide “org.gnome.d-feet” schema.
editor/ca.desrt.dconf-editor.gschema.xml | 2 +
editor/source-manager.vala | 31 ++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/editor/ca.desrt.dconf-editor.gschema.xml b/editor/ca.desrt.dconf-editor.gschema.xml
index a231f8e..d35bca1 100644
--- a/editor/ca.desrt.dconf-editor.gschema.xml
+++ b/editor/ca.desrt.dconf-editor.gschema.xml
@@ -343,6 +343,8 @@ If you are not interacting with D-Bus, then there is no reason to make use of th
<description>A range could limit an integer key to only allow one value, but that’s probably an error.
Dconf Editor warns you in that case.</description>
</key>
</schema>
+ <schema id="ca.desrt.dconf-editor.DemoEmpty" path="/ca/desrt/dconf-editor/Demo/Empty/">
+ </schema>
<schema id="ca.desrt.dconf-editor.Demo.Relocatable">
<key name="boolean" type="b">
<default>false</default>
diff --git a/editor/source-manager.vala b/editor/source-manager.vala
index 1ab6644..c4def9e 100644
--- a/editor/source-manager.vala
+++ b/editor/source-manager.vala
@@ -38,6 +38,7 @@ public class SourceManager : Object
return (!) settings_schema_source;
}
+ private string [] previous_empty_schemas = { "ca.desrt.dconf-editor.DemoEmpty" };
public void refresh_schema_source ()
{
SettingsSchemaSource? settings_schema_source = create_schema_source ();
@@ -50,15 +51,45 @@ public class SourceManager : Object
string [] relocatable_schemas;
((!) settings_schema_source).list_schemas (true, out non_relocatable_schemas, out
relocatable_schemas);
+ string [] empty_schemas = {};
foreach (string schema_id in non_relocatable_schemas)
{
SettingsSchema? settings_schema = ((!) settings_schema_source).lookup (schema_id, true);
if (settings_schema == null)
continue; // TODO better
+ if (((!) settings_schema).list_keys ().length == 0 && ((!) settings_schema).list_children
().length == 0)
+ {
+ empty_schemas += schema_id;
+ continue;
+ }
+
cached_schemas.add_schema ((!) settings_schema, modified_path_specs);
}
+ string [] empty_schemas_needing_warning = {};
+ if (empty_schemas.length > 0)
+ foreach (string test_string in empty_schemas)
+ if (!(test_string in previous_empty_schemas))
+ empty_schemas_needing_warning += test_string;
+
+ // TODO i18n but big warning with plurals; and suggest to report a bug?
+ if (empty_schemas_needing_warning.length == 1)
+ {
+ warning ("Schema with id “" + empty_schemas_needing_warning [0] + "” contains neither keys nor
children.");
+ previous_empty_schemas = empty_schemas;
+ }
+ else if (empty_schemas_needing_warning.length > 1)
+ {
+ string warning_string = "The following schemas:\n";
+ foreach (string warning_id in empty_schemas_needing_warning)
+ warning_string += @" $warning_id\n";
+ warning_string += "contain neither keys nor children.";
+
+ warning (warning_string);
+ previous_empty_schemas = empty_schemas;
+ }
+
foreach (string schema_id in relocatable_schemas)
{
GenericSet<string>? path_specs = relocatable_schema_paths.lookup (schema_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]