1.68 <GtkFileLauncher>

Class: <GtkFileLauncher>

It derives from <GObject>.

Asynchronous API to open a file with an application.

<GtkFileLauncher> collects the arguments that are needed to open the file.

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 file-launcher:launch function.

To launch uris that don’t represent files, use <GtkUriLauncher>.

Properties

Property: file-launcher:always-ask self

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.

Its value is a boolean.

Set it with (set! (file-launcher:always-ask self) value).

Property: file-launcher:file self

The file to launch.

Its value is a <GFile>, or #f.

Set it with (set! (file-launcher:file self) value).

Property: file-launcher:writable self

Whether to make the file writable for the handler.

Its value is a boolean.

Set it with (set! (file-launcher:writable self) value).

Procedures

Method: file-launcher:get-always-ask? self ⇒ %return
Method: get-always-ask? self ⇒ %return

Returns whether to ask the user which app to use.

self

Passed: a <GtkFileLauncher>.

a file launcher

%return

Returned: a boolean.

true if always asking the user

Method: file-launcher:get-file self ⇒ %return
Method: get-file self ⇒ %return

Gets the file that will be opened.

self

Passed: a <GtkFileLauncher>.

a file launcher

%return

Returned: a <GFile>, or #f.

the file

Method: file-launcher:get-writable? self ⇒ %return
Method: get-writable? self ⇒ %return

Returns whether to make the file writable for the handler.

self

Passed: a <GtkFileLauncher>.

a file launcher

%return

Returned: a boolean.

true if the file will be made writable

Method: file-launcher:launch self [parent] [cancellable] [callback]
Method: launch self [parent] [cancellable] [callback]

Launches an application to open the file.

This may present an app chooser dialog to the user.

self

Passed: a <GtkFileLauncher>.

a file launcher

parent

Passed, or left out: a <GtkWindow>, or #f.

the parent window

cancellable

Passed, or left out: a <GCancellable>, or #f.

a cancellable to cancel the operation

callback

Passed, or left out: a procedure, or #f.

a callback to call when the operation is complete

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Method: file-launcher:launch-finish? self result ⇒ %return
Method: launch-finish? self result ⇒ %return

Finishes the file-launcher:launch call and returns the result.

self

Passed: a <GtkFileLauncher>.

a file launcher

result

Passed: a <GAsyncResult>.

the result

%return

Returned: a boolean.

true if an application was launched

Procedure: file-launcher:new [file] ⇒ %return

Creates a new <GtkFileLauncher> object.

file

Passed, or left out: a <GFile>, or #f.

the file to open

%return

Returned: a <GtkFileLauncher>.

the new <GtkFileLauncher>

Method: file-launcher:open-containing-folder self [parent] [cancellable] [callback]
Method: open-containing-folder self [parent] [cancellable] [callback]

Launches a file manager to show the file in its parent directory.

This is only supported for native files. It will fail if file is e.g. a http:// uri.

self

Passed: a <GtkFileLauncher>.

a file launcher

parent

Passed, or left out: a <GtkWindow>, or #f.

the parent window

cancellable

Passed, or left out: a <GCancellable>, or #f.

a cancellable to cancel the operation

callback

Passed, or left out: a procedure, or #f.

a callback to call when the operation is complete

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Method: file-launcher:open-containing-folder-finish? self result ⇒ %return
Method: open-containing-folder-finish? self result ⇒ %return

Finishes the file-launcher:open-containing-folder call and returns the result.

self

Passed: a <GtkFileLauncher>.

a file launcher

result

Passed: a <GAsyncResult>.

the result

%return

Returned: a boolean.

true if an application was launched

Method: file-launcher:set-always-ask self always-ask
Method: set-always-ask self always-ask

Sets whether to always ask the user which app to use.

If false, the file might be opened with a default app or the previous choice.

self

Passed: a <GtkFileLauncher>.

a file launcher

always-ask

Passed: a boolean.

whether to always ask

Method: file-launcher:set-file self [file]
Method: set-file self [file]

Sets the file that will be opened.

self

Passed: a <GtkFileLauncher>.

a file launcher

file

Passed, or left out: a <GFile>, or #f.

the file

Method: file-launcher:set-writable self writable
Method: set-writable self writable

Sets whether to make the file writable for the handler.

self

Passed: a <GtkFileLauncher>.

a file launcher

writable

Passed: a boolean.

whether to make the file writable