r23273 - gnucash/trunk - Gnc-Prefs: add code to migrate settings from gconf to gsettings at runtime

Geert Janssens gjanssens at code.gnucash.org
Mon Oct 7 10:32:03 EDT 2013


Author: gjanssens
Date: 2013-10-07 10:32:02 -0400 (Mon, 07 Oct 2013)
New Revision: 23273
Trac: http://svn.gnucash.org/trac/changeset/23273

Added:
   gnucash/trunk/src/app-utils/make-prefs-migration-script.xsl
   gnucash/trunk/src/app-utils/migratable-prefs.xml
   gnucash/trunk/src/app-utils/migrate-prefs.scm
Modified:
   gnucash/trunk/configure.ac
   gnucash/trunk/src/app-utils/Makefile.am
   gnucash/trunk/src/app-utils/app-utils.scm
   gnucash/trunk/src/app-utils/gnc-gsettings.c
   gnucash/trunk/src/app-utils/gnc-gsettings.h
   gnucash/trunk/src/app-utils/gncmod-app-utils.c
   gnucash/trunk/src/core-utils/core-utils.scm
Log:
Gnc-Prefs: add code to migrate settings from gconf to gsettings at runtime

Modified: gnucash/trunk/configure.ac
===================================================================
--- gnucash/trunk/configure.ac	2013-10-07 14:31:50 UTC (rev 23272)
+++ gnucash/trunk/configure.ac	2013-10-07 14:32:02 UTC (rev 23273)
@@ -485,6 +485,14 @@
 LIBS="$oLIBS"
 
 ### --------------------------------------------------------------------------
+### LIBXSLT
+
+PKG_CHECK_MODULES(LIBXSLT, libxslt)
+AS_SCRUB_INCLUDE(LIBXLT_CFLAGS)
+AC_SUBST(LIBXSLT_CFLAGS)
+AC_SUBST(LIBXSLT_LIBS)
+
+### --------------------------------------------------------------------------
 ### Zlib
 
 ZLIB_LIBS=-lz

Modified: gnucash/trunk/src/app-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/app-utils/Makefile.am	2013-10-07 14:31:50 UTC (rev 23272)
+++ gnucash/trunk/src/app-utils/Makefile.am	2013-10-07 14:32:02 UTC (rev 23273)
@@ -33,7 +33,9 @@
   ${GUILE_INCS} \
   ${PYTHON_CPPFLAGS} \
   ${GLIB_CFLAGS} \
-  ${GTK_CFLAGS}
+  ${GTK_CFLAGS} \
+  ${LIBXML2_CFLAGS} \
+  ${LIBXSLT_CFLAGS}
 
 libgncmod_app_utils_la_SOURCES = \
   calculation/expression_parser.c \
@@ -97,7 +99,9 @@
   ${top_builddir}/src/libqof/qof/libgnc-qof.la \
   ${GTK_LIBS} \
   ${GUILE_LIBS} \
-  ${GLIB_LIBS}
+  ${GLIB_LIBS} \
+  ${LIBXML2_LIBS} \
+  ${LIBXSLT_LIBS}
 
 if BUILDING_FROM_SCM
 swig-app-utils-guile.c: app-utils.i ${top_srcdir}/src/base-typemaps.i
@@ -134,9 +138,15 @@
   config-var.scm \
   date-utilities.scm \
   hooks.scm \
+  migrate-prefs.scm \
   options.scm \
   prefs.scm \
   simple-obj.scm
+  
+prefsmigrationdir = $(GNC_SHAREDIR)
+prefsmigration_DATA = \
+  make-prefs-migration-script.xsl \
+  migratable-prefs.xml
 
 noinst_DATA = .scm-links
 
@@ -150,7 +160,8 @@
   swig-app-utils-python.c \
   app-utils.i \
   ${gncmod_DATA} \
-  ${gncscm_DATA}
+  ${gncscm_DATA} \
+  ${prefsmigration_DATA}
 
 if OS_WIN32
 libgncmod_app_utils_la_SOURCES += gnc-help-utils.c

Modified: gnucash/trunk/src/app-utils/app-utils.scm
===================================================================
--- gnucash/trunk/src/app-utils/app-utils.scm	2013-10-07 14:31:50 UTC (rev 23272)
+++ gnucash/trunk/src/app-utils/app-utils.scm	2013-10-07 14:32:02 UTC (rev 23273)
@@ -21,6 +21,7 @@
 (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
 (use-modules (gnucash gnc-module))
 (use-modules (ice-9 syncase))
+(use-modules (migrate-prefs))
 
 ;; Guile 2 needs to find the symbols from the c module at compile time already
 (cond-expand
@@ -276,6 +277,10 @@
 (export simple-obj-from-list)
 (export make-simple-obj)
 
+;; migrate-prefs.scm
+(re-export migration-prepare)
+(re-export migration-cleanup)
+
 (define gnc:*kvp-option-path* (list KVP-OPTION-PATH))
 (export gnc:*kvp-option-path*)
 

Modified: gnucash/trunk/src/app-utils/gnc-gsettings.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-gsettings.c	2013-10-07 14:31:50 UTC (rev 23272)
+++ gnucash/trunk/src/app-utils/gnc-gsettings.c	2013-10-07 14:32:02 UTC (rev 23273)
@@ -27,14 +27,29 @@
 #include <stdio.h>
 #include <string.h>
 #include "gnc-gsettings.h"
+#include "gnc-path.h"
+#include "guile-mappings.h"
+#include <libguile.h>
 #include "libqof/qof/qof.h"
 #include "gnc-prefs-p.h"
 
+#include <libxml/xmlmemory.h>
+#include <libxml/debugXML.h>
+#include <libxml/HTMLtree.h>
+#include <libxml/xmlIO.h>
+#include <libxml/xinclude.h>
+#include <libxml/catalog.h>
+#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
+#include <libxslt/transform.h>
+#include <libxslt/xsltutils.h>
+
 #define CLIENT_TAG  "%s-%s-client"
 #define NOTIFY_TAG  "%s-%s-notify_id"
 
 static GHashTable *schema_hash = NULL;
 static const gchar *gsettings_prefix;
+static xmlExternalEntityLoader defaultEntityLoader = NULL;
 
 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = G_LOG_DOMAIN;
@@ -276,6 +291,7 @@
     GSettings *schema_ptr = gnc_gsettings_get_schema_ptr (schema);
     g_return_val_if_fail (G_IS_SETTINGS (schema_ptr), FALSE);
 
+    ENTER("schema: %s, key: %s", schema, key);
     if (gnc_gsettings_is_valid_key (schema_ptr, key))
     {
         result = g_settings_set_boolean (schema_ptr, key, value);
@@ -285,6 +301,7 @@
     else
         PERR ("Invalid key %s for schema %s", key, schema);
 
+    LEAVE("result %i", result);
     return result;
 }
 
@@ -387,6 +404,7 @@
     GSettings *schema_ptr = gnc_gsettings_get_schema_ptr (schema);
     g_return_val_if_fail (G_IS_SETTINGS (schema_ptr), FALSE);
 
+    ENTER("schema: %s, key: %s", schema, key);
     if (gnc_gsettings_is_valid_key (schema_ptr, key))
     {
         result = g_settings_set_string (schema_ptr, key, value);
@@ -396,6 +414,7 @@
     else
         PERR ("Invalid key %s for schema %s", key, schema);
 
+    LEAVE("result %i", result);
     return result;
 }
 
@@ -529,5 +548,118 @@
     prefsbackend.set_value = gnc_gsettings_set_value;
     prefsbackend.reset = gnc_gsettings_reset;
     prefsbackend.reset_group = gnc_gsettings_reset_schema;
+
     LEAVE("Prefsbackend bind = %p", prefsbackend.bind);
 }
+
+/* Attempt to migrate preferences from gconf files
+    to gsettings if not already done so */
+
+/* This snippet is borrowed from the xsltproc source
+ * and adapted to help the xsl transform find our temporary
+ * files in $HOME/.gnc-migration-tmp/
+ */
+static xmlParserInputPtr
+xsltprocExternalEntityLoader(const char *URL, const char *ID,
+                             xmlParserCtxtPtr ctxt) {
+    xmlParserInputPtr ret;
+    warningSAXFunc warning = NULL;
+        xmlChar *newURL;
+    gchar *tmpdir = g_build_filename (g_getenv ("HOME"), ".gnc-migration-tmp", NULL);
+
+    int i;
+    const char *lastsegment = URL;
+    const char *iter = URL;
+
+    while (*iter != 0) {
+        if (*iter == '/')
+            lastsegment = iter + 1;
+        iter++;
+    }
+
+    if ((ctxt != NULL) && (ctxt->sax != NULL)) {
+        warning = ctxt->sax->warning;
+        ctxt->sax->warning = NULL;
+    }
+
+    if (defaultEntityLoader != NULL) {
+        ret = defaultEntityLoader(URL, ID, ctxt);
+        if (ret != NULL) {
+            if (warning != NULL)
+                ctxt->sax->warning = warning;
+            return(ret);
+        }
+    }
+
+    newURL = xmlStrdup((const xmlChar *) tmpdir);
+    newURL = xmlStrcat(newURL, (const xmlChar *) "/");
+    newURL = xmlStrcat(newURL, (const xmlChar *) lastsegment);
+    g_free (tmpdir);
+    if (newURL != NULL) {
+        ret = defaultEntityLoader((const char *)newURL, ID, ctxt);
+        if (ret != NULL) {
+            if (warning != NULL)
+                ctxt->sax->warning = warning;
+            xmlFree(newURL);
+            return(ret);
+        }
+        xmlFree(newURL);
+    }
+    if (warning != NULL) {
+        ctxt->sax->warning = warning;
+        if (URL != NULL)
+            warning(ctxt, "failed to load external entity \"%s\"\n", URL);
+        else if (ID != NULL)
+            warning(ctxt, "failed to load external entity \"%s\"\n", ID);
+    }
+    return(NULL);
+}
+
+
+void gnc_gsettings_migrate_from_gconf (void)
+{
+    gchar *pkgdatadir, *stylesheet, *input, *output;
+    gchar *migr_dir;
+    SCM migr_script;
+    SCM result = scm_c_eval_string ("(use-modules (gnucash app-utils))(migration-prepare)");
+    xsltStylesheetPtr stylesheetptr = NULL;
+    xmlDocPtr inputxml, transformedxml;
+    FILE *outfile;
+
+    pkgdatadir = gnc_path_get_pkgdatadir();
+    stylesheet = g_build_filename(pkgdatadir, "make-prefs-migration-script.xsl", NULL);
+    input      = g_build_filename(pkgdatadir, "migratable-prefs.xml", NULL);
+    migr_dir   = g_build_filename(g_getenv ("HOME"), ".gnc-migration-tmp", NULL);
+    output     = g_build_filename(migr_dir, "migrate-prefs-user.scm", NULL);
+    xmlSubstituteEntitiesDefault(1);
+    xmlLoadExtDtdDefaultValue = 1;
+    defaultEntityLoader = xmlGetExternalEntityLoader();
+    xmlSetExternalEntityLoader(xsltprocExternalEntityLoader);
+    stylesheetptr = xsltParseStylesheetFile((const xmlChar *)stylesheet);
+    inputxml = xmlParseFile(input);
+    transformedxml = xsltApplyStylesheet(stylesheetptr, inputxml, NULL);
+
+    outfile = fopen(output, "w");
+    xsltSaveResultToFile(outfile, transformedxml, stylesheetptr);
+    fclose(outfile);
+
+    migr_script = scm_from_locale_string (output);
+    scm_primitive_load (migr_script);
+    result = scm_c_eval_string ("(use-modules (migrate-prefs-user))(run-migration)");
+
+    xsltFreeStylesheet(stylesheetptr);
+    xmlFreeDoc(inputxml);
+    xmlFreeDoc(transformedxml);
+
+    xsltCleanupGlobals();
+    xmlCleanupParser();
+
+    result = scm_c_eval_string ("(use-modules (gnucash app-utils))(migration-cleanup)");
+
+    g_free (pkgdatadir);
+    g_free (stylesheet);
+    g_free (input);
+    g_free (output);
+    g_free (migr_dir);
+
+}

Modified: gnucash/trunk/src/app-utils/gnc-gsettings.h
===================================================================
--- gnucash/trunk/src/app-utils/gnc-gsettings.h	2013-10-07 14:31:50 UTC (rev 23272)
+++ gnucash/trunk/src/app-utils/gnc-gsettings.h	2013-10-07 14:32:02 UTC (rev 23273)
@@ -595,6 +595,11 @@
  */
 void gnc_gsettings_load_backend (void);
 
+
+/* Attempt to migrate preferences from gconf files
+    to gsettings if not already done so */
+void gnc_gsettings_migrate_from_gconf (void);
+
 #endif /* GNC_GSETTINGS_H */
 /** @} */
 /** @} */

Modified: gnucash/trunk/src/app-utils/gncmod-app-utils.c
===================================================================
--- gnucash/trunk/src/app-utils/gncmod-app-utils.c	2013-10-07 14:31:50 UTC (rev 23272)
+++ gnucash/trunk/src/app-utils/gncmod-app-utils.c	2013-10-07 14:32:02 UTC (rev 23273)
@@ -15,6 +15,7 @@
 #include "gnc-component-manager.h"
 #include "gnc-hooks.h"
 #include "gnc-exp-parser.h"
+#include "gnc-gsettings.h"
 
 GNC_MODULE_API_DECL(libgncmod_app_utils)
 
@@ -77,6 +78,7 @@
         gnc_component_manager_init ();
         gnc_hook_add_dangler(HOOK_STARTUP, (GFunc)gnc_exp_parser_init, NULL);
         gnc_hook_add_dangler(HOOK_SHUTDOWN, (GFunc)app_utils_shutdown, NULL);
+        gnc_gsettings_migrate_from_gconf();
     }
 
     return TRUE;

Added: gnucash/trunk/src/app-utils/make-prefs-migration-script.xsl
===================================================================
--- gnucash/trunk/src/app-utils/make-prefs-migration-script.xsl	                        (rev 0)
+++ gnucash/trunk/src/app-utils/make-prefs-migration-script.xsl	2013-10-07 14:32:02 UTC (rev 23273)
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:df="http://dateformats.data">
+<xsl:output method="text" encoding="UTF8"/>
+
+<!-- Configure lookup table for date format -->
+<xsl:key name="datefmt-lookup" match="df:dateformat" use="df:name"/>
+<xsl:variable name="dateformats-top" select="document('')/*/df:dateformats"/>
+
+<!-- Primary template - process each prefence group -->
+<xsl:template match="/">
+<!-- Write file header -->
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;  migrate-prefs.scm
+;;;  Custom generated script to migrate user preferences from
+;;;  gconf to gsettings. This should only be run once -
+;;;  when running GnuCash 2.6.x for the first time.
+;;;
+;;;  Copyright 2013 Geert Janssens <geert at kobaltwit.be>
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-module (migrate-prefs-user))
+
+(use-modules (gnucash core-utils))
+;(use-modules (gnucash gnc-module))
+;; Guile 2 needs to find the symbols from the c module at compile time already
+;(cond-expand
+;  (guile-2
+;    (eval-when
+;      (compile load eval) 
+;      (load-extension "libgnc-core-utils" "scm_init_sw_core_utils_module")))
+;  (else
+;    (load-extension "libgnc-core-utils" "scm_init_sw_core_utils_module")))
+;(use-modules (sw_core_utils))
+
+(define (run-migration)
+ <xsl:for-each select="//prefsgroup">
+  <xsl:if test="document(gconfpath)//entry">
+;; Processing preferences in group <xsl:value-of select="gschemaid"/>
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+   <xsl:variable name="gconf-top" select="document(gconfpath)/gconf"/>
+   <xsl:apply-templates select="./pref"/>
+  </xsl:if>
+ </xsl:for-each>
+ 
+(display "Preference migration has finished")(newline)
+)
+
+(export run-migration)
+</xsl:template>
+
+<!-- Process one prefence -->
+<xsl:template match="pref">
+  <xsl:variable name="gconf-top" select="document(../gconfpath)/gconf"/>
+  <xsl:apply-templates select="$gconf-top">
+   <xsl:with-param name="curr-pref" select="."/>
+  </xsl:apply-templates>
+</xsl:template>
+ 
+<!-- Find the equivalent entry in gconf -->
+<xsl:template match="gconf">
+ <xsl:param name="curr-pref"/>
+ <xsl:for-each select="entry">
+  <xsl:if test="@name = $curr-pref/gconfkey">
+;; Processing preference <xsl:value-of select="$curr-pref/gschemaname"/>
+   <xsl:apply-templates select=".">
+    <xsl:with-param name="curr-pref" select="$curr-pref"/>
+   </xsl:apply-templates>
+  </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+<!-- Determine next action based on preference type -->
+<xsl:template match="entry">
+ <xsl:param name="curr-pref"/>
+  <xsl:choose>
+   <xsl:when test="$curr-pref/gschematype = 'b'">
+;; Gconf value (boolean): <xsl:value-of select="./@value"/>
+(gnc-prefs-set-bool
+    ; preference group
+    "<xsl:value-of select="$curr-pref/../gschemaid"/>"
+    ; preference name
+    "<xsl:value-of select="$curr-pref/gschemaname"/>"
+    ; preference value
+    <xsl:if test="./@value = 'true'">#t</xsl:if>
+    <xsl:if test="./@value = 'false'">#f</xsl:if>
+)
+   </xsl:when>
+   
+
+   <xsl:when test="$curr-pref/gschematype = 'datefmt'">
+;; Gconf value (string): "<xsl:value-of select="./stringvalue"/>" -> gsettings (integer)
+(gnc-prefs-set-int
+    ; preference group
+    "<xsl:value-of select="$curr-pref/../gschemaid"/>"
+    ; preference name
+    "<xsl:value-of select="$curr-pref/gschemaname"/>"
+    ; preference value
+    <xsl:apply-templates select="$dateformats-top">
+     <xsl:with-param name="curr-entry" select="."/>
+    </xsl:apply-templates>
+)
+   </xsl:when>
+
+
+   <xsl:when test="$curr-pref/gschematype = '(dd)'">
+;; Type: pair of decimals (stored in Gconf as [d,d])
+; guile command to write pair of decimals value
+   </xsl:when>
+
+
+   <xsl:when test="$curr-pref/gschematype = 'd'">
+;; Gconf value (decimal): <xsl:value-of select="./@value"/>
+(gnc-prefs-set-float
+    ; preference group
+    "<xsl:value-of select="$curr-pref/../gschemaid"/>"
+    ; preference name
+    "<xsl:value-of select="$curr-pref/gschemaname"/>"
+    ; preference value
+    <xsl:value-of select="./@value"/>
+)
+   </xsl:when>
+
+
+   <xsl:when test="$curr-pref/gschematype = 'i'">
+;; Gconf value (integer): <xsl:value-of select="./@value"/>
+(gnc-prefs-set-int
+    ; preference group
+    "<xsl:value-of select="$curr-pref/../gschemaid"/>"
+    ; preference name
+    "<xsl:value-of select="$curr-pref/gschemaname"/>"
+    ; preference value
+    <xsl:value-of select="./@value"/>
+)
+   </xsl:when>
+
+
+   <xsl:when test="$curr-pref/gschematype = 's2b'">
+;; Gconf value (string): "<xsl:value-of select="./stringvalue"/>" -> gsettings (boolean)
+(let ((suffix (string-delete "<xsl:value-of select="./stringvalue"/>" #\_)))
+     (gnc-prefs-set-bool
+         ; preference group
+         "<xsl:value-of select="$curr-pref/../gschemaid"/>"
+         ; preference name
+         "<xsl:value-of select="$curr-pref/gschemaname"/>"
+         ; preference value
+         (string-suffix? suffix "<xsl:value-of select="$curr-pref/gschemaname"/>")))
+   </xsl:when>
+
+
+   <xsl:when test="$curr-pref/gschematype = 's'">
+;; Gconf value (string): "<xsl:value-of select="./stringvalue"/>"
+(gnc-prefs-set-string
+    ; preference group
+    "<xsl:value-of select="$curr-pref/../gschemaid"/>"
+    ; preference name
+    "<xsl:value-of select="$curr-pref/gschemaname"/>"
+    ; preference value
+    "<xsl:value-of select="./stringvalue"/>"
+)
+   </xsl:when>
+
+
+   <xsl:when test="$curr-pref/gschematype = 'x'">
+;; Gconf value (64bit integer): <xsl:value-of select="./@value"/>
+(gnc-prefs-set-int64
+    ; preference group
+    "<xsl:value-of select="$curr-pref/../gschemaid"/>"
+    ; preference name
+    "<xsl:value-of select="$curr-pref/gschemaname"/>"
+    ; preference value
+    <xsl:value-of select="./@value"/>
+)
+   </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="df:dateformats">
+ <xsl:param name="curr-entry"/>
+ <xsl:value-of select="key('datefmt-lookup', $curr-entry/stringvalue)/df:index"/>
+</xsl:template>
+
+
+<df:dateformats>
+  <df:dateformat><df:name>us</df:name><df:index>0</df:index></df:dateformat>
+  <df:dateformat><df:name>uk</df:name><df:index>1</df:index></df:dateformat>
+  <df:dateformat><df:name>ce</df:name><df:index>2</df:index></df:dateformat>
+  <df:dateformat><df:name>iso</df:name><df:index>3</df:index></df:dateformat>
+  <df:dateformat><df:name>locale</df:name><df:index>4</df:index></df:dateformat>
+</df:dateformats>
+
+</xsl:stylesheet>
\ No newline at end of file

Added: gnucash/trunk/src/app-utils/migratable-prefs.xml
===================================================================
--- gnucash/trunk/src/app-utils/migratable-prefs.xml	                        (rev 0)
+++ gnucash/trunk/src/app-utils/migratable-prefs.xml	2013-10-07 14:32:02 UTC (rev 23273)
@@ -0,0 +1,1061 @@
+<prefs>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.commodities</gschemaid>
+    <gconfpath>dialogs-edit_commodities.xml</gconfpath>
+
+    <pref>
+      <gschemaname>include-iso</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>include_iso</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.totd</gschemaid>
+    <gconfpath>dialogs-tip_of_the_day.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>current-tip</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>current_tip</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>show-at-startup</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>show_at_startup</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.reconcile</gschemaid>
+    <gconfpath>dialogs-reconcile.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>check-cleared</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>check_cleared</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>auto-interest-transfer</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>auto_interest_transfer</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>auto-cc-payment</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>auto_cc_payment</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>always-reconcile-to-today</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>always_reconcile_to_today</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.tax-info</gschemaid>
+    <gconfpath>dialogs-tax_info.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>paned-position</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>paned_position</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.find</gschemaid>
+    <gconfpath>dialogs-find.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>search-for-active-only</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>search_for_active_only</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.export-accounts</gschemaid>
+    <gconfpath>dialogs-export_accounts.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>last-path</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>last_path</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.log-replay</gschemaid>
+    <gconfpath>dialogs-log_replay.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>last-path</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>last_path</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.open-save</gschemaid>
+    <gconfpath>dialogs-open_save.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>last-path</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>last_path</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.report</gschemaid>
+    <gconfpath>dialogs-report.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>last-path</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>last_path</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.lot-viewer</gschemaid>
+    <gconfpath>dialogs-lot_viewer.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>hpane-position</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>hpane_position</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>vpane-position</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>vpane_position</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.new-user</gschemaid>
+    <gconfpath>dialogs-new_user.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>first-startup</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>first_startup</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.new-hierarchy</gschemaid>
+    <gconfpath>dialogs-new_hierarchy.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>show-on-new-file</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>show_on_new_file</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.search</gschemaid>
+    <gconfpath>dialogs-search.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>new-search-limit</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>new_search_limit</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.sxs.since-last-run</gschemaid>
+    <gconfpath>dialogs-scheduled_trans-since_last_run.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>show-at-file-open</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>show_at_file_open</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.sxs.transaction-editor</gschemaid>
+    <gconfpath>dialogs-scheduled_trans-transaction_editor.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>create-auto</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>create_auto</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>create-days</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>create_days</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>notify</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>notify</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>remind-days</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>remind_days</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.window.pages.account-tree.summary</gschemaid>
+    <gconfpath>window-pages-account_tree-summary.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>grand-total</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>grand_total</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>non-currency</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>non_currency</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>start-choice-relative</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>start_choice</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>start-choice-absolute</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>start_choice</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>start-date</gschemaname>
+      <gschematype>x</gschematype>
+      <gconfkey>start_date</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>start-period</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>start_period</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>end-choice-relative</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>end_choice</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>end-choice-absolute</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>end_choice</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>end-date</gschemaname>
+      <gschematype>x</gschematype>
+      <gconfkey>end_date</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>end-period</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>end_period</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.general</gschemaid>
+    <gconfpath>general.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>save-window-geometry</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>save_window_geometry</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>account-separator</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>account_separator</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>file-compression</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>file_compression</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>autosave-show-explanation</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>autosave_show_explanation</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>autosave-interval-minutes</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>autosave_interval_minutes</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>negative-in-red</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>negative_in_red</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>auto-decimal-point</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>auto_decimal_point</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>auto-decimal-places</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>auto_decimal_places</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>retain-type-never</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>retain_type</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>retain-type-days</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>retain_type</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>retain-type-forever</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>retain_type</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>retain-days</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>retain_days</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>reversed-accounts-none</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>reversed_accounts</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>reversed-accounts-credit</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>reversed_accounts</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>reversed-accounts-incomeexpense</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>reversed_accounts</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>show-account-color</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>show_account_color</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>show-account-color-tabs</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>show_account_color_tabs</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>use-accounting-labels</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>use_accounting_labels</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>tab-close-buttons</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>tab_close_buttons</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>tab-width</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>tab_width</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>currency-choice-locale</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>currency_choice</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>currency-choice-other</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>currency_choice</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>currency-other</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>currency_other</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>clock-24h</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>24hour_clock</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>date-format</gschemaname>
+      <gschematype>datefmt</gschematype>
+      <gconfkey>date_format</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>date-completion-thisyear</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>date_completion</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>date-completion-sliding</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>date_completion</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>date-backmonths</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>date_backmonths</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>show-splash-screen</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>show_splash_screen</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>tab-position-top</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>tab_position</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>tab-position-bottom</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>tab_position</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>tab-position-left</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>tab_position</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>tab-position-right</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>tab_position</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>summarybar-position-top</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>summarybar_position</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>summarybar-position-bottom</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>summarybar_position</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>tab-next-recent</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>tab_next_recent</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>num-source</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>num_source</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.general.register</gschemaid>
+    <gconfpath>general-register.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>use-theme-colors</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>use_theme_colors</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>enter-moves-to-end</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>enter_moves_to_end</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>auto-raise-lists</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>auto_raise_lists</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>tab-includes-transfer-on-memorised</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>tab_includes_transfer_on_memorised</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>use-new-window</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>use_new_window</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>alternate-color-by-transaction</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>alternate_color_by_transaction</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>draw-horizontal-lines</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>draw_horizontal_lines</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>draw-vertical-lines</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>draw_vertical_lines</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>default-style-ledger</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>default_style</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>default-style-autoledger</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>default_style</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>default-style-journal</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>default_style</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>double-line-mode</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>double_line_mode</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>show-leaf-account-names</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>show_leaf_account_names</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>show-extra-dates</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>show_extra_dates</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>show-extra-dates-on-selection</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>show_extra_dates_on_selection</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>show-calendar-buttons</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>show_calendar_buttons</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>selection-to-blank-on-expand</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>selection_to_blank_on_expand</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>max-transactions</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>max_transactions</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>key-length</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>key_length</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.general.report</gschemaid>
+    <gconfpath>general-report.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>use-new-window</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>use_new_window</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>currency-choice-locale</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>currency_choice</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>currency-choice-other</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>currency_choice</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>currency-other</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>currency_other</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.general.report.pdf-export</gschemaid>
+    <gconfpath>general-report-pdf_export.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>filename-format</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>filename_format</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>filename-date-format</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>filename_date_format</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dev</gschemaid>
+    <gconfpath>dev.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>allow-file-incompatibility</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>allow_file_incompatibility</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.checkprinting</gschemaid>
+    <gconfpath>dialogs-print_checks.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>check-format-guid</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>check_format_guid</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>check-position</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>check_position</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>first-page-count</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>first_page_count</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>date-format</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>date_format</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>date-format-user</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>date_format_user</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>custom-units</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>custom_units</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>custom-payee</gschemaname>
+      <gschematype>(dd)</gschematype>
+      <gconfkey>custom_payee</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>custom-date</gschemaname>
+      <gschematype>(dd)</gschematype>
+      <gconfkey>custom_date</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>custom-amount-words</gschemaname>
+      <gschematype>(dd)</gschematype>
+      <gconfkey>custom_amount_words</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>custom-amount-number</gschemaname>
+      <gschematype>(dd)</gschematype>
+      <gconfkey>custom_amount_number</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>custom-address</gschemaname>
+      <gschematype>(dd)</gschematype>
+      <gconfkey>custom_address</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>custom-notes</gschemaname>
+      <gschematype>(dd)</gschematype>
+      <gconfkey>custom_notes</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>custom-memo</gschemaname>
+      <gschematype>(dd)</gschematype>
+      <gconfkey>custom_memo</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>custom-translation</gschemaname>
+      <gschematype>(dd)</gschematype>
+      <gconfkey>custom_translation</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>custom-rotation</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>custom_rotation</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>splits-amount</gschemaname>
+      <gschematype>(dd)</gschematype>
+      <gconfkey>splits_amount</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>splits-memo</gschemaname>
+      <gschematype>(dd)</gschematype>
+      <gconfkey>splits_memo</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>splits-account</gschemaname>
+      <gschematype>(dd)</gschematype>
+      <gconfkey>splits_account</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>print-date-format</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>print_date_format</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>default-font</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>default_font</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>blocking-chars</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>blocking_chars</gconfkey>
+    </pref>
+  </prefsgroup>
+
+<!--
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.import.ofx</gschemaid>
+    <gconfpath>dialogs-import-ofx.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>last-path</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>last_path</gconfkey>
+    </pref>
+  </prefsgroup>
+  -->
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.export.csv</gschemaid>
+    <gconfpath>dialogs-export-csv.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>last-path</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>last_path</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>paned-position</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>paned_position</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.import.hbci</gschemaid>
+    <gconfpath>dialogs-import-hbci.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>close-on-finish</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>close_on_finish</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>remember-pin</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>remember_pin</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>verbose-debug</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>verbose_debug</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>format-dtaus</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>format_dtaus</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>format-csv</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>format_csv</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>format-swift-mt940</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>format_swift_mt940</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>format-swift-mt942</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>format_swift_mt942</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>last-path</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>last_path</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.import.generic</gschemaid>
+    <gconfpath>dialogs-import-generic-matcher.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>enable-skip</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>enable_skip</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>enable-update</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>enable_update</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>use-bayes</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>use_bayes</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>match-threshold</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>match_threshold</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>auto-add-threshold</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>auto_add_threshold</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>auto-clear-threshold</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>auto_clear_threshold</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>atm-fee-threshold</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>atm_fee_threshold</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>auto-create-commodity</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>auto_create_commodity</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.import.csv</gschemaid>
+    <gconfpath>dialogs-import-csv.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>last-path</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>last_path</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.import.qif</gschemaid>
+    <gconfpath>dialogs-import-qif.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>default-status-notcleared</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>default_status</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>default-status-cleared</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>default_status</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>default-status-reconciled</gschemaname>
+      <gschematype>s2b</gschematype>
+      <gconfkey>default_status</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>last-path</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>last_path</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>show-doc</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>show_doc</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.history</gschemaid>
+    <gconfpath>history.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>maxfiles</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>maxfiles</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>file0</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>file0</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>file1</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>file1</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>file2</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>file2</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>file3</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>file3</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>file4</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>file4</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>file5</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>file5</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>file6</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>file6</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>file7</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>file7</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>file8</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>file8</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>file9</gschemaname>
+      <gschematype>s</gschematype>
+      <gconfkey>file9</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.business.customer-search</gschemaid>
+    <gconfpath>dialogs-business-customer_search.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>search-for-active-only</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>search_for_active_only</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.business.employee-search</gschemaid>
+    <gconfpath>dialogs-business-employee_search.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>search-for-active-only</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>search_for_active_only</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.business.invoice-search</gschemaid>
+    <gconfpath>dialogs-business-invoice_search.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>search-for-active-only</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>search_for_active_only</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.business.job-search</gschemaid>
+    <gconfpath>dialogs-business-job_search.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>search-for-active-only</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>search_for_active_only</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.business.order-search</gschemaid>
+    <gconfpath>dialogs-business-order_search.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>search-for-active-only</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>search_for_active_only</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.business.vendor-search</gschemaid>
+    <gconfpath>dialogs-business-vendor_search.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>search-for-active-only</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>search_for_active_only</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.business.invoice</gschemaid>
+    <gconfpath>dialogs-business-invoice.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>tax-included</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>tax_included</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>enable-toolbuttons</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>enable_toolbuttons</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>invoice-printreport</gschemaname>
+      <gschematype>i</gschematype>
+      <gconfkey>invoice_printreport</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>use-new-window</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>use_new_window</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>accumulate-splits</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>accumulate_splits</gconfkey>
+    </pref>
+  </prefsgroup>
+
+  <prefsgroup>
+    <gschemaid>org.gnucash.dialogs.business.bill</gschemaid>
+    <gconfpath>dialogs-business-bill.xml</gconfpath>
+    
+    <pref>
+      <gschemaname>tax-included</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>tax_included</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>notify-when-due</gschemaname>
+      <gschematype>b</gschematype>
+      <gconfkey>notify_when_due</gconfkey>
+    </pref>
+    <pref>
+      <gschemaname>days-in-advance</gschemaname>
+      <gschematype>d</gschematype>
+      <gconfkey>days_in_advance</gconfkey>
+    </pref>
+  </prefsgroup>
+</prefs>
\ No newline at end of file

Added: gnucash/trunk/src/app-utils/migrate-prefs.scm
===================================================================
--- gnucash/trunk/src/app-utils/migrate-prefs.scm	                        (rev 0)
+++ gnucash/trunk/src/app-utils/migrate-prefs.scm	2013-10-07 14:32:02 UTC (rev 23273)
@@ -0,0 +1,108 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;  migrate-prefs.scm
+;;;  Functions used to migrated user preferences from gconf
+;;;  to gsettings. Note that this module doesn't perform the
+;;;  migration itself: it merely prepares the environment to
+;;;  create the actual migration script.
+;;;
+;;;  Copyright 2013 Geert Janssens <geert at kobaltwit.be>
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-module (migrate-prefs))
+
+(use-modules (gnucash core-utils))
+
+(define gconf-dir (string-append (getenv "HOME") "/.gconf/apps/gnucash"))
+(define prefix-length (+ (string-length gconf-dir) 1))
+(define migration-dir (string-append (getenv "HOME") "/.gnc-migration-tmp"))
+
+(define (copy-one-file filename)
+(let ((stats (stat filename))
+      (base-name "")
+      (slash-index 0)
+      (dest-name ""))
+     ;(display "processing file... ")(display filename)(newline)
+     (if (eq? (stat:type stats) 'regular)
+       (begin
+         (set! base-name (string-drop filename prefix-length))
+         ;(display base-name)(newline)
+         (set! slash-index (- (string-rindex base-name #\%) 1))
+         (if (> slash-index 0)
+           (begin
+             (set! dest-name (string-take base-name (- (string-rindex base-name #\%) 1))) 
+             (set! dest-name (string-join (string-split dest-name #\/) "-"))
+             (set! dest-name (string-append migration-dir "/" dest-name ".xml"))
+             ;(format #t "~A -> ~A\n" base-name dest-name)
+             (copy-file filename dest-name)
+         ))))
+     (if (eq? (stat:type stats) 'directory)
+         (apply find copy-one-file (list filename))
+         )))
+
+
+(define (directory-files dir)
+  (if (not (access? dir R_OK))
+    '()
+    (let* ((p (opendir dir))
+           (filelist (do ((file (readdir p) (readdir p))
+                          (ls '()))
+                         ((eof-object? file) (closedir p) (reverse! ls))
+                         (if (not (string-suffix? "." file))
+                             (set! ls (cons file ls)))
+                         )))
+          (sort filelist string<))))
+
+(define (find proc . dirs)
+  (cond ((pair? dirs)
+         (for-each proc (map (lambda (x) (string-append (car dirs) "/" x))
+                             (directory-files (car dirs)))))))
+
+(define (finddepth proc . dirs)
+  (cond ((pair? dirs)
+         (apply finddepth proc (cdr dirs))
+         (for-each proc (map (lambda (x) (string-append (car dirs) "/" x))
+                             (directory-files (car dirs)))))))
+
+
+(define (migration-prepare-internal)
+; cleanup first if a previous migration attempt failed to do so
+  (if (access? migration-dir (logior R_OK W_OK X_OK))
+      (begin
+        (format #t "Clear previous tmp dir ~A\n" migration-dir)
+        (migration-cleanup-internal)))
+  (mkdir migration-dir)
+  (format #t "Copy all gconf files to tmp dir ~A\n" migration-dir)
+  (apply find copy-one-file (list gconf-dir))
+)
+
+(define (migration-prepare)
+  (if (access? gconf-dir R_OK)
+    (begin
+      (display "*** GnuCash switched to a new preferences system ***\n")
+      (display "Attempt to migrate your preferences from the old to the new system\n")
+        (catch #t
+          migration-prepare-internal
+          (lambda args 
+                  (display "An error occurred when trying to migrate preferences")))
+    )))
+
+(define (rmtree args)
+  (define (zap f)
+    (let ((rm (if (eq? (stat:type (stat f)) 'directory) rmdir delete-file)))
+      ;(format #t "deleting ~A\n" f)
+      (catch #t
+        (lambda () (rm f))
+        (lambda args (format #t "couldn't delete ~A\n" f)))))
+  (apply finddepth zap args))
+
+(define (migration-cleanup-internal)
+  (rmtree (list migration-dir))
+  (rmdir migration-dir))
+
+(define (migration-cleanup)
+  (if (access? migration-dir (logior R_OK W_OK X_OK))
+    (begin
+      (format #t "Delete tmp dir ~A\n" migration-dir)
+      (migration-cleanup-internal))))
+
+(export migration-prepare migration-cleanup)
\ No newline at end of file

Modified: gnucash/trunk/src/core-utils/core-utils.scm
===================================================================
--- gnucash/trunk/src/core-utils/core-utils.scm	2013-10-07 14:31:50 UTC (rev 23272)
+++ gnucash/trunk/src/core-utils/core-utils.scm	2013-10-07 14:32:02 UTC (rev 23273)
@@ -34,3 +34,10 @@
 (re-export gnc-scm-log-msg)
 (re-export gnc-scm-log-debug)
 (re-export gnc-locale-default-iso-currency-code)
+
+(re-export gnc-prefs-set-bool)
+(re-export gnc-prefs-set-int)
+(re-export gnc-prefs-set-int64)
+(re-export gnc-prefs-set-float)
+(re-export gnc-prefs-set-string)
+(re-export gnc-prefs-set-coords)



More information about the gnucash-changes mailing list