[Libreoffice-commits] core.git: configmgr/source

Stephan Bergmann sbergman at redhat.com
Wed Sep 2 08:07:00 PDT 2015


 configmgr/source/components.cxx |    3 ++-
 configmgr/source/dconf.cxx      |   12 ++++++++----
 configmgr/source/dconf.hxx      |    2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit ec7329f6353ada02d8d02dd7607b2c06d097e8a5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Sep 2 16:55:45 2015 +0200

    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

diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index a51c5ac..ca08940 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 ce871a3..7c69eb5 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<DConfClient> 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<Node>(), 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<Node>(), i.first,
+                components, cs, getRoot(false), rtl::Reference<Node>(), 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 f7f5970..1086c77 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);
 


More information about the Libreoffice-commits mailing list