diff --git a/src/app-utils/Makefile.am b/src/app-utils/Makefile.am index 93fc6761e5..9c7e411c9c 100644 --- a/src/app-utils/Makefile.am +++ b/src/app-utils/Makefile.am @@ -62,8 +62,7 @@ gncinclude_HEADERS = \ 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,23 +101,7 @@ noinst_DATA = .scm-links EXTRA_DIST = \ ${gncmod_DATA} \ ${gncscm_DATA} \ - ${gwmod_DATA} \ - i18n.h.in - -## We borrow guile's convention and use @-...-@ as the substitution -## brackets here, instead of the usual @...@. 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 + ${gwmod_DATA} if GNUCASH_SEPARATE_BUILDDIR #For compiling @@ -147,6 +130,6 @@ gw-app-utils.scm gw-app-utils.c gw-app-utils.h: \ (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 diff --git a/src/app-utils/gnc-gettext-util.c b/src/app-utils/gnc-gettext-util.c index 3ee63053f1..670b5821d2 100644 --- a/src/app-utils/gnc-gettext-util.c +++ b/src/app-utils/gnc-gettext-util.c @@ -25,7 +25,6 @@ #include #include -#include "i18n.h" #include "gnc-gettext-util.h" /* ============================================================== */ @@ -36,16 +35,3 @@ gnc_gettext_helper(const char *string) 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 -} - -/* ============================================================== */ diff --git a/src/app-utils/gnc-gettext-util.h b/src/app-utils/gnc-gettext-util.h index 97a7cc4077..0b5f7ff943 100644 --- a/src/app-utils/gnc-gettext-util.h +++ b/src/app-utils/gnc-gettext-util.h @@ -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 diff --git a/src/app-utils/gw-app-utils-spec.scm b/src/app-utils/gw-app-utils-spec.scm index ae8ec8f6a0..41347c485d 100644 --- a/src/app-utils/gw-app-utils-spec.scm +++ b/src/app-utils/gw-app-utils-spec.scm @@ -99,14 +99,6 @@ ( monetary)) "Parse the expression and return either a gnc numeric or #f.") - (gw:wrap-function - ws - 'gnc:setup-gettext - ' - "gnc_setup_gettext" - '() - "Runs bindtextdomain and textdomain.") - (gw:wrap-function ws 'gnc:gettext-helper diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index ee785f0179..53caa3df97 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -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 @@ gnucash: gnucash.in ${top_builddir}/config.status 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 @@ bin_SCRIPTS = ${gnc_common_scripts} update-gnucash-gconf gnucash gnucash-valgrin # 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 diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c index 96c4ac6ef1..63ea8b0ba0 100644 --- a/src/bin/gnucash-bin.c +++ b/src/bin/gnucash-bin.c @@ -24,7 +24,10 @@ #include #include #include +#include #include "glib.h" +#include "gnc-module.h" +#include "i18n.h" static void inner_main (void *closure, int argc, char **argv) @@ -38,6 +41,16 @@ inner_main (void *closure, int argc, char **argv) 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 */ } diff --git a/src/app-utils/i18n.h.in b/src/bin/i18n.h.in similarity index 100% rename from src/app-utils/i18n.h.in rename to src/bin/i18n.h.in diff --git a/src/scm/main.scm b/src/scm/main.scm index 33e52e0109..a3f749d102 100644 --- a/src/scm/main.scm +++ b/src/scm/main.scm @@ -365,12 +365,6 @@ string and 'directories' must be a list of strings." (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 @@ string and 'directories' must be a list of strings." (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 @@ string and 'directories' must be a list of strings." (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 @@ string and 'directories' must be a list of strings." ;; 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 @@ string and 'directories' must be a list of strings." (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 @@ string and 'directories' must be a list of strings." (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