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?
> > > http://library.gnome.org/devel/gio/unstable/GApplication.html#GApplicationClass.local-command-line
> > 
> > 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,
>   https://bugzilla.gnome.org/show_bug.cgi?id=643650
> 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.

ciao,
 Emmanuele.

-- 
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi


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