[Gnucash-changes] r13138 - gnucash/trunk - Fix some issues when invoking from a non-utf8, non latin1 locale. Use

Chris Shoemaker c.shoemaker at cox.net
Tue Feb 7 14:47:05 EST 2006


On Mon, Feb 06, 2006 at 10:59:18PM -0500, David Hampton wrote:
> Author: hampton
> Date: 2006-02-06 22:59:17 -0500 (Mon, 06 Feb 2006)
> New Revision: 13138
> Trac: http://svn.gnucash.org/trac/changeset/13138
> 
> Modified:
>    gnucash/trunk/ChangeLog
>    gnucash/trunk/src/bin/gnucash-bin.c
> Log:
> Fix some issues when invoking from a non-utf8, non latin1 locale.  Use
> g_print to print to the console. Convert from popt to g_options for
> glib >= 2.6.
> 
> 
> Modified: gnucash/trunk/src/bin/gnucash-bin.c
> ===================================================================
> --- gnucash/trunk/src/bin/gnucash-bin.c	2006-02-07 01:56:45 UTC (rev 13137)
> +++ gnucash/trunk/src/bin/gnucash-bin.c	2006-02-07 03:59:17 UTC (rev 13138)
> @@ -204,12 +205,12 @@
> +    /* Pretend that argv[0] is "gnucash" */
> +    if ((p = strstr(argv[0], "-bin"))) *p = '\0';
>  
> +    context = g_option_context_new (" [datafile]");
> +    g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
> +    g_option_context_add_group (context, gtk_get_option_group (TRUE));
> +    g_option_context_parse (context, &argc, &argv, &error);
> +    g_option_context_free (context);
> +
> +    if (argc > 0)
> +      file_to_load = argv[1];

I think the HAVE_GLIB26 and !HAVE_GLIB26 paths need to behave more
similarly w.r.t. modifying argv.  There are still two argv/argc
parsers that come after this: gnome, and guile.  At the very least,
they need an argc that matches argv.

Gnome just supports a sound option and an option for the crash
dialog. If we wanted to we could disable gnome's option parsing by
just passing 0, NULL.

I don't _think_ guile parses any options on its own, but our guile
code does still parse one stinkin' option: doc-path.  Even though we
read it in popt, we're also letting guile read it, too.  This is
because I haven't figured out a way to extricate that option from
guile yet.  Since it's the last option parsed in guile, whoever
figures it out will have the pleasure of killing command-line.scm and
related code.

I don't see any way of telling GOptionContext to always leave argv
alone.  So it seems that:

a) if we want to allow the gnome options, we have to
set_ignore_unknown_options().

b) If we want to use GOptionContext, we either have to remove doc-path
from the option table and set_ignore_unknown_options() or extricate it
from guile.

c) unless we want to allow only the options parsed by the
GOptionContext, we have to recompute argc.


For now, I'll fixup argc until we decide about a) and b).

-chris


More information about the gnucash-devel mailing list