Asynchronous API to open a uri with an application.
GtkUriLauncher collects the arguments that are needed to open the uri.
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 [methodGtk.UriLauncher.launch] function.
To launch a file, use [classGtk.FileLauncher].
<group>Dialogs</group> <gtkada_demo>create_file_chooser.adb</gtkada_demo>
function Can_Launch
(Self : not null access Gtk_Uri_Launcher_Record;
Parent : access Gtk.Window.Gtk_Window_Record'Class) return Boolean
Returns whether the launcher is likely to succeed in launching an application for its uri. This can be used to disable controls that trigger the launcher when they are known not to work. Since: gtk+ 4.20
the parent window
false if the launcher is known not to support the uri, true otherwise
type Gasync_Ready_Callback is access procedure
(Source_Object : access Glib.Object.GObject_Record'Class;
Res : Glib.G_Async_Result);
Type definition for a function that will be called back when an asynchronous operation within GIO has been completed. Gasync_Ready_Callback callbacks from Gtask.Gtask are guaranteed to be invoked in a later iteration of the thread-default main context (see [methodGlib.MainContext.push_thread_default]) where the Gtask.Gtask was created. All other users of Gasync_Ready_Callback must likewise call it asynchronously in a later iteration of the main context. The asynchronous operation is guaranteed to have held a reference to Source_Object from the time when the *_async function was called, until after this callback returns.
the object the asynchronous operation was started with.
a Glib.G_Async_Result.
function Get_Type return Glib.GType
function Get_Uri
(Self : not null access Gtk_Uri_Launcher_Record) return UTF8_String
Gets the uri that will be opened. Since: gtk+ 4.10
the uri
procedure Gtk_New (Self : out Gtk_Uri_Launcher; URI : UTF8_String := "")
Creates a new GtkUriLauncher object. Since: gtk+ 4.10 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
the uri to open
type Gtk_Uri_Launcher is access all Gtk_Uri_Launcher_Record'Class;
function Gtk_Uri_Launcher_New
(URI : UTF8_String := "") return Gtk_Uri_Launcher
Creates a new GtkUriLauncher object. Since: gtk+ 4.10
the uri to open
type Gtk_Uri_Launcher_Record is new GObject_Record with null record;
procedure Initialize
(Self : not null access Gtk_Uri_Launcher_Record'Class;
URI : UTF8_String := "")
Creates a new GtkUriLauncher object. Since: gtk+ 4.10 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
the uri to open
procedure Launch
(Self : not null access Gtk_Uri_Launcher_Record;
Parent : access Gtk.Window.Gtk_Window_Record'Class;
Cancellable : access Glib.Cancellable.Gcancellable_Record'Class;
Callback : Gasync_Ready_Callback)
Launches an application to open the uri. This may present an app chooser dialog to the user. Since: gtk+ 4.10
the parent window
a cancellable to cancel the operation
a callback to call when the operation is complete
function Launch_Finish
(Self : not null access Gtk_Uri_Launcher_Record;
Result : Glib.G_Async_Result;
Error : out Glib.Error.GError) return Boolean
Finishes the [methodGtk.UriLauncher.launch] call and returns the result. Since: gtk+ 4.10
the result
the return location for a recoverable error
true if an application was launched
procedure Set_Uri
(Self : not null access Gtk_Uri_Launcher_Record;
URI : UTF8_String := "")
Sets the uri that will be opened. Since: gtk+ 4.10
the uri
URI_Property : constant Glib.Properties.Property_String;
The uri to launch.