[Gnucash-changes] r12964 - gnucash/trunk/src/bin - Avoid GUI initialization durring --add-price-quotes, fixes #327670

Chris Shoemaker chris at cvs.gnucash.org
Mon Jan 23 14:29:58 EST 2006


Author: chris
Date: 2006-01-23 14:29:57 -0500 (Mon, 23 Jan 2006)
New Revision: 12964
Trac: http://svn.gnucash.org/trac/changeset/12964

Modified:
   gnucash/trunk/src/bin/Makefile.am
   gnucash/trunk/src/bin/gnucash-bin.c
Log:
  Avoid GUI initialization durring --add-price-quotes, fixes #327670

  BTW, it turns out that we don't need to call gtk_init().  It's called 
  during the LIBGNOMEUI_MODULE initializtion from gnome_program_init().


Modified: gnucash/trunk/src/bin/Makefile.am
===================================================================
--- gnucash/trunk/src/bin/Makefile.am	2006-01-23 19:01:13 UTC (rev 12963)
+++ gnucash/trunk/src/bin/Makefile.am	2006-01-23 19:29:57 UTC (rev 12964)
@@ -3,8 +3,10 @@
 
 AM_CFLAGS = -I${top_builddir} ${GLIB_CFLAGS} ${GNOME_CFLAGS} ${GTK_CFLAGS} \
   ${QOF_CFLAGS} \
-  -DGNC_CONFIGDIR=\"${GNC_CONFIGDIR}\" \
-  -DGNC_SHAREDIR=\"${GNC_SHAREDIR}\" \
+  -DPREFIX=\"${prefix}\" \
+  -DSYSCONFDIR=\"${GNC_CONFIGDIR}\" \
+  -DDATADIR=\"${GNC_SHAREDIR}\" \
+  -DLIBDIR=\"${GNC_LIBDIR}\" \
   -DGNC_HELPDIR=\"${GNC_HELPDIR}\" \
   -I${top_srcdir}/src \
   -I${top_srcdir}/src/core-utils \

Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2006-01-23 19:01:13 UTC (rev 12963)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2006-01-23 19:29:57 UTC (rev 12964)
@@ -30,6 +30,7 @@
 #include <libguile.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
+#include <libgnome/libgnome.h>
 #include "glib.h"
 #include "gnc-module.h"
 #include "i18n.h"
@@ -76,8 +77,8 @@
 /* Priority of paths: The default is set at build time.  It may be
    overridden by environment variables, which may, in turn, be
    overridden by command line options.  */
-static char *config_path = GNC_CONFIGDIR;
-static char *share_path = GNC_SHAREDIR;
+static char *config_path = SYSCONFDIR;
+static char *share_path = DATADIR;
 static char *help_path = GNC_HELPDIR;
 
 static void
@@ -403,17 +404,23 @@
     bind_textdomain_codeset (TEXT_DOMAIN, "UTF-8");
 #endif
 
-    gtk_init (&argc, &argv);
     gnc_module_system_init();
     envt_override();
     gnucash_command_line(argc, argv);
     gnc_print_unstable_message();
-    gnc_gnome_init (argc, argv, VERSION);
 
     if (add_quotes_file) {
+        /* This option needs to run without a display, so we can't
+           initialize any GUI libraries.  */
+        gnome_program_init(
+            "gnucash", VERSION, LIBGNOME_MODULE,
+            argc, argv,
+            GNOME_PROGRAM_STANDARD_PROPERTIES, GNOME_PARAM_NONE);
         scm_boot_guile(argc, argv, inner_main_add_price_quotes, 0);
+        exit(0);  /* never reached */
     }
 
+    gnc_gnome_init (argc, argv, VERSION);
     scm_boot_guile(argc, argv, inner_main, 0);
     exit(0); /* never reached */
 }



More information about the gnucash-changes mailing list