On Thu, 2011-02-24 at 23:41 +0000, Emmanuele Bassi wrote:
> On 2011-02-21 at 21:57, Murray Cumming wrote:
> 
> I'll leave the other points, as they've received a reply already.
> 
> > 2.
> > How should we use GOptionContext to parse command line arguments from
> > argc/argv when using GtkApplication. Is this the ideal way, using the
> > command-line signal?
> >   http://git.gnome.org/browse/totem/tree/src/totem.c#n187
> > It seems a little long-winded.
> 
> Totem's usage is not entirely trivial: it requires argument parsing in
> the local (i.e. the just executed) and remote (i.e. the currently
> running) instances.
> 
> simpler cases are:
> 
>   • you can just parse all arguments in the local instance, which means
>     using g_option_context_parse() prior to creating the G(tk)Application
>     instance; in this case, the command line arguments can be used to
>     parametrize the Application instance, e.g via GObject properties,
>     direct access to instance members, or even GApplication actions (as
>     soon as they get more functionality).
> 
>   • 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
> 
> probably the latter case is a more direct map of what you'd have done
> with libunique or the Bacon copy-and-paste API.
> 
> in general, and if at all possible, I'd strongly advise to use the first
> approach (local parsing), and keep an eye out as soon as the GAction API
> gets more love and functionality.

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


-- 
murr...@murrayc.com
www.murrayc.com
www.openismus.com

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list

Reply via email to