Re: GtkApplication handling command line
- From: Bastien Nocera <hadess hadess net>
- To: Jonh Wendell <jwendell gnome org>
- Cc: gtk-devel-list gnome org
- Subject: Re: GtkApplication handling command line
- Date: Sat, 13 Nov 2010 13:42:17 +0000
On Sat, 2010-11-13 at 10:22 -0300, Jonh Wendell wrote:
> hi, folks. I'm trying to port vinagre from old gtkapplication to the new
> implementation, based on totem code. there's an issue (totem is affected
> too).
>
> if I create the app object with HANDLE_COMMAND_LINE flag, the command
> line will always be passed to the primary instance.
>
> We (totem, vinagre and others) are using GOptionContext to parse command
> line arguments. So, if the user has already totem running, open a
> terminal and type 'totem --help', this will be passed to the primary
> instance, which will output the help and exit the program.
Do _NOT_ use Totem as an example of how to use GtkApplication. Totem is
special because it wants to parse the command-line, do some things, then
act some more on the command-line. And depending on the options, it
might, or might not have shown the window (because we want the window to
show up as soon as possible, unless we fullscreen it on startup).
> Try yourself by running totem master. The code is here:
> http://git.gnome.org/browse/totem/tree/src/totem.c
>
> so, what should we do to handle this case? We want to parse things like
> '--help' locally, but the rest we want to pass to the primary instance -
> and we want to use GOptionContext.
>
> Perhaps we can do something by subclassing gtkapplication and
> overwriting local_command_line method, and do some workaround to still
> be able to use GOptionContext both local and remotely.
You can already do that. Just parse the options in your handler for the
command-line signal, and voila.
> As this is a typical use case in gnome applications, we should have a
> better/easier way to integrate gtkapplication and goptioncontext, agree?
Cheers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]