Application.connectHandleLocalOptions
gulong connectHandleLocalOptions(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == int)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == glib.variant_dict.VariantDict)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gio.application.Application)))
&& Parameters!T.length < 3)Connect to HandleLocalOptions signal.
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.Application.addMainOptionEntries] and [gio.application.Application.addOptionGroup].
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).
In the event that the application is marked [gio.types.ApplicationFlags.HandlesCommandLine] the "normal processing" will send the options dictionary to the primary instance where it can be read with [gio.application_command_line.ApplicationCommandLine.getOptionsDict]. The signal handler can modify the dictionary before returning, and the modified dictionary will be sent.
In the event that [gio.types.ApplicationFlags.HandlesCommandLine] 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.Application.activate]. One or more arguments results in a call to [gio.application.Application.open].
If you want to handle the local commandline arguments for yourself by converting them to calls to [gio.application.Application.open] or [gio.action_group.ActionGroup.activateAction] then you must be sure to register the application first. You should probably not call [gio.application.Application.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.
Parameters
callback | signal callback delegate or function to connect int callback(glib.variant_dict.VariantDict options, gio.application.Application application) options the options dictionary (optional) application the instance the signal is connected to (optional) Returns an exit code. If you have handled your options and want to exit the process, return a non-negative option, 0 for success, and a positive value for failure. To continue, return -1 to let the default option processing continue. |
after | Yes.After to execute callback after default handler, No.After to execute before (default) |