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



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12337 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker
2006-01-13 01:25:12 +00:00
parent f12f913990
commit d10178c682
8 changed files with 44 additions and 61 deletions

View File

@@ -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

View File

@@ -25,7 +25,6 @@
#include <glib/gi18n.h>
#include <string.h>
#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
}
/* ============================================================== */

View File

@@ -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

View File

@@ -99,14 +99,6 @@
(<gw:bool> monetary))
"Parse the expression and return either a gnc numeric or #f.")
(gw:wrap-function
ws
'gnc:setup-gettext
'<gw:void>
"gnc_setup_gettext"
'()
"Runs bindtextdomain and textdomain.")
(gw:wrap-function
ws
'gnc:gettext-helper

View File

@@ -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

View File

@@ -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 @@ 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 */
}

View File

@@ -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