r23442 - gnucash/trunk/src - Preferences fixes

Geert Janssens gjanssens at code.gnucash.org
Tue Nov 26 04:51:36 EST 2013


Author: gjanssens
Date: 2013-11-26 04:51:35 -0500 (Tue, 26 Nov 2013)
New Revision: 23442
Trac: http://svn.gnucash.org/trac/changeset/23442

Modified:
   gnucash/trunk/src/app-utils/gnc-gsettings.c
   gnucash/trunk/src/app-utils/gnc-prefs-utils.c
   gnucash/trunk/src/bin/gnucash-bin.c
Log:
Preferences fixes

- move GNC_GSETTINGS_PREFIX parsing to a location that it is also used in the python bindings
- read backup retain policy related settings before testing if they are valid

Modified: gnucash/trunk/src/app-utils/gnc-gsettings.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-gsettings.c	2013-11-26 09:51:11 UTC (rev 23441)
+++ gnucash/trunk/src/app-utils/gnc-gsettings.c	2013-11-26 09:51:35 UTC (rev 23442)
@@ -127,6 +127,14 @@
 const gchar *
 gnc_gsettings_get_prefix (void)
 {
+    if (!gsettings_prefix)
+    {
+        const char *prefix = g_getenv("GNC_GSETTINGS_PREFIX");
+        if (prefix)
+            gsettings_prefix = prefix;
+        else
+            gsettings_prefix = GSET_SCHEMA_PREFIX;
+    }
     return gsettings_prefix;
 }
 

Modified: gnucash/trunk/src/app-utils/gnc-prefs-utils.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-prefs-utils.c	2013-11-26 09:51:11 UTC (rev 23441)
+++ gnucash/trunk/src/app-utils/gnc-prefs-utils.c	2013-11-26 09:51:35 UTC (rev 23442)
@@ -74,6 +74,11 @@
 {
     gnc_gsettings_load_backend();
 
+    /* Initialize the core preferences by reading their values from the loaded backend */
+    file_retain_changed_cb (NULL, NULL, NULL);
+    file_retain_type_changed_cb (NULL, NULL, NULL);
+    file_compression_changed_cb (NULL, NULL, NULL);
+
     /* Check for invalid retain_type (days)/retain_days (0) combo.
      * This can happen either because a user changed the preferences
      * manually outside of GnuCash, or because the user upgraded from
@@ -105,8 +110,4 @@
     gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_FILE_COMPRESSION,
                            file_compression_changed_cb, NULL);
 
-    /* Call the hooks once manually to initialize the core preferences */
-    file_retain_changed_cb (NULL, NULL, NULL);
-    file_retain_type_changed_cb (NULL, NULL, NULL);
-    file_compression_changed_cb (NULL, NULL, NULL);
 }

Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2013-11-26 09:51:11 UTC (rev 23441)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2013-11-26 09:51:35 UTC (rev 23442)
@@ -567,15 +567,8 @@
     gnc_prefs_set_debugging(debugging);
     gnc_prefs_set_extra(extra);
 
-    if (!gsettings_prefix)
-    {
-        const char *prefix = g_getenv("GNC_GSETTINGS_PREFIX");
-        if (prefix)
-            gsettings_prefix = prefix;
-        else
-            gsettings_prefix = GSET_SCHEMA_PREFIX;
-    }
-    gnc_gsettings_set_prefix(g_strdup(gsettings_prefix));
+    if (gsettings_prefix)
+        gnc_gsettings_set_prefix(g_strdup(gsettings_prefix));
 
     if (namespace_regexp)
         gnc_prefs_set_namespace_regexp(namespace_regexp);



More information about the gnucash-changes mailing list