Rename gnc-main to gnc-core-prefs

And add proper namespace prefixes to its functions

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22939 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2013-05-03 12:03:00 +00:00
parent 4cf7b1f045
commit f4872f6e6c
14 changed files with 59 additions and 71 deletions

View File

@ -25,7 +25,7 @@
#include "config.h"
#include "qof.h"
#include "gnc-main.h"
#include "gnc-core-prefs.h"
#include "qofsession-p.h"
#include "cashobjects.h"
#include "test-dbi-stuff.h"
@ -385,7 +385,7 @@ test_dbi_version_control( const gchar* driver, const gchar* url )
QofBook *book;
QofBackend *qbe;
QofBackendError err;
gint ourversion = gnc_get_long_version();
gint ourversion = gnc_core_prefs_get_long_version();
g_test_message ( "Testing safe save %s\n", driver );

View File

@ -74,7 +74,7 @@
#include "gnc-tax-table-sql.h"
#include "gnc-vendor-sql.h"
#include "gnc-main.h"
#include "gnc-core-prefs.h"
#if defined( S_SPLINT_S )
#include "splint-defs.h"
@ -497,7 +497,7 @@ gnc_sql_sync_all( GncSqlBackend* be, /*@ dependent @*/ QofBook *book )
ENTER( "book=%p, be->book=%p", book, be->book );
update_progress( be );
(void)reset_version_info( be );
gnc_sql_set_table_version( be, "Gnucash", gnc_get_long_version() );
gnc_sql_set_table_version( be, "Gnucash", gnc_core_prefs_get_long_version() );
gnc_sql_set_table_version( be, "Gnucash-Resave", GNUCASH_RESAVE_VERSION );
/* Create new tables */

View File

@ -42,7 +42,7 @@
#include "top-level.h"
#include "gfec.h"
#include "gnc-commodity.h"
#include "gnc-main.h"
#include "gnc-core-prefs.h"
#include "gnc-main-window.h"
#include "gnc-splash.h"
#include "gnc-gnome-utils.h"
@ -550,8 +550,8 @@ gnc_parse_command_line(int *argc, char ***argv)
exit(0);
}
gnc_set_debugging(debugging);
gnc_set_extra(extra);
gnc_core_prefs_set_debugging(debugging);
gnc_core_prefs_set_extra(extra);
if (!gconf_path)
{
@ -561,10 +561,10 @@ gnc_parse_command_line(int *argc, char ***argv)
else
gconf_path = GCONF_PATH;
}
gnc_set_gconf_path(g_strdup(gconf_path));
gnc_gconf_set_path_prefix(g_strdup(gconf_path));
if (namespace_regexp)
gnc_main_set_namespace_regexp(namespace_regexp);
gnc_core_prefs_set_namespace_regexp(namespace_regexp);
if (args_remaining)
file_to_load = args_remaining[0];
@ -779,7 +779,7 @@ gnc_log_init()
gnc_log_default();
if (gnc_is_debugging())
if (gnc_core_prefs_is_debugging_enabled())
{
qof_log_set_level("", QOF_LOG_INFO);
qof_log_set_level("qof", QOF_LOG_INFO);

View File

@ -48,7 +48,7 @@
#include "gnc-session.h"
#include "gnome-utils/gnc-icons.h" /* for GNC_STOCK_INVOICE_NEW */
#include "core-utils/gnc-main.h" /* for GCONF_PATH */
#include "gnc-core-prefs.h" /* for GCONF_PATH */
#include "core-utils/gnc-gconf-utils.h"
#include "gnome-utils/gnc-main-window.h"

View File

@ -4,6 +4,7 @@ lib_LTLIBRARIES = libgnc-core-utils.la
libgnc_core_utils_la_SOURCES = \
binreloc.c \
gnc-core-prefs.c \
gnc-features.c \
gnc-filepath-utils.c \
gnc-gconf-utils.c \
@ -13,7 +14,6 @@ libgnc_core_utils_la_SOURCES = \
gnc-guile-utils.c \
gnc-jalali.c \
gnc-locale-utils.c \
gnc-main.c \
gnc-path.c \
gnc-uri-utils.c \
swig-core-utils-guile.c
@ -29,7 +29,7 @@ libgnc_core_utils_la_LIBADD = \
noinst_HEADERS = \
binreloc.h \
gnc-main.h \
gnc-core-prefs.h \
gnc-features.h \
gnc-filepath-utils.h \
gnc-gconf-utils.h \

View File

@ -1,7 +1,7 @@
%module sw_core_utils
%{
#include <gnc-glib-utils.h>
#include <gnc-main.h>
#include <gnc-core-prefs.h>
#include <gnc-path.h>
#include <gnc-filepath-utils.h>
#include <gnc-locale-utils.h>
@ -25,7 +25,7 @@ void
#endif
%import "base-typemaps.i"
gboolean gnc_is_debugging(void);
gboolean gnc_core_prefs_is_debugging_enabled(void);
%newobject gnc_path_get_bindir;
gchar * gnc_path_get_bindir(void);
@ -56,7 +56,7 @@ gchar * gnc_locale_from_utf8(const gchar *);
%newobject gnc_locale_to_utf8;
gchar * gnc_locale_to_utf8(const gchar *);
gboolean gnc_is_extra_enabled();
gboolean gnc_core_prefs_is_extra_enabled();
const char * gnc_locale_default_iso_currency_code (void);

View File

@ -18,7 +18,7 @@
(use-modules (sw_core_utils))
(re-export gnc-is-debugging)
(re-export gnc-core-prefs-is-debugging-enabled)
(re-export gnc-path-get-bindir)
(re-export gnc-path-get-stdreportsdir)
(re-export gnc-path-find-localized-html-file)

View File

@ -1,5 +1,5 @@
/*
* gnc-main.c:
* gnc-core-prefs.c:
*
* Copyright (C) 2006 Chris Shoemaker <c.shoemaker@cox.net>
*
@ -23,16 +23,22 @@
#include <stdlib.h>
#include "config.h"
#include "gnc-main.h"
#include "core-utils/gnc-version.h"
#include "gnc-core-prefs.h"
#include "gnc-version.h"
static gchar *namespace_regexp = NULL;
static gboolean is_debugging = 0;
static gboolean extras_enabled = 0;
static const gchar *gconf_path;
const gchar *
gnc_core_prefs_get_namespace_regexp(void)
{
return namespace_regexp;
}
void
gnc_main_set_namespace_regexp(const gchar *str)
gnc_core_prefs_set_namespace_regexp(const gchar *str)
{
if (namespace_regexp)
g_free(namespace_regexp);
@ -41,50 +47,32 @@ gnc_main_set_namespace_regexp(const gchar *str)
namespace_regexp = g_strdup(str);
}
const gchar *
gnc_main_get_namespace_regexp(void)
{
return namespace_regexp;
}
gboolean
gnc_is_debugging(void)
gnc_core_prefs_is_debugging_enabled(void)
{
return is_debugging;
}
void
gnc_set_debugging(gboolean d)
gnc_core_prefs_set_debugging(gboolean d)
{
is_debugging = d;
}
gboolean
gnc_is_extra_enabled(void)
{
return extras_enabled;
}
void
gnc_set_extra(gboolean enabled)
{
extras_enabled = enabled;
}
void
gnc_set_gconf_path (const gchar *path)
{
gconf_path = path;
}
const gchar *
gnc_get_gconf_path (void)
gnc_gconf_get_path_prefix (void)
{
return gconf_path;
}
void
gnc_gconf_set_path_prefix (const gchar *path)
{
gconf_path = path;
}
guint
gnc_get_long_version()
gnc_core_prefs_get_long_version()
{
return GNUCASH_MAJOR_VERSION * 1000000 +
GNUCASH_MINOR_VERSION * 10000 +

View File

@ -1,5 +1,5 @@
/*
* gnc-main.h:
* gnc-core-prefs.h:
*
* Copyright (C) 2006 Chris Shoemaker <c.shoemaker@cox.net>
*
@ -28,18 +28,18 @@
#define GCONF_PATH "/apps/gnucash"
void gnc_main_set_namespace_regexp(const gchar *str);
const gchar *gnc_main_get_namespace_regexp(void);
const gchar *gnc_core_prefs_get_namespace_regexp(void);
void gnc_core_prefs_set_namespace_regexp(const gchar *str);
gboolean gnc_is_debugging(void);
void gnc_set_debugging(gboolean d);
gboolean gnc_core_prefs_is_debugging_enabled(void);
void gnc_core_prefs_set_debugging(gboolean d);
gboolean gnc_is_extra_enabled(void);
void gnc_set_extra(gboolean enabled);
gboolean gnc_core_prefs_is_extra_enabled(void);
void gnc_core_prefs_set_extra(gboolean enabled);
void gnc_set_gconf_path(const gchar *prefix);
const gchar *gnc_get_gconf_path(void);
const gchar *gnc_gconf_get_path_prefix(void);
void gnc_gconf_set_path_prefix(const gchar *prefix);
guint gnc_get_long_version( void );
guint gnc_core_prefs_get_long_version( void );
#endif /* GNC_MAIN_H */

View File

@ -26,7 +26,7 @@
#include <stdio.h>
#include <string.h>
#include "gnc-main.h"
#include "gnc-core-prefs.h"
#include "gnc-gconf-utils.h"
#define CLIENT_TAG "%s-%s-client"
@ -273,7 +273,7 @@ gnc_gconf_section_name (const char *name)
if (name == NULL)
{
/* Need to return a newly allocated string */
return g_strdup(gnc_get_gconf_path());
return g_strdup(gnc_gconf_get_path_prefix());
}
if (*name == '/')
{
@ -287,7 +287,7 @@ gnc_gconf_section_name (const char *name)
* order to keep this file completely "gnome-free" this approach was
* used.
*/
return g_strjoin("/", gnc_get_gconf_path(), name, NULL);
return g_strjoin("/", gnc_gconf_get_path_prefix(), name, NULL);
}
char *
@ -305,7 +305,7 @@ gnc_gconf_schema_section_name (const char *name)
* order to keep this file completely "gnome-free" this approach was
* used.
*/
return g_strconcat("/schemas", gnc_get_gconf_path(), "/", name, NULL);
return g_strconcat("/schemas", gnc_gconf_get_path_prefix(), "/", name, NULL);
}
static gchar *

View File

@ -35,7 +35,7 @@
#include <regex.h>
#include "gnc-commodity.h"
#include "gnc-main.h"
#include "gnc-core-prefs.h"
static QofLogModule log_module = GNC_MOD_COMMODITY;
@ -2023,7 +2023,7 @@ gnc_commodity_table_get_quotable_commodities(const gnc_commodity_table * table)
GList * nslist, * tmp;
GList * l = NULL;
regex_t pattern;
const char *expression = gnc_main_get_namespace_regexp();
const char *expression = gnc_core_prefs_get_namespace_regexp();
ENTER("table=%p, expression=%s", table, expression);
if (!table)

View File

@ -39,7 +39,7 @@ extern "C"
#include "core-utils/gnc-filepath-utils.h"
#include "engine/gnc-hooks.h"
#include "engine/gnc-commodity.h"
#include "core-utils/gnc-main.h"
#include "core-utils/gnc-core-prefs.h"
#include "engine/gnc-session.h"
#include "engine/engine-helpers.h"
#include "engine/gnc-engine.h"
@ -103,7 +103,7 @@ gnc_log_init()
gnc_log_default();
if (gnc_is_debugging())
if (gnc_core_prefs_is_debugging_enabled())
{
qof_log_set_level("", QOF_LOG_INFO);
qof_log_set_level("qof", QOF_LOG_INFO);

View File

@ -62,7 +62,7 @@
#include "gnc-uri-utils.h"
#include "core-utils/gnc-version.h"
#include "gnc-window.h"
#include "gnc-main.h"
#include "gnc-core-prefs.h"
#include "gnc-gconf-utils.h"
#include "option-util.h"
// +JSLED
@ -3447,7 +3447,7 @@ gnc_main_window_setup_window (GncMainWindow *window)
/* Testing */
/* Now update the "eXtensions" menu */
if (!gnc_is_extra_enabled())
if (!gnc_core_prefs_is_extra_enabled())
{
GtkAction* action;

View File

@ -1,11 +1,11 @@
import sys
import _sw_app_utils
from gnucash import *
from _sw_core_utils import gnc_is_extra_enabled
from _sw_core_utils import gnc_core_prefs_is_extra_enabled
import gtk
import os
sys.path.append(os.path.dirname(__file__))
noisy = gnc_is_extra_enabled()
noisy = gnc_core_prefs_is_extra_enabled()
if noisy:
print "woop", os.path.dirname(__file__)
import pycons.console as cons