[dconf-editor] Handle conflicting objects.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Handle conflicting objects.
- Date: Wed, 24 Jan 2018 21:44:58 +0000 (UTC)
commit 18f680f48b94f626900eca4969701da895a9446f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Jan 24 22:39:52 2018 +0100
Handle conflicting objects.
editor/browser-view.vala | 12 ++++--
editor/ca.desrt.dconf-editor.gschema.xml | 16 ++++----
editor/dconf-editor.css | 18 +++++++---
editor/dconf-model.vala | 55 +++++++++++++-----------------
editor/dconf-window.vala | 12 ++----
editor/key-list-box-row.vala | 29 +++++++++++++++-
editor/modifications-handler.vala | 21 ++++++++++--
editor/registry-info.ui | 41 +++++++++++++++++++++-
editor/registry-info.vala | 53 +++++++++++++++++++++++-----
editor/registry-view.vala | 13 +++++--
editor/setting-object.vala | 5 ++-
11 files changed, 197 insertions(+), 78 deletions(-)
---
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 72c8b66..c539579 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -20,6 +20,8 @@ using Gtk;
[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/browser-view.ui")]
class BrowserView : Grid
{
+ private string last_context = "";
+
[GtkChild] private BrowserInfoBar info_bar;
[GtkChild] private Stack stack;
@@ -109,7 +111,7 @@ class BrowserView : Grid
return "";
}
- public void prepare_browse_view (GLib.ListStore key_model, bool is_ancestor, bool
warning_multiple_schemas)
+ public void prepare_browse_view (GLib.ListStore key_model, bool is_ancestor)
{
this.key_model = key_model;
sorting_options.sort_key_model (key_model);
@@ -124,20 +126,22 @@ class BrowserView : Grid
{
bool grab_focus = true; // unused, for now
if (selected != "")
- browse_view.select_row_named ((!) selected, grab_focus);
+ browse_view.select_row_named (selected, last_context, grab_focus);
else
browse_view.select_first_row (grab_focus);
properties_view.clean ();
}
- public void prepare_properties_view (Key key, bool is_parent, bool warning_multiple_schemas)
+ public void prepare_properties_view (Key key, bool is_parent)
{
- properties_view.populate_properties_list_box (key, warning_multiple_schemas);
+ properties_view.populate_properties_list_box (key);
hide_reload_warning ();
stack.set_transition_type (is_parent && pre_search_view == null ? StackTransitionType.CROSSFADE :
StackTransitionType.NONE);
pre_search_view = null;
+
+ last_context = (key is GSettingsKey) ? ((GSettingsKey) key).schema_id : ".dconf";
}
public void show_search_view (string term, string current_path, string [] bookmarks)
diff --git a/editor/ca.desrt.dconf-editor.gschema.xml b/editor/ca.desrt.dconf-editor.gschema.xml
index d4f6f22..a231f8e 100644
--- a/editor/ca.desrt.dconf-editor.gschema.xml
+++ b/editor/ca.desrt.dconf-editor.gschema.xml
@@ -361,8 +361,8 @@ If you are not interacting with D-Bus, then there is no reason to make use of th
</key>
</schema>
<schema id="ca.desrt.dconf-editor.Demo.Conflict1" path="/ca/desrt/dconf-editor/Demo/Conflict/">
- <key name="a-non-conflicting-key" type="i">
- <default>0</default>
+ <key name="a-non-conflicting-key" type="b">
+ <default>true</default>
<summary>A normal non-conflicting key from Conflict1</summary>
<description>This key is a test for multiple schemas in the same path with conflicting keys.
Non-conflicting keys should have no issues.</description>
</key>
@@ -376,15 +376,15 @@ If you are not interacting with D-Bus, then there is no reason to make use of th
<summary>A (simple) string conflicting key that should give a error</summary>
<description>This key is a test for multiple schemas in the same path with conflicting keys. It
shouldn’t be editable as a key mapped to the same path has a different type.</description>
</key>
- <key name="warning-similar" type="s">
- <default>''</default>
+ <key name="warning-similar" type="b">
+ <default>true</default>
<summary>Conflicting key from Conflict1 that should give a warning</summary>
<description>This key is a test for multiple schemas in the same path with conflicting keys. It can be
edited, since the types are compatible, but it is still an issue.</description>
</key>
</schema>
<schema id="ca.desrt.dconf-editor.Demo.Conflict2" path="/ca/desrt/dconf-editor/Demo/Conflict/">
- <key name="another-non-conflicting-key" type="i">
- <default>0</default>
+ <key name="another-non-conflicting-key" type="b">
+ <default>true</default>
<summary>A normal non-conflicting key from Conflict2</summary>
<description>This key is a test for multiple schemas in the same path with conflicting keys.
Non-conflicting keys should have no issues.</description>
</key>
@@ -398,8 +398,8 @@ If you are not interacting with D-Bus, then there is no reason to make use of th
<summary>A nullable-string conflicting key that should give an error</summary>
<description>This key is a test for multiple schemas in the same path with conflicting keys. It
shouldn’t be editable as a key mapped to the same path has a different type.</description>
</key>
- <key name="warning-similar" type="s">
- <default>''</default>
+ <key name="warning-similar" type="b">
+ <default>true</default>
<summary>Conflicting key from Conflict2 that should give a warning</summary>
<description>This key is a test for multiple schemas in the same path with conflicting keys. It can be
edited, since the types are compatible, but it is still an issue.</description>
</key>
diff --git a/editor/dconf-editor.css b/editor/dconf-editor.css
index f71143e..ddfee13 100644
--- a/editor/dconf-editor.css
+++ b/editor/dconf-editor.css
@@ -143,13 +143,21 @@
/* icons */
.keys-list > row > .key.delayed,
.keys-list > row > .dconf-key.key.delayed,
-.keys-list > row > .edited.gsettings-key.key.delayed {
background-image:-gtk-icontheme("document-open-recent-symbolic"); }
+.keys-list > row > .edited.gsettings-key.key.delayed {
background-image:-gtk-icontheme("document-open-recent-symbolic"); }
-.keys-list > row > .edited.gsettings-key.key {
background-image:-gtk-icontheme("document-edit-symbolic"); }
+.keys-list > row > .gsettings-key.key.delayed.conflict,
+.keys-list > row > .edited.gsettings-key.key.delayed.conflict {
background-image:-gtk-icontheme("document-open-recent-symbolic"); }
-.keys-list > row > .dconf-key.key {
background-image:-gtk-icontheme("dialog-question-symbolic"); }
-.keys-list > row > .erase.dconf-key.key.delayed {
background-image:-gtk-icontheme("user-trash-symbolic"); }
-.keys-list > row > .erase.dconf-key.key {
background-image:-gtk-icontheme("action-unavailable-symbolic"); }
+.keys-list > row > .gsettings-key.key.conflict,
+.keys-list > row > .edited.gsettings-key.key.conflict {
background-image:-gtk-icontheme("dialog-warning-symbolic"); }
+.keys-list > row > .gsettings-key.key.hard-conflict,
+.keys-list > row > .edited.gsettings-key.key.hard-conflict {
background-image:-gtk-icontheme("dialog-error-symbolic"); }
+
+.keys-list > row > .edited.gsettings-key.key {
background-image:-gtk-icontheme("document-edit-symbolic"); }
+
+.keys-list > row > .dconf-key.key {
background-image:-gtk-icontheme("dialog-question-symbolic"); }
+.keys-list > row > .erase.dconf-key.key.delayed {
background-image:-gtk-icontheme("user-trash-symbolic"); }
+.keys-list > row > .erase.dconf-key.key {
background-image:-gtk-icontheme("action-unavailable-symbolic"); }
.keys-list > row > .erase.dconf-key.key:not(.delayed) label.key-value { font-style:italic; }
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index 6050cd4..651db8a 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -89,13 +89,7 @@ public class SettingsModel : Object
public Directory get_root_directory ()
{
- Directory root = new Directory ("/", "/");
- uint schemas_count = 0;
- uint subpaths_count = 0;
- source_manager.cached_schemas.get_content_count ("/", out schemas_count, out subpaths_count);
- if (schemas_count > 1)
- root.warning_multiple_schemas = true;
- return root;
+ return new Directory ("/", "/");
}
private Directory? get_directory (string path)
@@ -103,17 +97,12 @@ public class SettingsModel : Object
if (path == "/")
return get_root_directory ();
- Directory? dir = null;
uint schemas_count = 0;
uint subpaths_count = 0;
source_manager.cached_schemas.get_content_count (path, out schemas_count, out subpaths_count);
if (schemas_count + subpaths_count > 0 || client.list (path).length > 0)
- {
- dir = new Directory (path, get_name (path));
- if (schemas_count > 1)
- ((!) dir).warning_multiple_schemas = true;
- }
- return dir;
+ return new Directory (path, get_name (path));
+ return null;
}
public GLib.ListStore? get_children (string folder_path)
@@ -142,10 +131,10 @@ public class SettingsModel : Object
return (SettingObject?) get_directory (path);
}
- public Key? get_key (string path, string context)
+ public Key? get_key (string path, string context = "")
{
GLib.ListStore? key_model = get_children (get_parent_path (path));
- return get_key_from_path_and_name (key_model, get_name (path));
+ return get_key_from_path_and_name (key_model, get_name (path), context);
}
public bool path_exists (string path)
@@ -159,7 +148,7 @@ public class SettingsModel : Object
return get_directory (path) != null;
}
- private static Key? get_key_from_path_and_name (GLib.ListStore? key_model, string key_name)
+ private static Key? get_key_from_path_and_name (GLib.ListStore? key_model, string key_name, string
schema_id = "")
{
if (key_model == null)
return null;
@@ -170,7 +159,8 @@ public class SettingsModel : Object
if (object == null)
assert_not_reached ();
if ((!) object is Key && ((!) object).name == key_name)
- return (Key) (!) object;
+ if (schema_id == "" || object is GSettingsKey && (!) schema_id == (!) ((GSettingsKey)
object).schema_id)
+ return (Key) (!) object;
position++;
}
return null;
@@ -266,6 +256,21 @@ public class SettingsModel : Object
range_type,
settings_schema_key.get_range ().get_child_value (1).get_child_value (0)
);
+ GSettingsKey? conflicting_key = (GSettingsKey?) get_key_from_path_and_name (key_model, key_id); //
safe cast, no DConfKey's added yet
+ if (conflicting_key != null)
+ {
+ ((!) conflicting_key).warning_conflicting_key = true;
+ new_key.warning_conflicting_key = true;
+ if (((!) conflicting_key).error_hard_conflicting_key == true
+ || new_key.type_string != ((!) conflicting_key).type_string
+ || !new_key.default_value.equal (((!) conflicting_key).default_value)
+ || new_key.range_type != ((!) conflicting_key).range_type
+ || !new_key.range_content.equal (((!) conflicting_key).range_content))
+ {
+ ((!) conflicting_key).error_hard_conflicting_key = true;
+ new_key.error_hard_conflicting_key = true;
+ }
+ }
key_model.append (new_key);
}
@@ -341,25 +346,14 @@ public class SettingsModel : Object
* * Directory methods
\*/
- public bool get_warning_multiple_schemas (string path)
- {
- Directory? dir = get_directory (path);
- if (dir == null)
- assert_not_reached ();
- return ((!) dir).warning_multiple_schemas;
- }
-
- public string get_fallback_path (string path, out bool warning_multiple_schemas)
+ public string get_fallback_path (string path)
{
string fallback_path = path;
if (is_key_path (path))
{
Key? key = get_key (path, "");
if (key != null)
- {
- warning_multiple_schemas = true; // TODO meaningless
return path;
- }
fallback_path = get_parent_path (path);
}
@@ -369,7 +363,6 @@ public class SettingsModel : Object
fallback_path = get_parent_path (fallback_path);
dir = get_directory (fallback_path);
}
- warning_multiple_schemas = ((!) dir).warning_multiple_schemas;
return fallback_path;
}
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index b73dbce..fb89db2 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -202,8 +202,7 @@ class DConfWindow : ApplicationWindow
else // search
reload_search_action.set_enabled (true);
}
- bool meaningless;
- pathbar.update_ghosts (model.get_fallback_path (pathbar.complete_path, out meaningless));
+ pathbar.update_ghosts (model.get_fallback_path (pathbar.complete_path));
});
}
@@ -481,8 +480,7 @@ class DConfWindow : ApplicationWindow
private void request_folder_path (string full_name, string selected_or_empty = "", bool notify_missing =
true)
{
- bool warning_multiple_schemas;
- string fallback_path = model.get_fallback_path (full_name, out warning_multiple_schemas);
+ string fallback_path = model.get_fallback_path (full_name);
if (notify_missing && (fallback_path != full_name))
cannot_find_folder (full_name); // do not place after, full_name is in some cases changed by
set_directory()...
@@ -490,7 +488,7 @@ class DConfWindow : ApplicationWindow
GLib.ListStore? key_model = model.get_children (fallback_path);
if (key_model != null)
{
- browser_view.prepare_browse_view ((!) key_model, current_path.has_prefix (fallback_path),
warning_multiple_schemas);
+ browser_view.prepare_browse_view ((!) key_model, current_path.has_prefix (fallback_path));
update_current_path (fallback_path);
if (selected_or_empty == "")
@@ -521,9 +519,7 @@ class DConfWindow : ApplicationWindow
}
else
{
- browser_view.prepare_properties_view ((!) found_object,
- current_path == SettingsModel.get_parent_path (full_name),
- model.get_warning_multiple_schemas
(SettingsModel.get_parent_path (full_name)));
+ browser_view.prepare_properties_view ((!) found_object, current_path ==
SettingsModel.get_parent_path (full_name));
update_current_path (strdup (full_name));
}
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 87dfbae..6f971c6 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -366,7 +366,6 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
popover.new_gaction ("customize", "ui.open-object(" + variant.print (false) + ")");
popover.new_copy_action (get_text ());
-
if (key.type_string == "b" || key.type_string == "mb")
{
popover.new_section ();
@@ -445,6 +444,23 @@ private class KeyListBoxRowEditable : KeyListBoxRow
key_info_label.get_style_context ().add_class ("italic-label");
key_info_label.set_label (_("No summary provided"));
}
+
+ if (key.warning_conflicting_key)
+ {
+ if (key.error_hard_conflicting_key)
+ {
+ get_style_context ().add_class ("hard-conflict");
+ if (boolean_switch != null)
+ {
+ ((!) boolean_switch).hide ();
+ key_value_label.show ();
+ }
+ key_value_label.get_style_context ().add_class ("italic-label");
+ key_value_label.set_label (_("conflicting keys"));
+ }
+ else
+ get_style_context ().add_class ("conflict");
+ }
}
public KeyListBoxRowEditable (GSettingsKey _key, ModificationsHandler modifications_handler, bool
search_result_mode = false)
@@ -497,6 +513,14 @@ private class KeyListBoxRowEditable : KeyListBoxRow
popover.new_section ();
}
+ if (key.error_hard_conflicting_key)
+ {
+ variant = new Variant.string (key.full_name);
+ popover.new_gaction ("detail", "ui.open-object(" + variant.print (false) + ")");
+ popover.new_copy_action (get_text ());
+ return true; // anything else is value-related, so we are done
+ }
+
bool delayed_apply_menu = modifications_handler.get_current_delay_mode ();
bool planned_change = modifications_handler.key_has_planned_change (key);
Variant? planned_value = modifications_handler.get_key_planned_value (key);
@@ -642,6 +666,9 @@ private class ContextPopover : Popover
/* Translators: "open key-editor page" action in the right-click menu on the list of keys */
case "customize": action_text = _("Customize…"); break;
+ /* Translators: "open key-editor page" action in the right-click menu on the list of keys, when
key is hard-conflicting */
+ case "detail": action_text = _("Show details…"); break;
+
/* Translators: "open folder" action in the right-click menu on a folder */
case "open": action_text = _("Open"); break;
diff --git a/editor/modifications-handler.vala b/editor/modifications-handler.vala
index 7b84730..d2a41cc 100644
--- a/editor/modifications-handler.vala
+++ b/editor/modifications-handler.vala
@@ -192,12 +192,27 @@ class ModificationsHandler : Object
public bool key_has_planned_change (Key key)
{
- return keys_awaiting_hashtable.contains (key);
+ if (keys_awaiting_hashtable.contains (key))
+ return true;
+
+ bool has_planned_changed = false;
+ keys_awaiting_hashtable.@foreach ((key_awaiting, planned_value) => {
+ if (key.full_name == key_awaiting.full_name)
+ has_planned_changed = true;
+ });
+ return has_planned_changed;
}
public Variant? get_key_planned_value (Key key)
{
- return keys_awaiting_hashtable.lookup (key);
- }
+ if (keys_awaiting_hashtable.contains (key))
+ return keys_awaiting_hashtable.lookup (key);
+ Variant? planned_changed = null;
+ keys_awaiting_hashtable.@foreach ((key_awaiting, planned_value) => {
+ if (key.full_name == key_awaiting.full_name)
+ planned_changed = planned_value;
+ });
+ return planned_changed;
+ }
}
diff --git a/editor/registry-info.ui b/editor/registry-info.ui
index d1a68ff..52d8a28 100644
--- a/editor/registry-info.ui
+++ b/editor/registry-info.ui
@@ -4,7 +4,7 @@
<template class="RegistryInfo" parent="GtkGrid">
<property name="orientation">vertical</property>
<child>
- <object class="GtkRevealer" id="multiple_schemas_warning_revealer">
+ <object class="GtkRevealer" id="conflicting_key_warning_revealer">
<property name="visible">True</property>
<property name="reveal-child">False</property>
<child>
@@ -29,7 +29,44 @@
<property name="xalign">0.5</property>
<property name="max-width-chars">40</property>
<property name="wrap">True</property>
- <property name="label" translatable="yes">Multiple schemas are installed at the
parent path. This key might be defined and used by more than one schema. This could lead to problems. Edit
value at your own risk.</property>
+ <property name="label" translatable="yes">This key is defined and used by more than
one schema. This could lead to problems. Edit value at your own risk.</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRevealer" id="hard_conflicting_key_error_revealer">
+ <property name="visible">True</property>
+ <property name="reveal-child">False</property>
+ <child>
+ <object class="GtkInfoBar">
+ <property name="visible">True</property>
+ <property name="message-type">warning</property>
+ <child internal-child="action_area">
+ <object class="GtkBox">
+ <property name="visible">False</property>
+ </object>
+ </child>
+ <child internal-child="content_area">
+ <object class="GtkBox">
+ <child>
+ <object class="RegistryWarning">
+ <property name="visible">True</property>
+ <property name="halign">center</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0.5</property>
+ <property name="max-width-chars">40</property>
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">This key is incompatibly defined and used
by more than one schema. It is impossible to work with its value in a meaningful way.</property>
</object>
</child>
</object>
diff --git a/editor/registry-info.vala b/editor/registry-info.vala
index b3c7300..3a73175 100644
--- a/editor/registry-info.vala
+++ b/editor/registry-info.vala
@@ -20,7 +20,8 @@ using Gtk;
[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/registry-info.ui")]
class RegistryInfo : Grid, BrowsableView
{
- [GtkChild] private Revealer multiple_schemas_warning_revealer;
+ [GtkChild] private Revealer conflicting_key_warning_revealer;
+ [GtkChild] private Revealer hard_conflicting_key_error_revealer;
[GtkChild] private Revealer no_schema_warning;
[GtkChild] private Revealer one_choice_warning_revealer;
[GtkChild] private Label one_choice_enum_warning;
@@ -60,7 +61,7 @@ class RegistryInfo : Grid, BrowsableView
* * Populating
\*/
- public void populate_properties_list_box (Key key, bool warning_multiple_schemas)
+ public void populate_properties_list_box (Key key)
{
SettingsModel model = modifications_handler.model;
if (key is DConfKey && model.is_key_ghost ((DConfKey) key)) // TODO place in "requires"
@@ -72,7 +73,24 @@ class RegistryInfo : Grid, BrowsableView
current_key_info = key.properties;
key.properties.get ("(ba{ss})", out has_schema, out dict_container);
- multiple_schemas_warning_revealer.set_reveal_child (has_schema && warning_multiple_schemas);
+ if (key is GSettingsKey)
+ {
+ if (((GSettingsKey) key).error_hard_conflicting_key)
+ {
+ conflicting_key_warning_revealer.set_reveal_child (false);
+ hard_conflicting_key_error_revealer.set_reveal_child (true);
+ }
+ else if (((GSettingsKey) key).warning_conflicting_key)
+ {
+ conflicting_key_warning_revealer.set_reveal_child (true);
+ hard_conflicting_key_error_revealer.set_reveal_child (false);
+ }
+ else
+ {
+ conflicting_key_warning_revealer.set_reveal_child (false);
+ hard_conflicting_key_error_revealer.set_reveal_child (false);
+ }
+ }
no_schema_warning.set_reveal_child (!has_schema);
properties_list_box.@foreach ((widget) => widget.destroy ());
@@ -109,13 +127,23 @@ class RegistryInfo : Grid, BrowsableView
if (!dict.lookup ("type-code", "s", out tmp_string)) assert_not_reached ();
- Label label = new Label (get_current_value_text (has_schema && model.is_key_default ((GSettingsKey)
key), key));
- ulong key_value_changed_handler = key.value_changed.connect (() => {
- if (!has_schema && model.is_key_ghost ((DConfKey) key))
- label.set_text (_("Key erased."));
- else
- label.set_text (get_current_value_text (has_schema && model.is_key_default
((GSettingsKey) key), key));
- });
+ ulong key_value_changed_handler = 0;
+ Label label;
+ if (key is GSettingsKey && ((GSettingsKey) key).error_hard_conflicting_key)
+ {
+ label = new Label (_("There are conflicting definitions of this key, getting value would be
either problematic or meaningless."));
+ label.get_style_context ().add_class ("italic-label");
+ }
+ else
+ {
+ label = new Label (get_current_value_text (has_schema && model.is_key_default ((GSettingsKey)
key), key));
+ key_value_changed_handler = key.value_changed.connect (() => {
+ if (!has_schema && model.is_key_ghost ((DConfKey) key))
+ label.set_text (_("Key erased."));
+ else
+ label.set_text (get_current_value_text (has_schema && model.is_key_default
((GSettingsKey) key), key));
+ });
+ }
label.halign = Align.START;
label.valign = Align.START;
label.xalign = 0;
@@ -125,6 +153,9 @@ class RegistryInfo : Grid, BrowsableView
label.show ();
add_row_from_widget (_("Current value"), label, null);
+ if (key is GSettingsKey && ((GSettingsKey) key).error_hard_conflicting_key)
+ return;
+
add_separator ();
KeyEditorChild key_editor_child = create_child (key, has_schema);
@@ -217,6 +248,8 @@ class RegistryInfo : Grid, BrowsableView
add_row_from_widget (_("Custom value"), key_editor_child, tmp_string);
key_editor_child.destroy.connect (() => {
+ if (key_value_changed_handler == 0)
+ assert_not_reached ();
key.disconnect (key_value_changed_handler);
key_editor_child.disconnect (value_has_changed_handler);
key_editor_child.disconnect (child_activated_handler);
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 3a42c24..21763ab 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -94,10 +94,10 @@ class RegistryView : Grid, BrowsableView
if (selected_row != null)
((!) selected_row).grab_focus ();
}
- public void select_row_named (string selected, bool grab_focus)
+ public void select_row_named (string selected, string context, bool grab_focus)
{
check_resize ();
- ListBoxRow? row = key_list_box.get_row_at_index (get_row_position (selected));
+ ListBoxRow? row = key_list_box.get_row_at_index (get_row_position (selected, context));
if (row == null)
assert_not_reached ();
scroll_to_row ((!) row, grab_focus);
@@ -108,7 +108,7 @@ class RegistryView : Grid, BrowsableView
if (row != null)
scroll_to_row ((!) row, grab_focus);
}
- private int get_row_position (string selected)
+ private int get_row_position (string selected, string context)
requires (key_model != null)
{
uint position = 0;
@@ -116,7 +116,12 @@ class RegistryView : Grid, BrowsableView
{
SettingObject object = (SettingObject) ((!) key_model).get_object (position);
if (object.full_name == selected)
- return (int) position;
+ {
+ if (object is Directory
+ || context == ".dconf" && object is DConfKey // theorical?
+ || object is GSettingsKey && ((GSettingsKey) object).schema_id == context)
+ return (int) position;
+ }
position++;
}
return 0; // selected row may have been removed
diff --git a/editor/setting-object.vala b/editor/setting-object.vala
index f3346af..b1024a1 100644
--- a/editor/setting-object.vala
+++ b/editor/setting-object.vala
@@ -42,8 +42,6 @@ public abstract class SettingObject : Object
public class Directory : SettingObject
{
- public bool warning_multiple_schemas = false;
-
public Directory (string full_name, string name)
{
Object (full_name: full_name, name: name);
@@ -295,6 +293,9 @@ public class DConfKey : Key
public class GSettingsKey : Key
{
+ public bool warning_conflicting_key = false;
+ public bool error_hard_conflicting_key = false;
+
public string schema_id { get; construct; }
public string? schema_path { private get; construct; }
public string summary { get; construct; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]