[Gnucash-changes] r12337 - gnucash/trunk/src - Move gnu-module init
and gettext init from scm to C.
Chris Shoemaker
chris at cvs.gnucash.org
Thu Jan 12 20:25:12 EST 2006
Author: chris
Date: 2006-01-12 20:25:12 -0500 (Thu, 12 Jan 2006)
New Revision: 12337
Trac: http://svn.gnucash.org/trac/changeset/12337
Added:
gnucash/trunk/src/bin/i18n.h.in
Removed:
gnucash/trunk/src/app-utils/i18n.h.in
Modified:
gnucash/trunk/src/app-utils/Makefile.am
gnucash/trunk/src/app-utils/gnc-gettext-util.c
gnucash/trunk/src/app-utils/gnc-gettext-util.h
gnucash/trunk/src/app-utils/gw-app-utils-spec.scm
gnucash/trunk/src/bin/Makefile.am
gnucash/trunk/src/bin/gnucash-bin.c
gnucash/trunk/src/scm/main.scm
Log:
Move gnu-module init and gettext init from scm to C.
Move i18n.h.in from src/app-utils to src/bin, where it is used.
Remove unneeded gettext init code in src/app-utils
Modified: gnucash/trunk/src/app-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/app-utils/Makefile.am 2006-01-13 00:41:52 UTC (rev 12336)
+++ gnucash/trunk/src/app-utils/Makefile.am 2006-01-13 01:25:12 UTC (rev 12337)
@@ -62,8 +62,7 @@
gnc-ui-common.h \
gnc-ui-util.h \
guile-util.h \
- option-util.h \
- i18n.h
+ option-util.h
noinst_HEADERS = \
gw-app-utils.h
@@ -102,24 +101,8 @@
EXTRA_DIST = \
${gncmod_DATA} \
${gncscm_DATA} \
- ${gwmod_DATA} \
- i18n.h.in
+ ${gwmod_DATA}
-## We borrow guile's convention and use @-...-@ as the substitution
-## brackets here, instead of the usual @... at . This prevents autoconf
-## from substituting the values directly into the left-hand sides of
-## the sed substitutions.
-i18n.h: i18n.h.in ${top_builddir}/config.status
- rm -f $@.tmp
- sed < $< > $@.tmp \
- -e 's:@-PACKAGE-@:${PACKAGE}:g' \
- -e 's:@-LOCALE_DIR-@:${LOCALE_DIR}:g'
- mv $@.tmp $@
-
-# This has to be in BUILT_SOURCES because other files depend on it,
-# but it's never a target itself.
-BUILT_SOURCES = i18n.h
-
if GNUCASH_SEPARATE_BUILDDIR
#For compiling
SCM_FILE_LINKS = gw-app-utils-spec.scm
@@ -147,6 +130,6 @@
(primitive-load \"./gw-app-utils-spec.scm\") \
(gw:generate-wrapset \"gw-app-utils\")"
-BUILT_SOURCES += gw-app-utils.scm gw-app-utils.c gw-app-utils.h
+BUILT_SOURCES = gw-app-utils.scm gw-app-utils.c gw-app-utils.h
DISTCLEANFILES = ${SCM_FILE_LINKS} gnucash g-wrapped .scm-links \
gw-app-utils.html
Modified: gnucash/trunk/src/app-utils/gnc-gettext-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-gettext-util.c 2006-01-13 00:41:52 UTC (rev 12336)
+++ gnucash/trunk/src/app-utils/gnc-gettext-util.c 2006-01-13 01:25:12 UTC (rev 12337)
@@ -25,7 +25,6 @@
#include <glib/gi18n.h>
#include <string.h>
-#include "i18n.h"
#include "gnc-gettext-util.h"
/* ============================================================== */
@@ -36,16 +35,3 @@
return strdup(_(string));
}
-/* ============================================================== */
-
-void
-gnc_setup_gettext(void)
-{
-#ifdef HAVE_GETTEXT
- bindtextdomain (TEXT_DOMAIN, LOCALE_DIR);
- textdomain (TEXT_DOMAIN);
- bind_textdomain_codeset (TEXT_DOMAIN, "UTF-8");
-#endif
-}
-
-/* ============================================================== */
Modified: gnucash/trunk/src/app-utils/gnc-gettext-util.h
===================================================================
--- gnucash/trunk/src/app-utils/gnc-gettext-util.h 2006-01-13 00:41:52 UTC (rev 12336)
+++ gnucash/trunk/src/app-utils/gnc-gettext-util.h 2006-01-13 01:25:12 UTC (rev 12337)
@@ -22,7 +22,6 @@
#ifndef GNC_GETTEXT_UTIL_H
#define GNC_GETTEXT_UTIL_H
-void gnc_setup_gettext(void);
char * gnc_gettext_helper(const char * str);
#endif
Modified: gnucash/trunk/src/app-utils/gw-app-utils-spec.scm
===================================================================
--- gnucash/trunk/src/app-utils/gw-app-utils-spec.scm 2006-01-13 00:41:52 UTC (rev 12336)
+++ gnucash/trunk/src/app-utils/gw-app-utils-spec.scm 2006-01-13 01:25:12 UTC (rev 12337)
@@ -101,14 +101,6 @@
(gw:wrap-function
ws
- 'gnc:setup-gettext
- '<gw:void>
- "gnc_setup_gettext"
- '()
- "Runs bindtextdomain and textdomain.")
-
- (gw:wrap-function
- ws
'gnc:gettext-helper
'(<gw:mchars> caller-owned const)
"gnc_gettext_helper"
Deleted: gnucash/trunk/src/app-utils/i18n.h.in
===================================================================
--- gnucash/trunk/src/app-utils/i18n.h.in 2006-01-13 00:41:52 UTC (rev 12336)
+++ gnucash/trunk/src/app-utils/i18n.h.in 2006-01-13 01:25:12 UTC (rev 12337)
@@ -1,29 +0,0 @@
-/**-*-c-*-***********************************************************\
- * i18n.h -- internationalization with gettext *
- * Copyright (C) 1999 Laurent Pélecq *
- * Copyright (C) 2000 Dave Peticolas <peticola at cs.ucdavis.edu> *
- * *
- * 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, write to the Free Software *
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
-\********************************************************************/
-
-#include "config.h"
-
-#ifdef HAVE_GETTEXT
-# include <libintl.h>
-# include <locale.h>
-#endif
-
-#define TEXT_DOMAIN "@-PACKAGE-@"
-#define LOCALE_DIR "@-LOCALE_DIR-@"
Modified: gnucash/trunk/src/bin/Makefile.am
===================================================================
--- gnucash/trunk/src/bin/Makefile.am 2006-01-13 00:41:52 UTC (rev 12336)
+++ gnucash/trunk/src/bin/Makefile.am 2006-01-13 01:25:12 UTC (rev 12337)
@@ -1,11 +1,13 @@
# Order is important here.
SUBDIRS = . overrides test
-AM_CFLAGS = -I${top_builddir} ${GLIB_CFLAGS}
+AM_CFLAGS = -I${top_builddir} ${GLIB_CFLAGS} ${GNOME_CFLAGS} ${GTK_CFLAGS} \
+-I${top_builddir}/src/gnc-module
bin_PROGRAMS = gnucash-bin
gnucash_bin_SOURCES = gnucash-bin.c
-gnucash_bin_LDADD = ${GUILE_LIBS} ${GLIB_LIBS}
+gnucash_bin_LDADD = ${GUILE_LIBS} ${GLIB_LIBS} ${GNOME_LIBS} ${GTK_LIBS} \
+${top_srcdir}/src/gnc-module/libgncmodule.la
gnucash: gnucash.in ${top_builddir}/config.status
rm -f $@.tmp
@@ -21,6 +23,16 @@
mv $@.tmp $@
chmod u+x $@
+BUILT_SOURCES = i18n.h
+
+i18n.h: i18n.h.in ${top_builddir}/config.status
+ rm -f $@.tmp
+ sed < $< > $@.tmp \
+ -e 's:@-PACKAGE-@:${PACKAGE}:g' \
+ -e 's:@-LOCALE_DIR-@:${LOCALE_DIR}:g'
+ mv $@.tmp $@
+
+
gnucash-valgrind: gnucash-valgrind.in ${top_builddir}/config.status
rm -f $@.tmp
sed < $< > $@.tmp \
@@ -60,7 +72,7 @@
# if you change gncoverridedir, make sure you change ./overrides/Makefile.am too.
gncoverridesdir = ${GNC_LIBEXECDIR}/overrides
-EXTRA_DIST = generate-gnc-script update-gnucash-gconf.in
+EXTRA_DIST = generate-gnc-script update-gnucash-gconf.in i18n.h.in
## Gnucash scripts -- real code is in overrides, these just get you there.
${gnc_common_scripts}: generate-gnc-script ${top_builddir}/config.status
Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c 2006-01-13 00:41:52 UTC (rev 12336)
+++ gnucash/trunk/src/bin/gnucash-bin.c 2006-01-13 01:25:12 UTC (rev 12337)
@@ -24,7 +24,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <libguile.h>
+#include <gtk/gtk.h>
#include "glib.h"
+#include "gnc-module.h"
+#include "i18n.h"
static void
inner_main (void *closure, int argc, char **argv)
@@ -38,6 +41,16 @@
int main(int argc, char ** argv)
{
+
+#ifdef HAVE_GETTEXT
+ bindtextdomain (TEXT_DOMAIN, LOCALE_DIR);
+ textdomain (TEXT_DOMAIN);
+ bind_textdomain_codeset (TEXT_DOMAIN, "UTF-8");
+#endif
+
+ gtk_init (&argc, &argv);
+ gnc_module_system_init();
+
scm_boot_guile(argc, argv, inner_main, 0);
exit(0); /* never reached */
}
Copied: gnucash/trunk/src/bin/i18n.h.in (from rev 12334, gnucash/trunk/src/app-utils/i18n.h.in)
Modified: gnucash/trunk/src/scm/main.scm
===================================================================
--- gnucash/trunk/src/scm/main.scm 2006-01-13 00:41:52 UTC (rev 12336)
+++ gnucash/trunk/src/scm/main.scm 2006-01-13 01:25:12 UTC (rev 12337)
@@ -365,12 +365,6 @@
(gnc:debug "starting up (1).")
(gnc:setup-debugging)
- ;; before doing ANYTHING, set the locale!
- (false-if-exception (setlocale LC_ALL ""))
-
- ;; initialize the gnucash module system
- (gnc:module-system-init)
-
;; SUPER UGLY HACK -- this should go away when I come back for the
;; second cleanup pass...
(let ((original-module (current-module))
@@ -379,20 +373,21 @@
(set-current-module bootstrap)
(gnc:module-load "gnucash/app-utils" 0)
- (gnc:setup-gettext)
;; Now we can load a bunch of files.
(load-from-path "path.scm")
(load-from-path "command-line.scm") ;; depends on app-utils (N_, etc.)...
)
- (gnc:initialize-config-vars)
+ (gnc:initialize-config-vars) ;; in command-line.scm
+ ;; handle unrecognized command line args
(if (not (gnc:handle-command-line-args))
(gnc:shutdown 1))
+ ;; handle --version
(if (gnc:config-var-value-get gnc:*arg-show-version*)
(begin
(gnc:prefs-show-version)
(gnc:shutdown 0)))
-
+ ;; handle --help
(if (or (gnc:config-var-value-get gnc:*arg-show-usage*)
(gnc:config-var-value-get gnc:*arg-show-help*))
(begin
@@ -402,9 +397,6 @@
(define (gnc:startup-pass-2)
(gnc:debug "starting up (2).")
- ;; initialize the gnucash module system
- (gnc:module-system-init)
-
;; SUPER UGLY HACK -- this should go away when I come back for the
;; second cleanup pass...
(let ((original-module (current-module))
@@ -585,9 +577,12 @@
;; Now the fun begins.
(gnc:startup-pass-1)
(gnc:print-unstable-message)
+
(if (null? gnc:*batch-mode-things-to-do*)
(begin
(gnc:hook-add-dangler gnc:*ui-shutdown-hook* gnc:gui-finish)
+ ;; We init splash before gui-init, but gui-init will do the
+ ;; splash itself.
(set! gnc:*command-line-remaining*
(gnc:gui-init-splash gnc:*command-line-remaining*))))
(gnc:startup-pass-2)
@@ -595,8 +590,10 @@
(if (null? gnc:*batch-mode-things-to-do*)
;; We're not in batch mode; we can go ahead and do the normal thing.
(begin
+ ;; Why are we doing this again?
(gnc:hook-add-dangler gnc:*ui-shutdown-hook* gnc:gui-finish)
- (let* ((init-window-cons-rest (gnc:gui-init gnc:*command-line-remaining*))
+ (let* ((init-window-cons-rest
+ (gnc:gui-init gnc:*command-line-remaining*))
(main-window (car init-window-cons-rest)))
(set! gnc:*command-line-remaining* (cdr init-window-cons-rest))
(if (and
@@ -611,9 +608,10 @@
(gnc:main-window-set-progressbar-window main-window)
(gnc:load-account-file)
))
- ;; no matter how or what we loaded, ensure the main-window title is valid...
+ ;; no matter how or what we loaded, ensure the main-window
+ ;; title is valid...
(gnc:hook-run-danglers gnc:*ui-post-startup-hook*)
- (gnc:start-ui-event-loop)
+ (gnc:start-ui-event-loop) ;; this won't return until we're exiting
(gnc:hook-remove-dangler gnc:*ui-shutdown-hook* gnc:gui-finish)))
;; else: we're in batch mode. Just do what the user said on the
More information about the gnucash-changes
mailing list