Re: GtkApplication and argc/arv

On 2011-03-03 at 07:18, Murray Cumming wrote:
> On Wed, 2011-03-02 at 10:07 +0000, Emmanuele Bassi wrote:
> [snip]
> > > Thanks for the suggestion, but why wouldn't you use the
> > > GApplication::local_command_line vfunc for local command-line parsing?
> > >
> > 
> > if I a) don't want to sub-class GApplication and b) want to do local
> > command line parsing, it's pretty trivial to use a GOptionContext and
> > parse the command line prior to creating the GApplication.
> [snip]
> That would be nice for us to recommend here,
> but wouldn't that require us to call gtk_init() before
> g_option_context_parse(), to first remove the "standard" options? Or we
> could just call gtk_init_with_args().

you can get the option group from GTK+/GDK, and even do so without
opening the GdkDisplay; these will take care of the GTK+/GDK command
line options (while they are still there).

there are least three or four different ways (and probably more that I
just don't see) of doing command line argument parsing with GOption and
GApplication; the examples in the GIO documentation and tests/ directory
are a demonstration.

there's also the matter that GOption was written way before GApplication,
and the API of GOption is constrained by its location insize GLib. I
wouldn't be surprised if at any point in time we just added some command
line option parsing API into GApplication itself.



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