From 5b4d2f05ab74fc8cb806a83576c45f9d712477b8a63feb9ce8773f1f23171a48 Mon Sep 17 00:00:00 2001 From: Richard Brown Date: Sun, 8 Jun 2014 11:57:21 +0000 Subject: [PATCH 1/3] Accepting request 236169 from home:mgorse:branches:GNOME:Factory - Add dconf-use-g_settings_get_default_value.patch: Display correct default value when a custom database is in use (bnc#873225) OBS-URL: https://build.opensuse.org/request/show/236169 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/dconf?expand=0&rev=66 --- dconf-use-g_settings_get_default_value.patch | 199 +++++++++++++++++++ dconf.changes | 7 + dconf.spec | 3 + 3 files changed, 209 insertions(+) create mode 100644 dconf-use-g_settings_get_default_value.patch diff --git a/dconf-use-g_settings_get_default_value.patch b/dconf-use-g_settings_get_default_value.patch new file mode 100644 index 0000000..7f016e7 --- /dev/null +++ b/dconf-use-g_settings_get_default_value.patch @@ -0,0 +1,199 @@ +From f6bf1516b480ceb13b54ac401b45426e4bc8ed6d Mon Sep 17 00:00:00 2001 +From: Mike Gorse +Date: Thu, 1 May 2014 12:56:11 -0500 +Subject: [PATCH] Use g_settings_get_default_value() to retrieve default values + +GSettings now has an API to retrieve a default value, and using it is +more reliable than parsing the schema ourselves. + +https://bugzilla.gnome.org/show_bug.cgi?id=668234 +--- + editor/dconf-editor.vala | 5 ++- + editor/dconf-model.vala | 7 ++++- + editor/dconf-schema.vala | 80 +----------------------------------------------- + 3 files changed, 11 insertions(+), 81 deletions(-) + +diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala +index 671b9b5..467a6c6 100644 +--- a/editor/dconf-editor.vala ++++ b/editor/dconf-editor.vala +@@ -223,7 +223,10 @@ class ConfigurationEditor : Gtk.Application + if (selected_key.schema != null) + { + var gettext_domain = selected_key.schema.gettext_domain; ++ Settings settings; ++ + schema_name = selected_key.schema.schema.id; ++ settings = new Settings (schema_name); + if (selected_key.schema.summary != null) + summary = selected_key.schema.summary; + if (gettext_domain != null && summary != "") +@@ -233,7 +236,7 @@ class ConfigurationEditor : Gtk.Application + if (gettext_domain != null && description != "") + description = dgettext(gettext_domain, description); + type = key_to_description(selected_key); +- default_value = selected_key.schema.default_value.print(false); ++ default_value = settings.get_default_value (((Key)(iter.user_data)).name).print(false); + } + else + { +diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala +index 8b43d60..ae25f86 100644 +--- a/editor/dconf-model.vala ++++ b/editor/dconf-model.vala +@@ -37,6 +37,7 @@ public class Key : GLib.Object + } + + private Variant? _value; ++ private Variant? _default_value; + public Variant value + { + get +@@ -45,7 +46,11 @@ public class Key : GLib.Object + if (_value != null) + return _value; + else +- return schema.default_value; ++ { ++ var settings = new Settings (schema.schema.id); ++ _default_value = settings.get_default_value (name); ++ return _default_value; ++ } + } + set + { +diff --git a/editor/dconf-schema.vala b/editor/dconf-schema.vala +index fd35fb2..862eff3 100644 +--- a/editor/dconf-schema.vala ++++ b/editor/dconf-schema.vala +@@ -3,7 +3,6 @@ public class SchemaKey + public Schema schema; + public string name; + public string type; +- public Variant default_value; + public SchemaValueRange? range; + public SchemaValueRange type_range; + public List choices; +@@ -40,18 +39,7 @@ public class SchemaKey + + for (var child = node->children; child != null; child = child->next) + { +- if (child->name == "default") +- { +- try +- { +- default_value = Variant.parse(new VariantType(type), child->get_content()); +- } +- catch (VariantParseError e) +- { +- // ... +- } +- } +- else if (child->name == "summary") ++ if (child->name == "summary") + summary = child->get_content(); + else if (child->name == "description") + description = child->get_content(); +@@ -129,9 +117,6 @@ public class SchemaKey + else if (child->type != Xml.ElementType.TEXT_NODE && child->type != Xml.ElementType.COMMENT_NODE) + warning ("Unknown child tag in , <%s>", child->name); + } +- +- //if (default_value == null) +- // ? + } + } + +@@ -248,9 +233,6 @@ public class SchemaEnum + else if (child->type != Xml.ElementType.TEXT_NODE && child->type != Xml.ElementType.COMMENT_NODE) + warning ("Unknown tag in , <%s>", child->name); + } +- +- //if (default_value == null) +- // ? + } + } + +@@ -301,9 +283,6 @@ public class SchemaFlags + else if (child->type != Xml.ElementType.TEXT_NODE && child->type != Xml.ElementType.COMMENT_NODE) + warning ("Unknown tag in , <%s>", child->name); + } +- +- //if (default_value == null) +- // ? + } + } + +@@ -407,53 +386,6 @@ public class SchemaList + delete doc; + } + +- public void parse_override(string path) +- { +- var keyfile = new KeyFile(); +- try +- { +- keyfile.load_from_file(path, KeyFileFlags.NONE); +- } +- catch (Error e) +- { +- warning("Failed to load override file %s: %s", path, e.message); +- return; +- } +- +- foreach (var group in keyfile.get_groups()) +- { +- var schema = schemas.lookup(group); +- if (schema == null) +- continue; +- +- string[] keys; +- try { keys = keyfile.get_keys(group); } catch (Error e) { continue; } +- +- foreach (var key_name in keys) +- { +- string value; +- try { value = keyfile.get_value(group, key_name); } catch (Error e) { continue; } +- +- var key = schema.keys.lookup (key_name); +- if (key == null) +- continue; +- +- Variant default_value; +- try +- { +- default_value = Variant.parse(new VariantType(key.type), value); +- } +- catch (VariantParseError e) +- { +- // ... +- continue; +- } +- +- key.default_value = default_value; +- } +- } +- } +- + public void load_directory(string dir) throws Error + { + var directory = File.new_for_path(dir); +@@ -471,15 +403,5 @@ public class SchemaList + } + + i = directory.enumerate_children (FileAttribute.STANDARD_NAME, 0, null); +- while (true) +- { +- var info = i.next_file (null); +- if (info == null) +- break; +- var name = info.get_name(); +- +- if (name.has_suffix(".override")) +- parse_override(Path.build_filename(dir, name, null)); +- } + } + } +-- +1.8.4 + diff --git a/dconf.changes b/dconf.changes index 977b0b6..3c89ac7 100644 --- a/dconf.changes +++ b/dconf.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jun 3 18:19:03 UTC 2014 - mgorse@suse.com + +- Add dconf-use-g_settings_get_default_value.patch: Display + correct default value when a custom database is in use + (bnc#873225) + ------------------------------------------------------------------- Mon Mar 24 19:49:28 UTC 2014 - zaitor@opensuse.org diff --git a/dconf.spec b/dconf.spec index 1f83199..bbc0f0c 100644 --- a/dconf.spec +++ b/dconf.spec @@ -25,6 +25,8 @@ Group: System/Libraries Url: http://live.gnome.org/dconf Source: http://download.gnome.org/sources/dconf/0.20/%{name}-%{version}.tar.xz Source99: baselibs.conf +# PATCH-FIX-UPSTREAM dconf-use-g_settings_get_default_value.patch bnc#873225 bgo#668234 mgorse@suse.com -- Have editor display correct default value when an administrator has a custom database. +Patch0: dconf-use-g_settings_get_default_value.patch # For directory ownership BuildRequires: dbus-1 BuildRequires: docbook-xsl-stylesheets @@ -127,6 +129,7 @@ have configuration storage systems. %lang_package %prep %setup -q +%patch0 -p1 %if 0%{?BUILD_FROM_VCS} [ -x ./autogen.sh ] && NOCONFIGURE=1 ./autogen.sh From 2a9cae5b2ad51fc7c7282457568bab698fd9e7d8befd221de5bce6ea0990413a Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Fri, 13 Jun 2014 19:25:01 +0000 Subject: [PATCH 2/3] Accepting request 237217 from home:zhangxiaofei:branches:GNOME:Factory add a special category to dconf-editor.desktop so that gnome control center can show it (bnc#866235) OBS-URL: https://build.opensuse.org/request/show/237217 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/dconf?expand=0&rev=67 --- dconf.changes | 6 ++++++ dconf.spec | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dconf.changes b/dconf.changes index 3c89ac7..79a5410 100644 --- a/dconf.changes +++ b/dconf.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jun 13 09:55:39 UTC 2014 - fezhang@suse.com + +- Add category X-GNOME-SystemSettings to dconf-editor.desktop so + that gnome-control-center can recongnize and show it (bnc#866235) + ------------------------------------------------------------------- Tue Jun 3 18:19:03 UTC 2014 - mgorse@suse.com diff --git a/dconf.spec b/dconf.spec index bbc0f0c..58e8660 100644 --- a/dconf.spec +++ b/dconf.spec @@ -146,7 +146,7 @@ have configuration storage systems. %install %makeinstall find %{buildroot}%{_libdir} -name '*.la' -type f -delete -print -%suse_update_desktop_file %{buildroot}%{_datadir}/applications/dconf-editor.desktop SystemSetup +%suse_update_desktop_file %{buildroot}%{_datadir}/applications/dconf-editor.desktop SystemSetup X-GNOME-SystemSettings mkdir -p %{buildroot}%{_sysconfdir}/dconf/{profile,db} %find_lang %{name} From 066885a25ca075d43ba1d45cdc71b484e8c5291e202b6e39b1186de6b175cbf9 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Fri, 13 Jun 2014 19:31:06 +0000 Subject: [PATCH 3/3] tweak OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/dconf?expand=0&rev=68 --- dconf.changes | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dconf.changes b/dconf.changes index 79a5410..1ec583b 100644 --- a/dconf.changes +++ b/dconf.changes @@ -2,7 +2,8 @@ Fri Jun 13 09:55:39 UTC 2014 - fezhang@suse.com - Add category X-GNOME-SystemSettings to dconf-editor.desktop so - that gnome-control-center can recongnize and show it (bnc#866235) + that gnome-control-center can recongnize and show it + (bnc#866235). ------------------------------------------------------------------- Tue Jun 3 18:19:03 UTC 2014 - mgorse@suse.com