[dconf-editor] Handle schemas installed at the same path.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Handle schemas installed at the same path.
- Date: Mon, 22 Jan 2018 03:20:57 +0000 (UTC)
commit 340a43b24403e215915d6b30d96d4f71b8203905
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Jan 22 04:09:27 2018 +0100
Handle schemas installed at the same path.
editor/browser-view.vala | 14 ++++++++++++--
editor/dconf-model.vala | 16 ----------------
editor/registry-view.ui | 5 -----
editor/registry-view.vala | 31 +++++++++++++------------------
editor/setting-object.vala | 2 +-
5 files changed, 26 insertions(+), 42 deletions(-)
---
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 937eb9d..63a80af 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -118,7 +118,6 @@ class BrowserView : Grid
stack.set_transition_type (is_ancestor && pre_search_view == null ? StackTransitionType.CROSSFADE :
StackTransitionType.NONE);
pre_search_view = null;
hide_reload_warning ();
- browse_view.show_multiple_schemas_warning (warning_multiple_schemas);
}
public void select_row (string selected)
@@ -136,7 +135,6 @@ class BrowserView : Grid
properties_view.populate_properties_list_box (key, warning_multiple_schemas);
hide_reload_warning ();
- browse_view.show_multiple_schemas_warning (false);
stack.set_transition_type (is_parent && pre_search_view == null ? StackTransitionType.CROSSFADE :
StackTransitionType.NONE);
pre_search_view = null;
@@ -405,6 +403,14 @@ public interface SettingComparator : Object
return false;
return true;
}
+
+ protected virtual bool sort_by_schema_thirdly (SettingObject a, SettingObject b, ref int return_value)
+ {
+ if (!(a is GSettingsKey) || !(b is GSettingsKey))
+ return false;
+ return_value = strcmp (((GSettingsKey) a).schema_id, ((GSettingsKey) b).schema_id);
+ return return_value != 0;
+ }
}
class BySchemaCaseInsensitive : Object, SettingComparator
@@ -416,6 +422,8 @@ class BySchemaCaseInsensitive : Object, SettingComparator
return return_value;
if (sort_dconf_keys_second (a, b, ref return_value))
return return_value;
+ if (sort_by_schema_thirdly (a, b, ref return_value))
+ return return_value;
return a.casefolded_name.collate (b.casefolded_name);
}
@@ -430,6 +438,8 @@ class BySchemaCaseSensitive : Object, SettingComparator
return return_value;
if (sort_dconf_keys_second (a, b, ref return_value))
return return_value;
+ if (sort_by_schema_thirdly (a, b, ref return_value))
+ return return_value;
return strcmp (a.name, b.name);
}
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index aee2e88..b73150c 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -207,24 +207,8 @@ public class SettingsModel : Object
GenericSet<string> folders;
source_manager.cached_schemas.lookup (path, out schemas, out folders);
if (schemas.length > 0)
- {
- bool content_found = false;
- // prefer non-relocatable schema
foreach (SettingsSchema schema in schemas.get_values ())
- {
- if (((string?) schema.get_path ()) == null)
- continue;
create_gsettings_keys (path, (!) schema, key_model);
- content_found = true;
- break;
- }
- // otherwise any will do
- if (!content_found)
- {
- create_gsettings_keys (path, (!) schemas.iterator ().next_value (), key_model);
- content_found = true;
- }
- }
foreach (string folder in folders.get_values ())
{
diff --git a/editor/registry-view.ui b/editor/registry-view.ui
index f724e5e..5bb2f70 100644
--- a/editor/registry-view.ui
+++ b/editor/registry-view.ui
@@ -4,11 +4,6 @@
<template class="RegistryView" parent="GtkGrid">
<property name="orientation">vertical</property>
<child>
- <object class="BrowserInfoBar" id="info_bar">
- <property name="visible">True</property>
- </object>
- </child>
- <child>
<object class="GtkScrolledWindow" id="scrolled">
<property name="visible">True</property>
<property name="expand">True</property>
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 97048cc..23812d7 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -20,8 +20,6 @@ using Gtk;
[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/registry-view.ui")]
class RegistryView : Grid, BrowsableView
{
- [GtkChild] private BrowserInfoBar info_bar;
-
[GtkChild] private ScrolledWindow scrolled;
[GtkChild] private ListBox key_list_box;
@@ -47,8 +45,6 @@ class RegistryView : Grid, BrowsableView
construct
{
- info_bar.add_label ("multiple-schemas-folder", _("Multiple schemas are installed at this path. This
could lead to problems if it hasn’t been done carefully. Only one schema is displayed here. Edit values at
your own risk."));
-
key_list_box.set_header_func (update_row_header);
}
@@ -92,14 +88,6 @@ class RegistryView : Grid, BrowsableView
return false;
}
- public void show_multiple_schemas_warning (bool multiple_schemas_warning_needed)
- {
- if (multiple_schemas_warning_needed)
- info_bar.show_warning ("multiple-schemas-folder");
- else
- info_bar.hide_warning ();
- }
-
public void focus_selected_row ()
{
ListBoxRow? selected_row = key_list_box.get_selected_row ();
@@ -152,12 +140,19 @@ class RegistryView : Grid, BrowsableView
private void update_row_header (ListBoxRow row, ListBoxRow? before)
{
string? label_text = null;
- if ((row.get_child () is KeyListBoxRowEditable)
- && (before == null || !(((!) before).get_child () is KeyListBoxRowEditable)))
- label_text = _("Keys defined by a schema");
- else if ((row.get_child () is KeyListBoxRowEditableNoSchema)
- && (before == null || !(((!) before).get_child () is KeyListBoxRowEditableNoSchema)))
- label_text = _("Keys not defined by a schema");
+ if (row.get_child () is KeyListBoxRowEditable)
+ {
+ string schema_id = ((KeyListBoxRowEditable) row.get_child ()).key.schema_id;
+ if (before == null
+ || !(((!) before).get_child () is KeyListBoxRowEditable
+ && ((KeyListBoxRowEditable) ((!) before).get_child ()).key.schema_id == schema_id))
+ label_text = schema_id;
+ }
+ else if (row.get_child () is KeyListBoxRowEditableNoSchema)
+ {
+ if (before == null || !(((!) before).get_child () is KeyListBoxRowEditableNoSchema))
+ label_text = _("Keys not defined by a schema");
+ }
ListBoxRowHeader header = new ListBoxRowHeader (before == null, label_text);
row.set_header (header);
diff --git a/editor/setting-object.vala b/editor/setting-object.vala
index 621d61a..f3346af 100644
--- a/editor/setting-object.vala
+++ b/editor/setting-object.vala
@@ -295,7 +295,7 @@ public class DConfKey : Key
public class GSettingsKey : Key
{
- public string schema_id { private get; construct; }
+ public string schema_id { get; construct; }
public string? schema_path { private get; construct; }
public string summary { get; construct; }
public string description { private get; construct; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]