r22942 - gnucash/trunk/src - Refactor file backend settings to no longer depend on gconf
Geert Janssens
gjanssens at code.gnucash.org
Fri May 3 08:03:39 EDT 2013
Author: gjanssens
Date: 2013-05-03 08:03:38 -0400 (Fri, 03 May 2013)
New Revision: 22942
Trac: http://svn.gnucash.org/trac/changeset/22942
Added:
gnucash/trunk/src/app-utils/gnc-prefs.c
gnucash/trunk/src/app-utils/gnc-prefs.h
Modified:
gnucash/trunk/src/app-utils/Makefile.am
gnucash/trunk/src/app-utils/app-utils.i
gnucash/trunk/src/app-utils/gnc-gconf-utils.c
gnucash/trunk/src/app-utils/gnc-gconf-utils.h
gnucash/trunk/src/app-utils/gnc-ui-util.c
gnucash/trunk/src/app-utils/gncmod-app-utils.c
gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c
gnucash/trunk/src/backend/dbi/gncmod-backend-dbi.c
gnucash/trunk/src/backend/dbi/test/utest-backend-dbi-basic.c
gnucash/trunk/src/backend/dbi/test/utest-backend-dbi-business.c
gnucash/trunk/src/backend/sql/gnc-backend-sql.c
gnucash/trunk/src/backend/xml/gnc-backend-xml.c
gnucash/trunk/src/backend/xml/gnc-backend-xml.h
gnucash/trunk/src/backend/xml/gnc-book-xml-v2.c
gnucash/trunk/src/backend/xml/gnc-schedxaction-xml-v2.c
gnucash/trunk/src/backend/xml/gncmod-backend-xml.c
gnucash/trunk/src/backend/xml/io-utils.c
gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c
gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c
gnucash/trunk/src/core-utils/core-utils.i
gnucash/trunk/src/core-utils/gnc-core-prefs.c
gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
gnucash/trunk/src/optional/python-bindings/Makefile.am
gnucash/trunk/src/optional/python-bindings/gnucash_core.i
Log:
Refactor file backend settings to no longer depend on gconf
This affects many other components as well, including the
python bindings
Modified: gnucash/trunk/src/app-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/app-utils/Makefile.am 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/app-utils/Makefile.am 2013-05-03 12:03:38 UTC (rev 22942)
@@ -29,6 +29,7 @@
-I${top_srcdir}/src/core-utils \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/libqof/qof \
+ -I${top_srcdir}/src/backend/xml \
${GUILE_INCS} \
${PYTHON_CPPFLAGS} \
${GLIB_CFLAGS} \
@@ -54,6 +55,7 @@
gnc-gconf-utils.c \
gnc-gettext-util.c \
gnc-helpers.c \
+ gnc-prefs.c \
gnc-sx-instance-model.c \
gncmod-app-utils.c \
gnc-ui-balances.c \
@@ -80,6 +82,7 @@
gnc-gettext-util.h \
gnc-help-utils.h \
gnc-helpers.h \
+ gnc-prefs.h \
gnc-sx-instance-model.h \
gnc-ui-balances.h \
gnc-ui-util.h \
Modified: gnucash/trunk/src/app-utils/app-utils.i
===================================================================
--- gnucash/trunk/src/app-utils/app-utils.i 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/app-utils/app-utils.i 2013-05-03 12:03:38 UTC (rev 22942)
@@ -8,6 +8,7 @@
#include <gnc-exp-parser.h>
#include <gnc-ui-util.h>
#include <gnc-gettext-util.h>
+#include <gnc-prefs.h>
#include <gnc-helpers.h>
#include <gnc-accounting-period.h>
#include <gnc-session.h>
@@ -41,6 +42,8 @@
typedef void (*GNCOptionChangeCallback) (gpointer user_data);
typedef int GNCOptionDBHandle;
+void gnc_prefs_init();
+
QofBook * gnc_get_current_book (void);
const gchar * gnc_get_current_book_tax_name (void);
const gchar * gnc_get_current_book_tax_type (void);
Modified: gnucash/trunk/src/app-utils/gnc-gconf-utils.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-gconf-utils.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/app-utils/gnc-gconf-utils.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -28,13 +28,18 @@
#include <string.h>
#include "gnc-core-prefs.h"
#include "gnc-gconf-utils.h"
+#include "gnc-backend-xml.h"
#define CLIENT_TAG "%s-%s-client"
#define NOTIFY_TAG "%s-%s-notify_id"
+static QofLogModule log_module = G_LOG_DOMAIN;
+
static GConfClient *our_client = NULL;
static guint gconf_general_cb_id = 0;
+
+
/************************************************************/
/* Enum Utilities */
/************************************************************/
@@ -987,3 +992,68 @@
NULL);
return TRUE;
}
+
+/***************************************************************
+ * Initialization *
+ ***************************************************************/
+static void
+file_retain_changed_cb(GConfEntry *entry, gpointer user_data)
+{
+ gint days = (int)gnc_gconf_get_float(GCONF_GENERAL, KEY_RETAIN_DAYS, NULL);
+ gnc_core_prefs_set_file_retention_days (days);
+}
+
+static void
+file_retain_type_changed_cb(GConfEntry *entry, gpointer user_data)
+{
+ XMLFileRetentionType type;
+ gchar *choice = gnc_gconf_get_string(GCONF_GENERAL, KEY_RETAIN_TYPE, NULL);
+ if (!choice)
+ choice = g_strdup("days");
+
+ if (g_strcmp0 (choice, "never") == 0)
+ type = XML_RETAIN_NONE;
+ else if (g_strcmp0 (choice, "forever") == 0)
+ type = XML_RETAIN_ALL;
+ else
+ {
+ if (g_strcmp0 (choice, "days") != 0)
+ PERR("bad value '%s'", choice ? choice : "(null)");
+ type = XML_RETAIN_DAYS;
+ }
+ gnc_core_prefs_set_file_retention_policy (type);
+
+ g_free (choice);
+}
+
+static void
+file_compression_changed_cb(GConfEntry *entry, gpointer user_data)
+{
+ gboolean file_compression = gnc_gconf_get_bool(GCONF_GENERAL, KEY_FILE_COMPRESSION, NULL);
+ gnc_core_prefs_set_file_save_compressed (file_compression);
+}
+
+void gnc_gconf_prefs_init (void)
+{
+ /* Add hooks to update core preferences whenever the associated gconf key changes */
+ gnc_gconf_general_register_cb(KEY_RETAIN_DAYS, file_retain_changed_cb, NULL);
+ gnc_gconf_general_register_cb(KEY_RETAIN_TYPE, file_retain_type_changed_cb, NULL);
+ gnc_gconf_general_register_cb(KEY_FILE_COMPRESSION, file_compression_changed_cb, NULL);
+
+ /* Call the hooks once manually to initialize the core preferences */
+ file_retain_changed_cb (NULL, NULL);
+ file_retain_type_changed_cb (NULL, NULL);
+ file_compression_changed_cb (NULL, NULL);
+
+ /* Backwards compatibility code. Pre 2.3.15, 0 retain_days meant
+ * "keep forever". From 2.3.15 on this is controlled via a multiple
+ * choice ("retain_type"). So if we find a 0 retain_days value with
+ * a "days" retain_type, we should interpret it as if we got a
+ * "forever" retain_type.
+ */
+ if ( (gnc_core_prefs_get_file_retention_policy () == XML_RETAIN_DAYS) &&
+ (gnc_core_prefs_get_file_retention_days () == 0 ) )
+ {
+ gnc_gconf_set_string (GCONF_GENERAL, KEY_RETAIN_TYPE, "forever", NULL);
+ }
+}
Modified: gnucash/trunk/src/app-utils/gnc-gconf-utils.h
===================================================================
--- gnucash/trunk/src/app-utils/gnc-gconf-utils.h 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/app-utils/gnc-gconf-utils.h 2013-05-03 12:03:38 UTC (rev 22942)
@@ -71,6 +71,11 @@
#define KEY_DATE_BACKMONTHS "date_backmonths"
#define KEY_SHOW_LEAF_ACCOUNT_NAMES "show_leaf_account_names"
+/* Keys used for core preferences */
+#define KEY_FILE_COMPRESSION "file_compression"
+#define KEY_RETAIN_TYPE "retain_type"
+#define KEY_RETAIN_DAYS "retain_days"
+
typedef void (*GncGconfGeneralCb) (GConfEntry *entry, gpointer user_data);
typedef void (*GncGconfGeneralAnyCb) (gpointer user_data);
@@ -79,6 +84,11 @@
@{
*/
+/** This function is called early in the load process
+ * to preload a number of preferences from gconf
+ */
+void gnc_gconf_prefs_init (void);
+
/** This function takes an enum value and returns its nickname.
*
* @param type The value defining the enum class. For example,
@@ -171,7 +181,7 @@
/** Register a callback for when a specific key in the general section
* of Gnucash's gconf data is changed. Any time the key's value
* changes, the routine will be invoked and will be passed both the
- * changes gconf entry and the user data passed to this function.
+ * changed gconf entry and the user data passed to this function.
*
* @param key This value contains the name of the key within the
* "general" section to watch.
Added: gnucash/trunk/src/app-utils/gnc-prefs.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-prefs.c (rev 0)
+++ gnucash/trunk/src/app-utils/gnc-prefs.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -0,0 +1,30 @@
+/********************************************************************\
+ * gnc-prefs.h -- utility functions for preferences management *
+ * Copyright (C) 2013 Geert Janssens <geert at kobaltwit.be> *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation; either version 2 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact: *
+ * *
+ * Free Software Foundation Voice: +1-617-542-5942 *
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
+ * Boston, MA 02110-1301, USA gnu at gnu.org *
+ * *
+\********************************************************************/
+
+#include "gnc-gconf-utils.h"
+#include "gnc-prefs.h"
+
+void gnc_prefs_init (void)
+{
+ gnc_gconf_prefs_init ();
+}
Added: gnucash/trunk/src/app-utils/gnc-prefs.h
===================================================================
--- gnucash/trunk/src/app-utils/gnc-prefs.h (rev 0)
+++ gnucash/trunk/src/app-utils/gnc-prefs.h 2013-05-03 12:03:38 UTC (rev 22942)
@@ -0,0 +1,29 @@
+/********************************************************************\
+ * gnc-prefs.h -- utility functions for preferences management *
+ * Copyright (C) 2013 Geert Janssens <geert at kobaltwit.be> *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation; either version 2 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact: *
+ * *
+ * Free Software Foundation Voice: +1-617-542-5942 *
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
+ * Boston, MA 02110-1301, USA gnu at gnu.org *
+ * *
+\********************************************************************/
+
+#ifndef GNC_PREFS_H_
+#define GNC_PREFS_H_
+
+void gnc_prefs_init (void);
+
+#endif /* GNC_PREFS_H_ */
Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -43,7 +43,7 @@
#include "qof.h"
#include "guile-mappings.h"
-#include "core-utils/gnc-gconf-utils.h"
+#include "gnc-gconf-utils.h"
#include "gnc-module/gnc-module.h"
#include "engine/Account.h"
#include "engine/Transaction.h"
Modified: gnucash/trunk/src/app-utils/gncmod-app-utils.c
===================================================================
--- gnucash/trunk/src/app-utils/gncmod-app-utils.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/app-utils/gncmod-app-utils.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -14,6 +14,7 @@
#include "gnc-component-manager.h"
#include "gnc-hooks.h"
+#include "gnc-prefs.h"
#include "gnc-exp-parser.h"
GNC_MODULE_API_DECL(libgncmod_app_utils)
@@ -75,6 +76,7 @@
if (refcount == 0)
{
gnc_component_manager_init ();
+ gnc_prefs_init ();
gnc_hook_add_dangler(HOOK_STARTUP, (GFunc)gnc_exp_parser_init, NULL);
gnc_hook_add_dangler(HOOK_SHUTDOWN, (GFunc)app_utils_shutdown, NULL);
}
Modified: gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c
===================================================================
--- gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -46,7 +46,6 @@
#include "SX-book.h"
#include "Recurrence.h"
-#include "gnc-gconf-utils.h"
#include "gnc-uri-utils.h"
#include "gnc-filepath-utils.h"
#include "gnc-locale-utils.h"
Modified: gnucash/trunk/src/backend/dbi/gncmod-backend-dbi.c
===================================================================
--- gnucash/trunk/src/backend/dbi/gncmod-backend-dbi.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/backend/dbi/gncmod-backend-dbi.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -41,12 +41,6 @@
engine = gnc_module_load( "gnucash/engine", 0 );
if ( !engine ) return FALSE;
- /* Need to initialize g-type engine for gconf */
- if (refcount == 0)
- {
- g_type_init();
- }
-
return TRUE;
}
Modified: gnucash/trunk/src/backend/dbi/test/utest-backend-dbi-basic.c
===================================================================
--- gnucash/trunk/src/backend/dbi/test/utest-backend-dbi-basic.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/backend/dbi/test/utest-backend-dbi-basic.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -1,5 +1,5 @@
/*
- * utest-gnc-prefs-gconf.c
+ * utest-backend-dbi-basic.c
*
* Created on: 2011-04-23
* Author: phil
Modified: gnucash/trunk/src/backend/dbi/test/utest-backend-dbi-business.c
===================================================================
--- gnucash/trunk/src/backend/dbi/test/utest-backend-dbi-business.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/backend/dbi/test/utest-backend-dbi-business.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -24,7 +24,7 @@
*/
/*
- * utest-gnc-prefs-gconf.c
+ * utest-backend-dbi-business.c
*
* Created on: 2011-04-23
* Author: phil
Modified: gnucash/trunk/src/backend/sql/gnc-backend-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-backend-sql.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/backend/sql/gnc-backend-sql.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -46,8 +46,6 @@
#include "gncTaxTable.h"
#include "gncInvoice.h"
-#include "gnc-gconf-utils.h"
-
#include "gnc-backend-sql.h"
#include "gnc-account-sql.h"
Modified: gnucash/trunk/src/backend/xml/gnc-backend-xml.c
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-backend-xml.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/backend/xml/gnc-backend-xml.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -75,7 +75,7 @@
#include "io-gncxml.h"
#include "io-gncxml-v2.h"
#include "gnc-backend-xml.h"
-#include "gnc-gconf-utils.h"
+#include "gnc-core-prefs.h"
#include "gnc-address-xml-v2.h"
#include "gnc-bill-term-xml-v2.h"
@@ -93,10 +93,6 @@
# include "strptime.h"
#endif
-#define KEY_FILE_COMPRESSION "file_compression"
-#define KEY_RETAIN_TYPE "retain_type"
-#define KEY_RETAIN_DAYS "retain_days"
-
static QofLogModule log_module = GNC_MOD_BACKEND;
static gboolean save_may_clobber_data (QofBackend *bend);
@@ -724,7 +720,7 @@
}
}
- if (gnc_book_write_to_xml_file_v2(book, tmp_name, fbe->file_compression))
+ if (gnc_book_write_to_xml_file_v2(book, tmp_name, gnc_core_prefs_get_file_save_compressed()))
{
/* Record the file's permissions before g_unlinking it */
rc = g_stat(datafile, &statbuf);
@@ -949,13 +945,13 @@
/* The file is a backup or log file. Check the user's retention preference
* to determine if we should keep it or not
*/
- if (be->file_retention_type == XML_RETAIN_NONE)
+ if (gnc_core_prefs_get_file_retention_policy() == XML_RETAIN_NONE)
{
PINFO ("remove stale file: %s - reason: preference XML_RETAIN_NONE", name);
g_unlink(name);
}
- else if ((be->file_retention_type == XML_RETAIN_DAYS) &&
- (be->file_retention_days > 0))
+ else if ((gnc_core_prefs_get_file_retention_policy() == XML_RETAIN_DAYS) &&
+ (gnc_core_prefs_get_file_retention_days() > 0))
{
int days;
@@ -967,8 +963,8 @@
}
days = (int)(difftime(now, statbuf.st_mtime) / 86400);
- PINFO ("file retention = %d days", be->file_retention_days);
- if (days >= be->file_retention_days)
+ PINFO ("file retention = %d days", gnc_core_prefs_get_file_retention_days());
+ if (days >= gnc_core_prefs_get_file_retention_days())
{
PINFO ("remove stale file: %s - reason: more than %d days old", name, days);
g_unlink(name);
@@ -1226,46 +1222,6 @@
}
#endif
-static void
-retain_changed_cb(GConfEntry *entry, gpointer user_data)
-{
- FileBackend *be = (FileBackend*)user_data;
- g_return_if_fail(be != NULL);
- be->file_retention_days = (int)gnc_gconf_get_float(GCONF_GENERAL, KEY_RETAIN_DAYS, NULL);
-}
-
-static void
-retain_type_changed_cb(GConfEntry *entry, gpointer user_data)
-{
- FileBackend *be = (FileBackend*)user_data;
- gchar *choice = NULL;
- g_return_if_fail(be != NULL);
- choice = gnc_gconf_get_string(GCONF_GENERAL, KEY_RETAIN_TYPE, NULL);
- if (!choice)
- choice = g_strdup("days");
-
- if (g_strcmp0 (choice, "never") == 0)
- be->file_retention_type = XML_RETAIN_NONE;
- else if (g_strcmp0 (choice, "forever") == 0)
- be->file_retention_type = XML_RETAIN_ALL;
- else
- {
- if (g_strcmp0 (choice, "days") != 0)
- PERR("bad value '%s'", choice ? choice : "(null)");
- be->file_retention_type = XML_RETAIN_DAYS;
- }
-
- g_free (choice);
-}
-
-static void
-compression_changed_cb(GConfEntry *entry, gpointer user_data)
-{
- FileBackend *be = (FileBackend*)user_data;
- g_return_if_fail(be != NULL);
- be->file_compression = gnc_gconf_get_bool(GCONF_GENERAL, KEY_FILE_COMPRESSION, NULL);
-}
-
static QofBackend*
gnc_backend_new(void)
{
@@ -1310,27 +1266,6 @@
gnc_be->book = NULL;
- gnc_be->file_retention_days = (int)gnc_gconf_get_float(GCONF_GENERAL, KEY_RETAIN_DAYS, NULL);
- gnc_be->file_compression = gnc_gconf_get_bool(GCONF_GENERAL, KEY_FILE_COMPRESSION, NULL);
- retain_type_changed_cb(NULL, (gpointer)be); /* Get retain_type from gconf */
-
- if ( (gnc_be->file_retention_type == XML_RETAIN_DAYS) &&
- (gnc_be->file_retention_days == 0 ) )
- {
- /* Backwards compatibility code. Pre 2.3.15, 0 retain_days meant
- * "keep forever". From 2.3.15 on this is controlled via a multiple
- * choice ("retain_type"). So if we find a 0 retain_days value with
- * a "days" retain_type, we should interpret it as if we got a
- * "forever" retain_type.
- */
- gnc_be->file_retention_type = XML_RETAIN_ALL;
- gnc_gconf_set_string (GCONF_GENERAL, KEY_RETAIN_TYPE, "forever", NULL);
- }
-
- gnc_gconf_general_register_cb(KEY_RETAIN_DAYS, retain_changed_cb, be);
- gnc_gconf_general_register_cb(KEY_RETAIN_TYPE, retain_type_changed_cb, be);
- gnc_gconf_general_register_cb(KEY_FILE_COMPRESSION, compression_changed_cb, be);
-
return be;
}
Modified: gnucash/trunk/src/backend/xml/gnc-backend-xml.h
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-backend-xml.h 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/backend/xml/gnc-backend-xml.h 2013-05-03 12:03:38 UTC (rev 22942)
@@ -64,10 +64,6 @@
int lockfd;
QofBook *book; /* The primary, main open book */
-
- XMLFileRetentionType file_retention_type;
- int file_retention_days;
- gboolean file_compression;
};
typedef struct FileBackend_struct FileBackend;
Modified: gnucash/trunk/src/backend/xml/gnc-book-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-book-xml-v2.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/backend/xml/gnc-book-xml-v2.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <string.h>
-#include "gnc-gconf-utils.h"
#include "gnc-xml-helper.h"
#include "sixtp.h"
Modified: gnucash/trunk/src/backend/xml/gnc-schedxaction-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-schedxaction-xml-v2.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/backend/xml/gnc-schedxaction-xml-v2.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -44,8 +44,6 @@
#include "sixtp-dom-parsers.h"
-#include "gnc-gconf-utils.h"
-
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gnc.backend.file.sx"
Modified: gnucash/trunk/src/backend/xml/gncmod-backend-xml.c
===================================================================
--- gnucash/trunk/src/backend/xml/gncmod-backend-xml.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/backend/xml/gncmod-backend-xml.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -43,10 +43,6 @@
engine = gnc_module_load("gnucash/engine", 0);
if (!engine) return FALSE;
- /* Need to initialize g-type engine for gconf */
- if (refcount == 0)
- g_type_init();
-
return TRUE;
}
Modified: gnucash/trunk/src/backend/xml/io-utils.c
===================================================================
--- gnucash/trunk/src/backend/xml/io-utils.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/backend/xml/io-utils.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -31,7 +31,6 @@
#include "gnc-xml.h"
#include "gnc-xml.h"
#include "io-utils.h"
-#include "gnc-gconf-utils.h"
/*
<!-- Local variables: -->
Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -49,7 +49,7 @@
#include "gnome-utils/gnc-icons.h" /* for GNC_STOCK_INVOICE_NEW */
#include "gnc-core-prefs.h" /* for GCONF_PATH */
-#include "core-utils/gnc-gconf-utils.h"
+#include "gnc-gconf-utils.h"
#include "gnome-utils/gnc-main-window.h"
#include "gnc-plugin-page-register.h"
Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -39,7 +39,7 @@
#include "table-allgui.h"
#include "pricecell.h"
#include "dialog-tax-table.h"
-#include "core-utils/gnc-gconf-utils.h"
+#include "gnc-gconf-utils.h"
#include "register/register-core/checkboxcell.h"
#include "gncEntryLedgerP.h"
Modified: gnucash/trunk/src/core-utils/core-utils.i
===================================================================
--- gnucash/trunk/src/core-utils/core-utils.i 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/core-utils/core-utils.i 2013-05-03 12:03:38 UTC (rev 22942)
@@ -25,7 +25,7 @@
#endif
%import "base-typemaps.i"
-gboolean gnc_core_prefs_is_debugging_enabled(void);
+%include <gnc-core-prefs.h>
%newobject gnc_path_get_bindir;
gchar * gnc_path_get_bindir(void);
@@ -56,8 +56,6 @@
%newobject gnc_locale_to_utf8;
gchar * gnc_locale_to_utf8(const gchar *);
-gboolean gnc_core_prefs_is_extra_enabled();
-
const char * gnc_locale_default_iso_currency_code (void);
#if defined(SWIGGUILE)
Modified: gnucash/trunk/src/core-utils/gnc-core-prefs.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-core-prefs.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/core-utils/gnc-core-prefs.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -25,15 +25,19 @@
#include "config.h"
#include "gnc-core-prefs.h"
#include "gnc-version.h"
+#include "libqof/qof/qof.h"
static gchar *namespace_regexp = NULL;
static gboolean is_debugging = FALSE;
static gboolean extras_enabled = FALSE;
-static gboolean use_compression = FALSE;
-static gint file_retention_policy = 0;
-static gint file_retention_days = 0;
-static const gchar *gconf_path;
+static gboolean use_compression = TRUE; // This is also the default in GConf
+static gint file_retention_policy = 1; // 1 = "days", the default in GConf
+static gint file_retention_days = 30; // This is also the default in GConf
+static const gchar *gconf_path = "/apps/gnucash"; // A sensible default
+/* This static indicates the debugging module that this .o belongs to. */
+static QofLogModule log_module = G_LOG_DOMAIN;
+
const gchar *
gnc_core_prefs_get_namespace_regexp(void)
{
Modified: gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
===================================================================
--- gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c 2013-05-03 12:03:38 UTC (rev 22942)
@@ -46,7 +46,7 @@
#include "gnc-engine.h"
#include "gnc-ui-util.h"
#include "gnc-glib-utils.h"
-#include "core-utils/gnc-gconf-utils.h"
+#include "gnc-gconf-utils.h"
#include "gnome-utils/gnc-ui.h"
#include "gnome-utils/dialog-account.h"
#include "dialog-utils.h"
Modified: gnucash/trunk/src/optional/python-bindings/Makefile.am
===================================================================
--- gnucash/trunk/src/optional/python-bindings/Makefile.am 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/optional/python-bindings/Makefile.am 2013-05-03 12:03:38 UTC (rev 22942)
@@ -24,7 +24,7 @@
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/gnome \
- -I${top_srcdir}/src/core-utils \
+ -I${top_srcdir}/src/core-utils \
-I${top_srcdir}/src/gnc-module
# Suppress all warnings for now, but we really only need to -Wno-implicit
@@ -36,7 +36,8 @@
${GLIB_LIBS} \
${top_builddir}/src/libqof/qof/libgnc-qof.la \
${top_builddir}/src/gnc-module/libgnc-module.la \
- ${top_builddir}/src/engine/libgncmod-engine.la
+ ${top_builddir}/src/engine/libgncmod-engine.la \
+ ${top_builddir}/src/app-utils/libgncmod-app-utils.la
if BUILDING_FROM_SCM
_gnucash_core_c_includes= \
${top_builddir}/config.h \
@@ -66,13 +67,14 @@
${top_srcdir}/src/engine/gncEntry.h \
${top_srcdir}/src/engine/gncTaxTable.h \
${top_srcdir}/src/engine/gncIDSearch.h \
- ${top_srcdir}/src/engine/gnc-pricedb.h
+ ${top_srcdir}/src/engine/gnc-pricedb.h \
+ ${top_srcdir}/src/app-utils/gnc-prefs.h
gnucash_core.c: $(SWIG_FILES) ${top_srcdir}/src/base-typemaps.i ${top_srcdir}/src/engine/engine-common.i $(_gnucash_core_c_includes)
swig -python -Wall -Werror \
-I$(top_srcdir)/src -I$(top_srcdir)/src/engine \
- -I${top_srcdir}/src/libqof/qof \
+ -I$(top_srcdir)/src/app-utils -I${top_srcdir}/src/libqof/qof \
-o $@ $<
gnucash_core_c.py: gnucash_core.c $(SWIG_FILES)
Modified: gnucash/trunk/src/optional/python-bindings/gnucash_core.i
===================================================================
--- gnucash/trunk/src/optional/python-bindings/gnucash_core.i 2013-05-03 12:03:23 UTC (rev 22941)
+++ gnucash/trunk/src/optional/python-bindings/gnucash_core.i 2013-05-03 12:03:38 UTC (rev 22942)
@@ -77,6 +77,7 @@
#include "gncTaxTable.h"
#include "gncIDSearch.h"
#include "engine/gnc-pricedb.h"
+#include "app-utils/gnc-prefs.h"
%}
%include <timespec.i>
@@ -204,7 +205,6 @@
// Commodity prices includes and stuff
%include <gnc-pricedb.h>
-
%init %{
qof_log_init();
qof_init();
@@ -212,5 +212,6 @@
gnc_module_system_init();
char * no_args[1] = { NULL };
gnc_engine_init(0, no_args);
+gnc_prefs_init();
%}
More information about the gnucash-changes
mailing list