Gio.Application::handle-local-options
connect('handle-local-options', function (application, options: GLib.VariantDict, ): Number(gint));
The ::handle-local-options signal is emitted on the local instance after the parsing of the commandline options has occurred.
You can add options to be recognised during commandline option parsing using Gio.Application.prototype.add_main_option_entries and Gio.Application.prototype.add_option_group.
Signal handlers can inspect options (along with values pointed to from the @arg_data of an installed #GOptionEntrys) in order to decide to perform certain actions, including direct local handling (which may be useful for options like --version).
If the options have been "handled" then a non-negative value should be returned. In this case, the return value is the exit status: 0 for success and a positive value for failure. -1 means to continue normal processing.
In the event that the application is marked Gio.ApplicationFlags.handles_command_line the "normal processing" will send the @option dictionary to the primary instance where it can be read with g_application_command_line_get_options(). The signal handler can modify the dictionary before returning, and the modified dictionary will be sent.
In the event that Gio.ApplicationFlags.handles_command_line is not set, "normal processing" will treat the remaining uncollected command line arguments as filenames or URIs. If there are no arguments, the application is activated by Gio.Application.prototype.activate. One or more arguments results in a call to Gio.Application.prototype.open.
If you want to handle the local commandline arguments for yourself by converting them to calls to Gio.Application.prototype.open or Gio.ActionGroup.prototype.activate_action then you must be sure to register the application first. You should probably not call Gio.Application.prototype.activate for yourself, however: just return -1 and allow the default handler to do it for you. This will ensure that the `--gapplication-service` switch works properly (i.e. no activation in that case).
Note that this signal is emitted from the default implementation of local_command_line(). If you override that function and don't chain up then this signal will never be emitted.
You can override local_command_line() if you need more powerful capabilities than what is provided here, but this should not normally be required.
Since 2.40
- application
instance of Gio.Application that is emitting the signal
- options
the options dictionary
- Returns