Class AppLaunchContext
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
AppLaunchContext
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
AppLaunchContext.Builder<B extends AppLaunchContext.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theLaunchedCallback
callback.static interface
Functional interface declaration of theLaunchFailedCallback
callback.static interface
Functional interface declaration of theLaunchStartedCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionCreates a new application launch context.AppLaunchContext
(MemorySegment address) Create a AppLaunchContext proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected AppLaunchContext
asParent()
Returns this instance as if it were its parent type.static AppLaunchContext.Builder
<? extends AppLaunchContext.Builder> builder()
AAppLaunchContext.Builder
object constructs aAppLaunchContext
with the specified properties.void
emitLaunched
(AppInfo info, Variant platformData) Emits the "launched" signal.void
emitLaunchFailed
(String startupNotifyId) Emits the "launch-failed" signal.void
emitLaunchStarted
(AppInfo info, @Nullable Variant platformData) Emits the "launch-started" signal.getDisplay
(AppInfo info, List<File> files) Gets the display string for the this AppLaunchContext.String[]
Gets the complete environment variable list to be passed to the child process when this AppLaunchContext is used to launch an application.static MemoryLayout
The memory layout of the native struct.getStartupNotifyId
(@Nullable AppInfo info, @Nullable List<File> files) Initiates startup notification for the application and returns theXDG_ACTIVATION_TOKEN
orDESKTOP_STARTUP_ID
for the launched operation, if supported.static Type
getType()
Get the GType of the AppLaunchContext classprotected void
void
launchFailed
(String startupNotifyId) Called when an application has failed to launch, so that it can cancel the application startup notification started ingetStartupNotifyId(org.gnome.gio.AppInfo, org.gnome.glib.List<org.gnome.gio.File>)
.protected void
launchStarted
(AppInfo info, Variant platformData) TheGio.AppLaunchContext::launched
signal is emitted when aAppInfo
is successfully launched.TheGio.AppLaunchContext::launch-failed
signal is emitted when aAppInfo
launch fails.TheGio.AppLaunchContext::launch-started
signal is emitted when aAppInfo
is about to be launched.void
Arranges forvariable
to be set tovalue
in the child’s environment when this AppLaunchContext is used to launch an application.void
Arranges forvariable
to be unset in the child’s environment when this AppLaunchContext is used to launch an application.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
AppLaunchContext
Create a AppLaunchContext proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
AppLaunchContext
public AppLaunchContext()Creates a new application launch context. This is not normally used, instead you instantiate a subclass of this, such asGdkAppLaunchContext
.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getDisplay
Gets the display string for the this AppLaunchContext. This is used to ensure new applications are started on the same display as the launching application, by setting theDISPLAY
environment variable.- Parameters:
info
- the app infofiles
- a list ofFile
objects- Returns:
- a display string for the display.
-
getEnvironment
Gets the complete environment variable list to be passed to the child process when this AppLaunchContext is used to launch an application. This is aNULL
-terminated array of strings, where each string has the formKEY=VALUE
.- Returns:
- the child’s environment
-
getStartupNotifyId
public String getStartupNotifyId(@Nullable @Nullable AppInfo info, @Nullable @Nullable List<File> files) Initiates startup notification for the application and returns theXDG_ACTIVATION_TOKEN
orDESKTOP_STARTUP_ID
for the launched operation, if supported.The returned token may be referred to equivalently as an ‘activation token’ (using Wayland terminology) or a ‘startup sequence ID’ (using X11 terminology). The two are interoperable.
Activation tokens are defined in the XDG Activation Protocol, and startup notification IDs are defined in the freedesktop.org Startup Notification Protocol.
Support for the XDG Activation Protocol was added in GLib 2.76. Since GLib 2.82
info
andfiles
can beNULL
. If that’s not supported by the backend, the returned token will beNULL
.- Parameters:
info
- the app infofiles
- a list ofFile
objects- Returns:
- a startup notification ID for the application, or
NULL
if not supported.
-
launchFailed
Called when an application has failed to launch, so that it can cancel the application startup notification started ingetStartupNotifyId(org.gnome.gio.AppInfo, org.gnome.glib.List<org.gnome.gio.File>)
.- Parameters:
startupNotifyId
- the startup notification id that was returned bygetStartupNotifyId(org.gnome.gio.AppInfo, org.gnome.glib.List<org.gnome.gio.File>)
.
-
setenv
-
unsetenv
Arranges forvariable
to be unset in the child’s environment when this AppLaunchContext is used to launch an application.- Parameters:
variable
- the environment variable to remove
-
launchStarted
-
launched
-
onLaunchFailed
public SignalConnection<AppLaunchContext.LaunchFailedCallback> onLaunchFailed(AppLaunchContext.LaunchFailedCallback handler) TheGio.AppLaunchContext::launch-failed
signal is emitted when aAppInfo
launch fails. The startup notification id is provided, so that the launcher can cancel the startup notification.Because a launch operation may involve spawning multiple instances of the target application, you should expect this signal to be emitted multiple times, one for each spawned instance.
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitLaunchFailed
Emits the "launch-failed" signal. SeeonLaunchFailed(org.gnome.gio.AppLaunchContext.LaunchFailedCallback)
. -
onLaunchStarted
public SignalConnection<AppLaunchContext.LaunchStartedCallback> onLaunchStarted(AppLaunchContext.LaunchStartedCallback handler) TheGio.AppLaunchContext::launch-started
signal is emitted when aAppInfo
is about to be launched. If non-null theplatformData
is an GVariant dictionary mapping strings to variants (iea{sv}
), which contains additional, platform-specific data about this launch. On UNIX, at least thestartup-notification-id
keys will be present.The value of the
startup-notification-id
key (types
) is a startup notification ID corresponding to the format from the [startup-notification specification](https://specifications.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt). It allows tracking the progress of the launchee through startup.It is guaranteed that this signal is followed by either a
Gio.AppLaunchContext::launched
orGio.AppLaunchContext::launch-failed
signal.Because a launch operation may involve spawning multiple instances of the target application, you should expect this signal to be emitted multiple times, one for each spawned instance.
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitLaunchStarted
Emits the "launch-started" signal. SeeonLaunchStarted(org.gnome.gio.AppLaunchContext.LaunchStartedCallback)
. -
onLaunched
public SignalConnection<AppLaunchContext.LaunchedCallback> onLaunched(AppLaunchContext.LaunchedCallback handler) TheGio.AppLaunchContext::launched
signal is emitted when aAppInfo
is successfully launched.Because a launch operation may involve spawning multiple instances of the target application, you should expect this signal to be emitted multiple times, one time for each spawned instance.
The
platformData
is an GVariant dictionary mapping strings to variants (iea{sv}
), which contains additional, platform-specific data about this launch. On UNIX, at least thepid
andstartup-notification-id
keys will be present.Since 2.72 the
pid
may be 0 if the process id wasn’t known (for example if the process was launched via D-Bus). Thepid
may not be set at all in subsequent releases.On Windows,
pid
is guaranteed to be valid only for the duration of theGio.AppLaunchContext::launched
signal emission; after the signal is emitted, GLib will callGLib.spawnClosePid(org.gnome.glib.Pid)
. If you need to keep theGLib.Pid
after the signal has been emitted, then you can duplicatepid
usingDuplicateHandle()
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitLaunched
Emits the "launched" signal. SeeonLaunched(org.gnome.gio.AppLaunchContext.LaunchedCallback)
. -
builder
AAppLaunchContext.Builder
object constructs aAppLaunchContext
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withAppLaunchContext.Builder.build()
.
-