Re: how to access command line arguments?

Le dim 09/05/2004 à 02:23, Jochen Voss a écrit :
> Hello,
> how can I get access to the non-option command line arguments
> of a GNOME program?  During initialisation I use
>     GnomeProgram *my_app;
>     poptContext  pctx;
>     my_app = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
>                                  argc, argv,
>                                  GNOME_PROGRAM_STANDARD_PROPERTIES,
>                                  GNOME_PARAM_POPT_TABLE, options,
>                                  GNOME_PARAM_POPT_CONTEXT, &pctx,
>                                  NULL);
>     args = poptGetArgs (pctx);
> But the last command fails with the error message, that pctx is not
> writable.  The message is
>   (process:5820): GLib-GObject-WARNING **: gobject.c:671: property `popt-context' of object class `GnomeProgram' is not writable
> This confuses me, because I only try to READ the list of command
> line arguments.
> Is there any documentation about the popt stuff, which I could read?
> What am I doing wrong?
> Jochen

You should remove the "GNOME_PARAM_POPT_CONTEXT, &pctx," line and add
the following line just after the call to gnome_program_init.

g_object_get(G_OBJECT(my_app), GNOME_PARAM_POPT_CONTEXT, &pctx, NULL);


Jean Bréfort

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]