Gtk.FileLauncher¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.FileLauncher(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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 [method`Gtk`.FileLauncher.launch] function. This API follows the GIO async pattern, and the result can be obtained by calling [method`Gtk`.FileLauncher.launch_finish].
To launch uris that don’t represent files, use [class`Gtk`.UriLauncher].
New in version 4.10.
- classmethod new(file)[source]¶
- Parameters:
- Returns:
the new
GtkFileLauncher
- Return type:
Creates a new
GtkFileLauncher
object.New in version 4.10.
- get_always_ask()[source]¶
- Returns:
TRUE
if always asking for app- Return type:
Returns whether to ask the user to choose an app for opening the file.
New in version 4.12.
- launch(parent, cancellable, callback, *user_data)[source]¶
- Parameters:
parent (
Gtk.Window
orNone
) – the parentGtkWindow
cancellable (
Gio.Cancellable
orNone
) – aGCancellable
to cancel the operationcallback (
Gio.AsyncReadyCallback
orNone
) – a callback to call when the operation is complete
Launch an application to open the file.
This may present an app chooser dialog to the user.
The callback will be called when the operation is completed. It should call [method`Gtk`.FileLauncher.launch_finish] to obtain the result.
New in version 4.10.
- launch_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGAsyncResult
- Raises:
- Returns:
TRUE
if an application was launched, orFALSE
and error is set- Return type:
Finishes the [method`Gtk`.FileLauncher.launch] call and returns the result.
New in version 4.10.
- open_containing_folder(parent, cancellable, callback, *user_data)[source]¶
- Parameters:
parent (
Gtk.Window
orNone
) – the parentGtkWindow
cancellable (
Gio.Cancellable
orNone
) – aGCancellable
to cancel the operationcallback (
Gio.AsyncReadyCallback
orNone
) – a callback to call when the operation is complete
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.
The callback will be called when the operation is completed. It should call [method`Gtk`.FileLauncher.open_containing_folder_finish] to obtain the result.
New in version 4.10.
- open_containing_folder_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGAsyncResult
- Raises:
- Returns:
TRUE
if an application was launched, orFALSE
and error is set- Return type:
Finishes the [method`Gtk`.FileLauncher.open_containing_folder] call and returns the result.
New in version 4.10.
Property Details¶
- Gtk.FileLauncher.props.always_ask¶
- Name:
always-ask
- Type:
- Default Value:
- Flags:
Whether to ask the user to choose an app for opening the file. If
FALSE
, the file might be opened with a default app or the previous choice.New in version 4.12.