From ec7329f6353ada02d8d02dd7607b2c06d097e8a5 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 2 Sep 2015 16:55:45 +0200 Subject: configmgr: Split dconf in two /org/libreoffice/registry/{system,user}/ ...so that the lower-layer "dconf:*" reads from the .../system/ dconf tree while the final-layer "dconf:!" reads from and writes to the .../user/ dconf tree. Using a single tree would not really work: For one, a sysadmin will want to finalize a property so it cannot be changed by extensions; that means that property must be set and finalized in the lower-layer "dconf:*". But for another, a user will want to change a property for which an extension provides a value; that means that property must be set in the final-layer "dconf:!". So the two "dconf:*" and "dconf:!" must store their respective data in different places. Change-Id: I9029e7f779bcb86e8f26cfc22401e97e0cb3362b --- configmgr/source/components.cxx | 3 ++- configmgr/source/dconf.cxx | 12 ++++++++---- configmgr/source/dconf.hxx | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'configmgr') diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index a51c5ac8515a..ca0894015935 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -537,8 +537,9 @@ Components::Components( } else if (type == "dconf") { if (url == "!") { modificationTarget_ = ModificationTarget::Dconf; + dconf::readLayer(data_, Data::NO_LAYER, false); } else if (url == "*") { - dconf::readLayer(data_, layer); + dconf::readLayer(data_, layer, true); } else { throw css::uno::RuntimeException( "CONFIGURATION_LAYERS: unknown \"dconf\" kind \"" + url diff --git a/configmgr/source/dconf.cxx b/configmgr/source/dconf.cxx index ce871a343268..7c69eb543bda 100644 --- a/configmgr/source/dconf.cxx +++ b/configmgr/source/dconf.cxx @@ -216,6 +216,11 @@ private: DConfChangeset * changeset_; }; +OString getRoot(bool system) { + return "/org/libreoffice/registry/" + + (system ? OStringLiteral("system") : OStringLiteral("user")); +} + bool decode(OUString * string, bool slash) { for (sal_Int32 i = 0;; ++i) { i = string->indexOf('\\', i); @@ -1544,7 +1549,7 @@ bool addModifications( } -void readLayer(Data & data, int layer) { +void readLayer(Data & data, int layer, bool system) { GObjectHolder client(dconf_client_new()); if (client.get() == nullptr) { SAL_WARN("configmgr.dconf", "dconf_client_new failed"); @@ -1552,7 +1557,7 @@ void readLayer(Data & data, int layer) { } readDir( data, layer, rtl::Reference(), data.getComponents(), client, - "/org/libreoffice/registry/"); + getRoot(system) + "/"); } void writeModifications(Components & components, Data & data) { @@ -1567,8 +1572,7 @@ void writeModifications(Components & components, Data & data) { } for (auto const & i: data.modifications.getRoot().children) { if (!addModifications( - components, cs, "/org/libreoffice/registry", - rtl::Reference(), i.first, + components, cs, getRoot(false), rtl::Reference(), i.first, data.getComponents().findNode(Data::NO_LAYER, i.first), i.second)) { diff --git a/configmgr/source/dconf.hxx b/configmgr/source/dconf.hxx index f7f59703754c..1086c77a3dd4 100644 --- a/configmgr/source/dconf.hxx +++ b/configmgr/source/dconf.hxx @@ -19,7 +19,7 @@ namespace configmgr { namespace configmgr { namespace dconf { -void readLayer(Data & data, int layer); +void readLayer(Data & data, int layer, bool system); void writeModifications(Components & components, Data & data); -- cgit