[dconf-editor] Add temp ca.desrt.dconf-editor.Bookmarks schema.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Add temp ca.desrt.dconf-editor.Bookmarks schema.
- Date: Mon, 22 Jan 2018 04:35:57 +0000 (UTC)
commit 442e10caa27d6298e074c92e4624d31f7f79a239
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Jan 22 05:26:52 2018 +0100
Add temp ca.desrt.dconf-editor.Bookmarks schema.
editor/bookmarks.vala | 10 ++++++++--
editor/ca.desrt.dconf-editor.gschema.xml | 12 +++++++-----
editor/dconf-editor.ui | 2 +-
editor/dconf-editor.vala | 6 ++++++
editor/dconf-window.vala | 8 ++++----
editor/source-manager.vala | 6 ++++++
6 files changed, 32 insertions(+), 12 deletions(-)
---
diff --git a/editor/bookmarks.vala b/editor/bookmarks.vala
index 40f7466..3b8fd77 100644
--- a/editor/bookmarks.vala
+++ b/editor/bookmarks.vala
@@ -34,14 +34,15 @@ public class Bookmarks : MenuButton
update_icon_and_switch ();
}
- public string schema_id { get; construct; }
+ private string schema_id = "ca.desrt.dconf-editor.Bookmarks"; // TODO move in a library
+ public string schema_path { get; construct; }
private GLib.Settings settings;
private ulong switch_active_handler = 0;
construct
{
- settings = new GLib.Settings (schema_id);
+ settings = new GLib.Settings.with_path (schema_id, schema_path);
switch_active_handler = bookmarked_switch.notify ["active"].connect (switch_changed_cb);
ulong bookmarks_changed_handler = settings.changed ["bookmarks"].connect (() => {
@@ -56,6 +57,11 @@ public class Bookmarks : MenuButton
bookmarked_switch.destroy.connect (() => bookmarked_switch.disconnect (switch_active_handler));
}
+ public string [] get_bookmarks ()
+ {
+ return settings.get_strv ("bookmarks");
+ }
+
private void update_icon_and_switch ()
{
if (current_path in settings.get_strv ("bookmarks"))
diff --git a/editor/ca.desrt.dconf-editor.gschema.xml b/editor/ca.desrt.dconf-editor.gschema.xml
index 88f755e..86fb1d7 100644
--- a/editor/ca.desrt.dconf-editor.gschema.xml
+++ b/editor/ca.desrt.dconf-editor.gschema.xml
@@ -111,11 +111,6 @@
<summary>A flag to enable maximized mode</summary>
<description>A flag to enable maximized mode</description>
</key>
- <key name="bookmarks" type="as">
- <default>[]</default>
- <summary>A list of bookmarked paths</summary>
- <description>Contains all paths bookmarked by the user as an array of strings.</description>
- </key>
<key name="restore-view" type="b">
<default>true</default>
<summary>A flag to restore the last view</summary>
@@ -184,6 +179,13 @@
<description>A dictionary that maps schema IDs with path specifications. It is used to allow the user
to associate a relocatable schema to certain paths. Path specifications may contain wildcards in the form of
empty segments (e.g. /ca/desrt/dconf-editor//), defining possibly multiple paths. The same schema ID may be
associated with multiple path specifications.</description>
</key>
</schema>
+ <schema id="ca.desrt.dconf-editor.Bookmarks">
+ <key name="bookmarks" type="as">
+ <default>[]</default>
+ <summary>A list of bookmarked paths</summary>
+ <description>Contains all paths bookmarked by the user as an array of strings.</description>
+ </key>
+ </schema>
<enum id="ca.desrt.dconf-editor.DemoEnum">
<value value="0" nick="Red"/>
<value value="4" nick="White"/>
diff --git a/editor/dconf-editor.ui b/editor/dconf-editor.ui
index 8f3f71a..45b6873 100644
--- a/editor/dconf-editor.ui
+++ b/editor/dconf-editor.ui
@@ -81,7 +81,7 @@
<property name="visible">True</property>
<property name="valign">center</property>
<property name="focus-on-click">False</property>
- <property name="schema-id">ca.desrt.dconf-editor.Settings</property>
+ <property name="schema-path">/ca/desrt/dconf-editor/</property>
<property name="sensitive" bind-source="search-toggle" bind-property="active"
bind-flags="sync-create|invert-boolean"/>
<!-- <accelerator key="B" signal="activate" modifiers="GDK_CONTROL_MASK"/> TODO -->
<style>
diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala
index 94633ba..9f2fb9e 100644
--- a/editor/dconf-editor.vala
+++ b/editor/dconf-editor.vala
@@ -17,6 +17,10 @@
class ConfigurationEditor : Gtk.Application
{
+ public static string [,] internal_mappings = {
+ {"ca.desrt.dconf-editor.Bookmarks",
+ "/ca/desrt/dconf-editor/"}
+ };
public static string [,] known_mappings = {
{"com.gexperts.Tilix.Profile",
"/com/gexperts/Tilix/profiles//"},
@@ -198,6 +202,8 @@ class ConfigurationEditor : Gtk.Application
string [] schemas_ids = {};
for (int i = 0; i < known_mappings.length [0]; i++)
schemas_ids += known_mappings [i,0];
+ for (int i = 0; i < internal_mappings.length [0]; i++)
+ schemas_ids += internal_mappings [i,0];
foreach (string schema_id in relocatable_schemas)
{
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 685b278..a8d8e9d 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -421,7 +421,7 @@ class DConfWindow : ApplicationWindow
private void reload_search (/* SimpleAction action, Variant? path_variant */)
{
reload_search_action.set_enabled (false);
- browser_view.reload_search (current_path, settings.get_strv ("bookmarks"));
+ browser_view.reload_search (current_path, bookmarks_button.get_bookmarks ());
}
private void reset_recursively (SimpleAction action, Variant? path_variant)
@@ -532,7 +532,7 @@ class DConfWindow : ApplicationWindow
else if (browser_view.current_view_is_properties_view ())
request_object_path (current_path, false);
else if (browser_view.current_view_is_search_results_view ())
- browser_view.reload_search (current_path, settings.get_strv ("bookmarks"));
+ browser_view.reload_search (current_path, bookmarks_button.get_bookmarks ());
}
/*\
@@ -608,10 +608,10 @@ class DConfWindow : ApplicationWindow
if (reload_search_action.get_enabled ())
{
reload_search_action.set_enabled (false);
- browser_view.reload_search (current_path, settings.get_strv ("bookmarks"));
+ browser_view.reload_search (current_path, bookmarks_button.get_bookmarks ());
}
// do not place in an "else"
- browser_view.show_search_view (search_entry.text, current_path, settings.get_strv ("bookmarks"));
+ browser_view.show_search_view (search_entry.text, current_path, bookmarks_button.get_bookmarks ());
}
[GtkCallback]
diff --git a/editor/source-manager.vala b/editor/source-manager.vala
index fe38558..1ab6644 100644
--- a/editor/source-manager.vala
+++ b/editor/source-manager.vala
@@ -136,6 +136,12 @@ public class SourceManager : Object
for (int i = 0; i < known_mappings.length [0]; i++)
add_relocatable_schema_info (relocatable_schema_paths, known_mappings [i,0], known_mappings
[i,1]);
}
+ if (built_in_schemas || internal_schemas)
+ {
+ string [,] internal_mappings = ConfigurationEditor.internal_mappings;
+ for (int i = 0; i < internal_mappings.length [0]; i++)
+ add_relocatable_schema_info (relocatable_schema_paths, internal_mappings [i,0],
internal_mappings [i,1]);
+ }
if (startup_schemas)
{
startup_relocatable_schema_paths.foreach ((schema_id, paths) => {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]