Package org.gnome.gtk
Class FileLauncher
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.gobject.TypeInstance
org.gnome.gobject.GObject
org.gnome.gtk.FileLauncher
- All Implemented Interfaces:
Proxy
A
GtkFileLauncher
object collects the arguments that are needed to open a
file with an application.
Depending on system configuration, user preferences and available APIs, this may or may not show an app chooser dialog or launch the default application right away.
The operation is started with the launch(org.gnome.gtk.Window, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)
function.
To launch uris that don't represent files, use UriLauncher
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
FileLauncher.Builder<B extends FileLauncher.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionCallsFileLauncher(org.gnome.gio.File)
with file =null
FileLauncher
(MemorySegment address) Create a FileLauncher proxy instance for the provided memory address.FileLauncher
(@Nullable File file) Creates a newGtkFileLauncher
object. -
Method Summary
Modifier and TypeMethodDescriptionprotected FileLauncher
asParent()
Returns this instance as if it were its parent type.static FileLauncher.Builder
<? extends FileLauncher.Builder> builder()
AFileLauncher.Builder
object constructs aFileLauncher
with the specified properties.boolean
Returns whether to ask the user to choose an app for opening the file.getFile()
Gets the file that will be opened.static Type
getType()
Get the GType of the FileLauncher classboolean
Returns whether to make the file writable for the handler.void
launch
(@Nullable Window parent, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Launch an application to open the file.boolean
launchFinish
(AsyncResult result) Finishes thelaunch(org.gnome.gtk.Window, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)
call and returns the result.void
openContainingFolder
(@Nullable Window parent, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Launch a file manager to show the file in its parent directory.boolean
Finishes theopenContainingFolder(org.gnome.gtk.Window, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)
call and returns the result.void
setAlwaysAsk
(boolean alwaysAsk) Sets whether to awlays ask the user to choose an app for opening the file.void
Sets the file that will be opened.void
setWritable
(boolean writable) Sets whether to make the file writable for the handler.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, getMemoryLayout, 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
-
FileLauncher
Create a FileLauncher proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
FileLauncher
Creates a newGtkFileLauncher
object.- Parameters:
file
- the file to open
-
FileLauncher
public FileLauncher()CallsFileLauncher(org.gnome.gio.File)
with file =null
-
-
Method Details
-
getType
-
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. -
getAlwaysAsk
public boolean getAlwaysAsk()Returns whether to ask the user to choose an app for opening the file.- Returns:
TRUE
if always asking for app
-
getFile
-
getWritable
public boolean getWritable()Returns whether to make the file writable for the handler.- Returns:
TRUE
if the file will be made writable
-
launch
public void launch(@Nullable @Nullable Window parent, @Nullable @Nullable Cancellable cancellable, @Nullable @Nullable AsyncReadyCallback callback) Launch an application to open the file.This may present an app chooser dialog to the user.
- Parameters:
parent
- the parentGtkWindow
cancellable
- aGCancellable
to cancel the operationcallback
- a callback to call when the operation is complete
-
launchFinish
Finishes thelaunch(org.gnome.gtk.Window, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)
call and returns the result.- Parameters:
result
- aGAsyncResult
- Returns:
TRUE
if an application was launched, orFALSE
anderror
is set- Throws:
GErrorException
- seeGError
-
openContainingFolder
public void openContainingFolder(@Nullable @Nullable Window parent, @Nullable @Nullable Cancellable cancellable, @Nullable @Nullable AsyncReadyCallback callback) Launch a file manager to show the file in its parent directory.This is only supported native files. It will fail if
file
is e.g. a http:// uri.- Parameters:
parent
- the parentGtkWindow
cancellable
- aGCancellable
to cancel the operationcallback
- a callback to call when the operation is complete
-
openContainingFolderFinish
Finishes theopenContainingFolder(org.gnome.gtk.Window, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)
call and returns the result.- Parameters:
result
- aGAsyncResult
- Returns:
TRUE
if an application was launched, orFALSE
anderror
is set- Throws:
GErrorException
- seeGError
-
setAlwaysAsk
public void setAlwaysAsk(boolean alwaysAsk) Sets whether to awlays ask the user to choose an app for opening the file. IfFALSE
, the file might be opened with a default app or the previous choice.- Parameters:
alwaysAsk
- agboolean
-
setFile
Sets the file that will be opened.- Parameters:
file
- aGFile
-
setWritable
public void setWritable(boolean writable) Sets whether to make the file writable for the handler.- Parameters:
writable
- agboolean
-
builder
AFileLauncher.Builder
object constructs aFileLauncher
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withFileLauncher.Builder.build()
.
-