[dconf-editor] Fix delayed mode for relocatable schemas keys
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Fix delayed mode for relocatable schemas keys
- Date: Mon, 4 Dec 2017 01:35:31 +0000 (UTC)
commit 0a87e833c71d9efe1170e13f1330c430b50ed3ad
Author: Davi da Silva Böger <dsboger gmail com>
Date: Sun Dec 3 22:40:45 2017 -0200
Fix delayed mode for relocatable schemas keys
Disambiguate planned changes for relocatable schemas in different paths.
editor/dconf-model.vala | 24 +++++++++++++++++++-----
editor/modifications-revealer.vala | 7 ++++---
2 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index 2e6293e..d61f02b 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -131,11 +131,13 @@ public class Directory : SettingObject
settings = new GLib.Settings (((!) settings_schema).get_id ());
foreach (string key_id in (!) gsettings_key_map)
- create_gsettings_key (key_id, ((!) settings_schema).get_key (key_id));
+ create_gsettings_key (key_id, (!) settings_schema);
}
- private void create_gsettings_key (string key_id, SettingsSchemaKey settings_schema_key)
+ private void create_gsettings_key (string key_id, SettingsSchema settings_schema)
{
+ SettingsSchemaKey settings_schema_key = settings_schema.get_key (key_id);
+
string range_type = settings_schema_key.get_range ().get_child_value (0).get_string (); // don’t put
it in the switch, or it fails
string type_string;
switch (range_type)
@@ -155,7 +157,8 @@ public class Directory : SettingObject
this,
key_id,
settings,
- settings.schema_id,
+ settings_schema.get_id (),
+ settings_schema.get_path (),
((!) (nullable_summary ?? "")).strip (),
((!) (nullable_description ?? "")).strip (),
type_string,
@@ -481,13 +484,23 @@ public class DConfKey : Key
public class GSettingsKey : Key
{
public string schema_id { get; construct; }
+ public string? schema_path { get; construct; }
public string summary { get; construct; }
public string description { private get; construct; }
public Variant default_value { get; construct; }
public string range_type { get; construct; }
public Variant range_content { get; construct; }
- public override string descriptor { owned get { return @"$schema_id $name"; } }
+ public override string descriptor {
+ owned get {
+ if (schema_path == null)
+ {
+ string schema_path = SettingsModel.get_parent_path (full_name);
+ return @"$schema_id:$schema_path $name";
+ }
+ return @"$schema_id $name";
+ }
+ }
public GLib.Settings settings { get; construct; }
@@ -507,7 +520,7 @@ public class GSettingsKey : Key
settings.reset (name);
}
- public GSettingsKey (Directory parent, string name, GLib.Settings settings, string schema_id, string
summary, string description, string type_string, Variant default_value, string range_type, Variant
range_content)
+ public GSettingsKey (Directory parent, string name, GLib.Settings settings, string schema_id, string?
schema_path, string summary, string description, string type_string, Variant default_value, string
range_type, Variant range_content)
{
string? summary_nullable = summary.locale_to_utf8 (-1, null, null, null);
summary = summary_nullable ?? summary;
@@ -520,6 +533,7 @@ public class GSettingsKey : Key
settings : settings,
// schema infos
schema_id: schema_id,
+ schema_path: schema_path,
summary: summary,
description: description,
default_value: default_value, // TODO devel default/admin default
diff --git a/editor/modifications-revealer.vala b/editor/modifications-revealer.vala
index da1cd6a..6b1a731 100644
--- a/editor/modifications-revealer.vala
+++ b/editor/modifications-revealer.vala
@@ -155,12 +155,13 @@ class ModificationsRevealer : Revealer
HashTable<string, GLib.Settings> delayed_settings_hashtable = new HashTable<string, GLib.Settings>
(str_hash, str_equal);
gsettings_keys_awaiting_hashtable.foreach_remove ((descriptor, key) => {
- GLib.Settings? settings = delayed_settings_hashtable.lookup (key.schema_id);
+ string settings_descriptor = descriptor [0:descriptor.last_index_of_char (' ')]; // strip
the key name
+ GLib.Settings? settings = delayed_settings_hashtable.lookup (settings_descriptor);
if (settings == null)
{
settings = key.settings;
((!) settings).delay ();
- delayed_settings_hashtable.insert (key.schema_id, (!) settings);
+ delayed_settings_hashtable.insert (settings_descriptor, (!) settings);
}
if (key.planned_value == null)
@@ -172,7 +173,7 @@ class ModificationsRevealer : Revealer
return true;
});
- delayed_settings_hashtable.foreach_remove ((schema_id, schema_settings) => { schema_settings.apply
(); return true; });
+ delayed_settings_hashtable.foreach_remove ((key_descriptor, schema_settings) => {
schema_settings.apply (); return true; });
/* DConf stuff */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]