Re: GtkApplication and argc/arv



On 2011-03-02 at 09:30, Murray Cumming wrote:
> >   • you can defer all command line parsing to the remote instance, by
> >     passing the G_APPLICATION_HANDLES_COMMAND_LINE flag to the
> >     constructor and by connecting to the ::command-line signal; and
> >     example is in the Dictionary:
> > 
> >     http://git.gnome.org/browse/gnome-utils/tree/gnome-dictionary/src/gdict-app.c#n222
 
> 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. the only
difference between that and using local_command_line() is that with the
former you can create an Application instance with its initial state
already set up from the command line arguments parsing; and with the
latter you have access to an already existing Application instance that
you can change.

again: if you're pattern is to sub-class GApplication then
local_command_line() is probably a better choice; but we don't strictly
require sub-classing in gio and gtk+.

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]