Class Application.Builder<B extends Application.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Direct Known Subclasses:
Application.Builder
- Enclosing class:
Application
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theApplication
object.onActivate
(Application.ActivateCallback handler) The ::activate signal is emitted on the primary instance when an activation occurs.The ::command-line signal is emitted on the primary instance when a commandline is not handled locally.The ::handle-local-options signal is emitted on the local instance after the parsing of the commandline options has occurred.onNameLost
(Application.NameLostCallback handler) The ::name-lost signal is emitted only on the registered primary instance when a new instance has taken over.onOpen
(Application.OpenCallback handler) The ::open signal is emitted on the primary instance when there are files to open.onShutdown
(Application.ShutdownCallback handler) The ::shutdown signal is emitted only on the registered primary instance immediately after the main loop terminates.onStartup
(Application.StartupCallback handler) The ::startup signal is emitted on the primary instance immediately after registration.setActionGroup
(ActionGroup actionGroup) Deprecated.setApplicationId
(String applicationId) The unique identifier for the application.setFlags
(Set<ApplicationFlags> flags) Flags specifying the behaviour of the application.setFlags
(ApplicationFlags... flags) Flags specifying the behaviour of the application.setInactivityTimeout
(int inactivityTimeout) Time (in milliseconds) to stay alive after becoming idle.setResourceBasePath
(String resourceBasePath) The base resource path for the application.setVersion
(String version) The human-readable version number of the application.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theApplication
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toApplication
.- Overrides:
build
in classGObject.Builder<B extends Application.Builder<B>>
- Returns:
- a new instance of
Application
with the properties that were set in the Builder object.
-
setActionGroup
Deprecated.The group of actions that the application exports.- Parameters:
actionGroup
- the value for theaction-group
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setApplicationId
-
setFlags
Flags specifying the behaviour of the application.- Parameters:
flags
- the value for theflags
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setInactivityTimeout
Time (in milliseconds) to stay alive after becoming idle.- Parameters:
inactivityTimeout
- the value for theinactivity-timeout
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setResourceBasePath
-
setVersion
-
setFlags
Flags specifying the behaviour of the application.- Parameters:
flags
- the value for theflags
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onActivate
The ::activate signal is emitted on the primary instance when an activation occurs. See g_application_activate().- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onCommandLine
The ::command-line signal is emitted on the primary instance when a commandline is not handled locally. See g_application_run() and theGApplicationCommandLine
documentation for more information.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onHandleLocalOptions
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 g_application_add_main_option_entries() and g_application_add_option_group().
Signal handlers can inspect
options
(along with values pointed to from theargData
of an installedGOptionEntrys
) 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
ApplicationFlags.HANDLES_COMMAND_LINE
the "normal processing" will send theoptions
dictionary to the primary instance where it can be read with g_application_command_line_get_options_dict(). The signal handler can modify the dictionary before returning, and the modified dictionary will be sent.In the event that
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 g_application_activate(). One or more arguments results in a call to g_application_open().If you want to handle the local commandline arguments for yourself by converting them to calls to g_application_open() or g_action_group_activate_action() then you must be sure to register the application first. You should probably not call g_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:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onNameLost
The ::name-lost signal is emitted only on the registered primary instance when a new instance has taken over. This can only happen if the application is using theApplicationFlags.ALLOW_REPLACEMENT
flag.The default handler for this signal calls g_application_quit().
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onOpen
The ::open signal is emitted on the primary instance when there are files to open. See g_application_open() for more information.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onShutdown
The ::shutdown signal is emitted only on the registered primary instance immediately after the main loop terminates.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onStartup
The ::startup signal is emitted on the primary instance immediately after registration. See g_application_register().- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-