r22939 - gnucash/trunk/src - Rename gnc-main to gnc-core-prefs

Geert Janssens gjanssens at code.gnucash.org
Fri May 3 08:03:01 EDT 2013


Author: gjanssens
Date: 2013-05-03 08:03:00 -0400 (Fri, 03 May 2013)
New Revision: 22939
Trac: http://svn.gnucash.org/trac/changeset/22939

Added:
   gnucash/trunk/src/core-utils/gnc-core-prefs.c
   gnucash/trunk/src/core-utils/gnc-core-prefs.h
Removed:
   gnucash/trunk/src/core-utils/gnc-main.c
   gnucash/trunk/src/core-utils/gnc-main.h
Modified:
   gnucash/trunk/src/backend/dbi/test/test-dbi-stuff.c
   gnucash/trunk/src/backend/sql/gnc-backend-sql.c
   gnucash/trunk/src/bin/gnucash-bin.c
   gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c
   gnucash/trunk/src/core-utils/Makefile.am
   gnucash/trunk/src/core-utils/core-utils.i
   gnucash/trunk/src/core-utils/core-utils.scm
   gnucash/trunk/src/core-utils/gnc-gconf-utils.c
   gnucash/trunk/src/engine/gnc-commodity.c
   gnucash/trunk/src/gnc/main.cpp
   gnucash/trunk/src/gnome-utils/gnc-main-window.c
   gnucash/trunk/src/python/init.py
Log:
Rename gnc-main to gnc-core-prefs

And add proper namespace prefixes to its functions

Modified: gnucash/trunk/src/backend/dbi/test/test-dbi-stuff.c
===================================================================
--- gnucash/trunk/src/backend/dbi/test/test-dbi-stuff.c	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/backend/dbi/test/test-dbi-stuff.c	2013-05-03 12:03:00 UTC (rev 22939)
@@ -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 @@
     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 );
 

Modified: gnucash/trunk/src/backend/sql/gnc-backend-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-backend-sql.c	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/backend/sql/gnc-backend-sql.c	2013-05-03 12:03:00 UTC (rev 22939)
@@ -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 @@
     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 */

Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2013-05-03 12:03:00 UTC (rev 22939)
@@ -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 @@
         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 @@
         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_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);

Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c	2013-05-03 12:03:00 UTC (rev 22939)
@@ -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"
 

Modified: gnucash/trunk/src/core-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/core-utils/Makefile.am	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/core-utils/Makefile.am	2013-05-03 12:03:00 UTC (rev 22939)
@@ -4,6 +4,7 @@
 
 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 @@
   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 @@
 
 noinst_HEADERS = \
   binreloc.h \
-  gnc-main.h \
+  gnc-core-prefs.h \
   gnc-features.h \
   gnc-filepath-utils.h \
   gnc-gconf-utils.h \

Modified: gnucash/trunk/src/core-utils/core-utils.i
===================================================================
--- gnucash/trunk/src/core-utils/core-utils.i	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/core-utils/core-utils.i	2013-05-03 12:03:00 UTC (rev 22939)
@@ -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 @@
 #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 @@
 %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);
 

Modified: gnucash/trunk/src/core-utils/core-utils.scm
===================================================================
--- gnucash/trunk/src/core-utils/core-utils.scm	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/core-utils/core-utils.scm	2013-05-03 12:03:00 UTC (rev 22939)
@@ -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)

Copied: gnucash/trunk/src/core-utils/gnc-core-prefs.c (from rev 22938, gnucash/trunk/src/core-utils/gnc-main.c)
===================================================================
--- gnucash/trunk/src/core-utils/gnc-core-prefs.c	                        (rev 0)
+++ gnucash/trunk/src/core-utils/gnc-core-prefs.c	2013-05-03 12:03:00 UTC (rev 22939)
@@ -0,0 +1,81 @@
+/*
+ * gnc-core-prefs.c:
+ *
+ * Copyright (C) 2006 Chris Shoemaker <c.shoemaker at cox.net>
+ *
+ * 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 <stdlib.h>
+#include "config.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_core_prefs_set_namespace_regexp(const gchar *str)
+{
+    if (namespace_regexp)
+        g_free(namespace_regexp);
+
+    if (str)
+        namespace_regexp = g_strdup(str);
+}
+
+gboolean
+gnc_core_prefs_is_debugging_enabled(void)
+{
+    return is_debugging;
+}
+
+void
+gnc_core_prefs_set_debugging(gboolean d)
+{
+    is_debugging = d;
+}
+
+const gchar *
+gnc_gconf_get_path_prefix (void)
+{
+    return gconf_path;
+}
+
+void
+gnc_gconf_set_path_prefix (const gchar *path)
+{
+    gconf_path = path;
+}
+
+guint
+gnc_core_prefs_get_long_version()
+{
+    return GNUCASH_MAJOR_VERSION * 1000000 +
+           GNUCASH_MINOR_VERSION * 10000 +
+           GNUCASH_MICRO_VERSION * 100 +
+           GNUCASH_NANO_VERSION;
+}

Copied: gnucash/trunk/src/core-utils/gnc-core-prefs.h (from rev 22938, gnucash/trunk/src/core-utils/gnc-main.h)
===================================================================
--- gnucash/trunk/src/core-utils/gnc-core-prefs.h	                        (rev 0)
+++ gnucash/trunk/src/core-utils/gnc-core-prefs.h	2013-05-03 12:03:00 UTC (rev 22939)
@@ -0,0 +1,45 @@
+/*
+ * gnc-core-prefs.h:
+ *
+ * Copyright (C) 2006 Chris Shoemaker <c.shoemaker at cox.net>
+ *
+ * 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_MAIN_H
+#define GNC_MAIN_H
+
+#include <glib.h>
+
+#define GCONF_PATH "/apps/gnucash"
+
+const gchar *gnc_core_prefs_get_namespace_regexp(void);
+void gnc_core_prefs_set_namespace_regexp(const gchar *str);
+
+gboolean gnc_core_prefs_is_debugging_enabled(void);
+void gnc_core_prefs_set_debugging(gboolean d);
+
+gboolean gnc_core_prefs_is_extra_enabled(void);
+void gnc_core_prefs_set_extra(gboolean enabled);
+
+const gchar *gnc_gconf_get_path_prefix(void);
+void gnc_gconf_set_path_prefix(const gchar *prefix);
+
+guint gnc_core_prefs_get_long_version( void );
+
+#endif /* GNC_MAIN_H */

Modified: gnucash/trunk/src/core-utils/gnc-gconf-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2013-05-03 12:03:00 UTC (rev 22939)
@@ -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 @@
     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 @@
      * 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 @@
      * 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 *

Deleted: gnucash/trunk/src/core-utils/gnc-main.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-main.c	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/core-utils/gnc-main.c	2013-05-03 12:03:00 UTC (rev 22939)
@@ -1,93 +0,0 @@
-/*
- * gnc-main.c:
- *
- * Copyright (C) 2006 Chris Shoemaker <c.shoemaker at cox.net>
- *
- * 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 <stdlib.h>
-#include "config.h"
-#include "gnc-main.h"
-#include "core-utils/gnc-version.h"
-
-static gchar *namespace_regexp = NULL;
-static gboolean is_debugging = 0;
-static gboolean extras_enabled = 0;
-static const gchar *gconf_path;
-
-void
-gnc_main_set_namespace_regexp(const gchar *str)
-{
-    if (namespace_regexp)
-        g_free(namespace_regexp);
-
-    if (str)
-        namespace_regexp = g_strdup(str);
-}
-
-const gchar *
-gnc_main_get_namespace_regexp(void)
-{
-    return namespace_regexp;
-}
-
-gboolean
-gnc_is_debugging(void)
-{
-    return is_debugging;
-}
-
-void
-gnc_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)
-{
-    return gconf_path;
-}
-
-guint
-gnc_get_long_version()
-{
-    return GNUCASH_MAJOR_VERSION * 1000000 +
-           GNUCASH_MINOR_VERSION * 10000 +
-           GNUCASH_MICRO_VERSION * 100 +
-           GNUCASH_NANO_VERSION;
-}

Deleted: gnucash/trunk/src/core-utils/gnc-main.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-main.h	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/core-utils/gnc-main.h	2013-05-03 12:03:00 UTC (rev 22939)
@@ -1,45 +0,0 @@
-/*
- * gnc-main.h:
- *
- * Copyright (C) 2006 Chris Shoemaker <c.shoemaker at cox.net>
- *
- * 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_MAIN_H
-#define GNC_MAIN_H
-
-#include <glib.h>
-
-#define GCONF_PATH "/apps/gnucash"
-
-void gnc_main_set_namespace_regexp(const gchar *str);
-const gchar *gnc_main_get_namespace_regexp(void);
-
-gboolean gnc_is_debugging(void);
-void gnc_set_debugging(gboolean d);
-
-gboolean gnc_is_extra_enabled(void);
-void gnc_set_extra(gboolean enabled);
-
-void gnc_set_gconf_path(const gchar *prefix);
-const gchar *gnc_get_gconf_path(void);
-
-guint gnc_get_long_version( void );
-
-#endif /* GNC_MAIN_H */

Modified: gnucash/trunk/src/engine/gnc-commodity.c
===================================================================
--- gnucash/trunk/src/engine/gnc-commodity.c	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/engine/gnc-commodity.c	2013-05-03 12:03:00 UTC (rev 22939)
@@ -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 @@
     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)

Modified: gnucash/trunk/src/gnc/main.cpp
===================================================================
--- gnucash/trunk/src/gnc/main.cpp	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/gnc/main.cpp	2013-05-03 12:03:00 UTC (rev 22939)
@@ -39,7 +39,7 @@
 #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_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);

Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c	2013-05-03 12:03:00 UTC (rev 22939)
@@ -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 @@
 
     /* Testing */
     /* Now update the "eXtensions" menu */
-    if (!gnc_is_extra_enabled())
+    if (!gnc_core_prefs_is_extra_enabled())
     {
         GtkAction*  action;
 

Modified: gnucash/trunk/src/python/init.py
===================================================================
--- gnucash/trunk/src/python/init.py	2013-05-02 21:01:30 UTC (rev 22938)
+++ gnucash/trunk/src/python/init.py	2013-05-03 12:03:00 UTC (rev 22939)
@@ -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



More information about the gnucash-changes mailing list