W Wrapl, The Programming Language

Libraries:Gtk:Gio:GAppInfo

Types

T

T and Gtk.Gio.GAppLaunchContext.T are used for describing and launching applications installed on the system.

As of GLib 2.20, URIs will always be converted to POSIX paths (using Gtk.Gio.GFile.GetPath) when using Launch even if the application requested an URI and not a POSIX path. For example for an desktop-file based application with Exec key totem %U and a single URI, sftp://foo/file.avi, then /home/user/.gvfs/sftp on foo/file.avi will be passed. This will only work if a set of suitable GIO extensions (such as gvfs 2.26 compiled with FUSE support), is available and operational; if this is not the case, the URI will be passed unmodified to the application. Some URIs, such as mailto:, of course cannot be mapped to a POSIX path (in gvfs there's no FUSE mount for it); such URIs will be passed unmodified to the application.

Specifically for gvfs 2.26 and later, the POSIX URI will be mapped back to the GIO URI in the Gtk.Gio.GFile.T constructors (since gvfs implements the Gtk.Gio.GVfs.T extension point). As such, if the application needs to examine the URI, it needs to use Gtk.Gio.GFile.GetUri or similar on Gtk.Gio.GFile.T. In other words, an application cannot assume that the URI passed to e.g. g_file_new_for_commandline_arg() is equal to the result of Gtk.Gio.GFile.GetUri. The following snippet illustrates this:

GFile *f;
char *uri;

file = g_file_new_for_commandline_arg (uri_from_commandline);

uri = g_file_get_uri (file);
strcmp (uri, uri_from_commandline) == 0; // FALSE
g_free (uri);

if (g_file_has_uri_scheme (file, "cdda"))
  {
    // do something special with uri
  }
g_object_unref (file);

This code will work when both cdda://sr0/Track 1.wav and /home/user/.gvfs/cdda on sr0/Track 1.wav is passed to the application. It should be noted that it's generally not safe for applications to rely on the format of a particular URIs. Different launcher applications (e.g. file managers) may have different ideas of what a given URI means.



ParentT

Constants

InterfaceInfo : Std.Object.T

Nil : T

Functions

CreateFromCommandline(commandline @ Std.String.T, application_name @ Std.String.T, flags @ Std.Integer.SmallT, error @ Std.Object.T) : Gtk.Gio.GAppInfo.T

Creates a new T from the given information.

commandline the commandline to use
application_name the application name, or NULL to use commandline. [allow-none]
flags flags that can specify details of the created T
error a Gtk.Glib.GError.T location to store the error occurring, NULL to ignore.
Returns new T for given command. [transfer full]


GetAll() : Std.Object.T

Gets a list of all of the applications currently registered on this system.

For desktop files, this includes applications that have NoDisplay=true set or are excluded from display by means of OnlyShowIn or NotShowIn. See ShouldShow. The returned list does not include applications which have the Hidden key set.

Returns a newly allocated GList of references to Ts. [element-type GAppInfo][transfer full]


GetAllForType(content_type @ Std.String.T) : Std.Object.T

Gets a list of all GAppInfos for a given content type.

content_type the content type to find a T for
Returns GList of GAppInfos for given content_type or NULL on error. [element-type GAppInfo][transfer full]


GetDefaultForType(content_type @ Std.String.T, must_support_uris @ Std.Symbol.T) : Gtk.Gio.GAppInfo.T

Gets the T that corresponds to a given content type.

content_type the content type to find a T for
must_support_uris if TRUE, the T is expected to support URIs
Returns T for given content_type or NULL on error. [transfer full]


GetDefaultForUriScheme(uri_scheme @ Std.String.T) : Gtk.Gio.GAppInfo.T

Gets the default application for launching applications using this URI scheme. A URI scheme is the initial part of the URI, up to but not including the ':', e.g. "http", "ftp" or "sip".

uri_scheme a string containing a URI scheme.
Returns T for given uri_scheme or NULL on error. [transfer full]


GetType() : Gtk.GObject.Type.T



LaunchDefaultForUri(uri @ Std.String.T, launch_context @ Gtk.Gio.GAppLaunchContext.T, error @ Std.Object.T) : Std.Symbol.T

Utility function that launches the default application registered to handle the specified uri. Synchronous I/O is done on the uri to detect the type of the file if required.

uri the uri to show
launch_context an optional Gtk.Gio.GAppLaunchContext.T. [allow-none]
error a Gtk.Glib.GError.T.
Returns TRUE on success, FALSE on error.


ResetTypeAssociations(content_type @ Std.String.T) : Std.Object.T

Removes all changes to the type associations done by SetAsDefaultForType, SetAsDefaultForExtension, AddSupportsType or RemoveSupportsType.

content_type a content type


Methods

:AddSupportsType(self @ T, content_type @ Std.String.T, error @ Std.Object.T) : Std.Symbol.T

Adds a content type to the application information to indicate the application is capable of opening files with the given content type.

appinfo a T.
content_type a string.
error a Gtk.Glib.GError.T.
Returns TRUE on success, FALSE on error.


:AddSupportsType(_ @ ParentT, _ @ Std.String.T, _ @ Std.Object.T)

:CanDelete(self @ T) : Std.Symbol.T

Obtains the information whether the T can be deleted. See Delete.

appinfo a T
Returns TRUE if appinfo can be deleted


:CanDelete(_ @ ParentT)

:CanRemoveSupportsType(self @ T) : Std.Symbol.T

Checks if a supported content type can be removed from an application.

appinfo a T.
Returns TRUE if it is possible to remove supported content types from a given appinfo, FALSE if not.


:CanRemoveSupportsType(_ @ ParentT)

:Delete(self @ T) : Std.Symbol.T

Tries to delete a T.

On some platforms, there may be a difference between user-defined Ts which can be deleted, and system-wide ones which cannot. See CanDelete.

Virtual: do_delete

appinfo a T
Returns TRUE if appinfo has been deleted


:DoDelete(_ @ ParentT)

:Dup(self @ T) : Gtk.Gio.GAppInfo.T

Creates a duplicate of a T.

appinfo a T.
Returns a duplicate of appinfo. [transfer full]


:Dup(_ @ ParentT)

:Equal(self @ T, appinfo2 @ Gtk.Gio.GAppInfo.T) : Std.Symbol.T

Checks if two Ts are equal.

appinfo1 the first T.
appinfo2 the second T.
Returns TRUE if appinfo1 is equal to appinfo2. FALSE otherwise.


:Equal(_ @ ParentT, _ @ Gtk.Gio.GAppInfo.T)

:GetCommandline(self @ T) : Std.String.T

Gets the commandline with which the application will be started.

appinfo a T
Returns a string containing the appinfo's commandline, or NULL if this information is not available


:GetDescription(self @ T) : Std.String.T

Gets a human-readable description of an installed application.

appinfo a T.
Returns a string containing a description of the application appinfo, or NULL if none.


:GetDisplayName(self @ T) : Std.String.T

Gets the display name of the application. The display name is often more descriptive to the user than the name itself.

appinfo a T.
Returns the display name of the application for appinfo, or the name if no display name is available.


:GetExecutable(self @ T) : Std.String.T

Gets the executable's name for the installed application.

appinfo a T
Returns a string containing the appinfo's application binaries name


:GetIcon(self @ T) : Gtk.Gio.GIcon.T

Gets the icon for the application.

appinfo a T.
Returns the default Gtk.Gio.GIcon.T for appinfo. [transfer none]


:GetIcon(_ @ ParentT)

:GetId(self @ T) : Std.String.T

Gets the ID of an application. An id is a string that identifies the application. The exact format of the id is platform dependent. For instance, on Unix this is the desktop file id from the xdg menu specification.

Note that the returned ID may be NULL, depending on how the appinfo has been constructed.

appinfo a T.
Returns a string containing the application's ID.


:GetName(self @ T) : Std.String.T

Gets the installed name of the application.

appinfo a T.
Returns the name of the application for appinfo.


:Launch(self @ T, files @ Std.Object.T, launch_context @ Gtk.Gio.GAppLaunchContext.T, error @ Std.Object.T) : Std.Symbol.T

Launches the application. Passes files to the launched application as arguments, using the optional launch_context to get information about the details of the launcher (like what screen it is on). On error, error will be set accordingly.

To launch the application without arguments pass a NULL files list.

Note that even if the launch is successful the application launched can fail to start if it runs into problems during startup. There is no way to detect this.

Some URIs can be changed when passed through a GFile (for instance unsupported uris with strange formats like mailto:), so if you have a textual uri you want to pass in as argument, consider using LaunchUris instead.

On UNIX, this function sets the GIO_LAUNCHED_DESKTOP_FILE environment variable with the path of the launched desktop file and GIO_LAUNCHED_DESKTOP_FILE_PID to the process id of the launched process. This can be used to ignore GIO_LAUNCHED_DESKTOP_FILE, should it be inherited by further processes. The DISPLAY and DESKTOP_STARTUP_ID environment variables are also set, based on information provided in launch_context.

appinfo a T
files a GList of Gtk.Gio.GFile.T objects. [element-type GFile]
launch_context a Gtk.Gio.GAppLaunchContext.T or NULL. [allow-none]
error a Gtk.Glib.GError.T
Returns TRUE on successful launch, FALSE otherwise.


:Launch(_ @ ParentT, _ @ Std.Object.T, _ @ Gtk.Gio.GAppLaunchContext.T, _ @ Std.Object.T)

:LaunchUris(self @ T, uris @ Std.Object.T, launch_context @ Gtk.Gio.GAppLaunchContext.T, error @ Std.Object.T) : Std.Symbol.T

Launches the application. This passes the uris to the launched application as arguments, using the optional launch_context to get information about the details of the launcher (like what screen it is on). On error, error will be set accordingly.

To launch the application without arguments pass a NULL uris list.

Note that even if the launch is successful the application launched can fail to start if it runs into problems during startup. There is no way to detect this.

appinfo a T
uris a GList containing URIs to launch. [element-type utf8]
launch_context a Gtk.Gio.GAppLaunchContext.T or NULL. [allow-none]
error a Gtk.Glib.GError.T
Returns TRUE on successful launch, FALSE otherwise.


:LaunchUris(_ @ ParentT, _ @ Std.Object.T, _ @ Gtk.Gio.GAppLaunchContext.T, _ @ Std.Object.T)

:RemoveSupportsType(self @ T, content_type @ Std.String.T, error @ Std.Object.T) : Std.Symbol.T

Removes a supported type from an application, if possible.

appinfo a T.
content_type a string.
error a Gtk.Glib.GError.T.
Returns TRUE on success, FALSE on error.


:RemoveSupportsType(_ @ ParentT, _ @ Std.String.T, _ @ Std.Object.T)

:SetAsDefaultForExtension(self @ T, extension @ Std.String.T, error @ Std.Object.T) : Std.Symbol.T

Sets the application as the default handler for the given file extension.

appinfo a T.
extension a string containing the file extension (without the dot).
error a Gtk.Glib.GError.T.
Returns TRUE on success, FALSE on error.


:SetAsDefaultForExtension(_ @ ParentT, _ @ Std.String.T, _ @ Std.Object.T)

:SetAsDefaultForType(self @ T, content_type @ Std.String.T, error @ Std.Object.T) : Std.Symbol.T

Sets the application as the default handler for a given type.

appinfo a T.
content_type the content type.
error a Gtk.Glib.GError.T.
Returns TRUE on success, FALSE on error.


:SetAsDefaultForType(_ @ ParentT, _ @ Std.String.T, _ @ Std.Object.T)

:ShouldShow(self @ T) : Std.Symbol.T

Checks if the application info should be shown in menus that list available applications.

appinfo a T.
Returns TRUE if the appinfo should be shown, FALSE otherwise.


:ShouldShow(_ @ ParentT)

:SupportsFiles(self @ T) : Std.Symbol.T

Checks if the application accepts files as arguments.

appinfo a T.
Returns TRUE if the appinfo supports files.


:SupportsFiles(_ @ ParentT)

:SupportsUris(self @ T) : Std.Symbol.T

Checks if the application supports reading files and directories from URIs.

appinfo a T.
Returns TRUE if the appinfo supports URIs.


:SupportsUris(_ @ ParentT)