Module: Gio::AppInfo
- Defined in:
- (unknown)
Overview
Information about an installed application and methods to launch it (with file arguments).
GAppInfo and GAppLaunchContext 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 [methodGio.File.get_path]) when using [methodGio.AppInfo.launch]
even if the application requested an URI and not a POSIX path. For example
for a 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 [ifaceGio.File] constructors (since GVfs implements the GVfs extension point). As such, if the application needs to examine the URI, it needs to use [methodGio.File.get_uri] or similar on [ifaceGio.File]. In other words, an application cannot assume that the URI passed to e.g. [funcGio.File.new_for_commandline_arg] is equal to the result of [methodGio.File.get_uri]. 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;
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.
Instance Method Summary collapse
-
#add_supports_type(appinfo, content_type) ⇒ Boolean
True on success, false on error.
-
#as_default_for_extension=(extension) ⇒ Boolean
Sets the application as the default handler for the given file extension.
-
#as_default_for_type=(content_type) ⇒ Boolean
Sets the application as the default handler for a given type.
-
#as_last_used_for_type=(content_type) ⇒ Boolean
Sets the application as the last used application for a given type.
-
#can_delete(appinfo) ⇒ Boolean
True if appinfo can be deleted.
-
#can_remove_supports_type(appinfo) ⇒ Boolean
True if it is possible to remove supported content types from a given appinfo, false if not.
-
#commandline ⇒ Gio::filename
Gets the commandline with which the application will be started.
-
#delete ⇒ Boolean
Tries to delete a GApp::Info.
-
#description ⇒ String
Gets a human-readable description of an installed application.
-
#display_name ⇒ String
Gets the display name of the application.
-
#do_delete(appinfo) ⇒ Boolean
True if appinfo has been deleted.
-
#dup(appinfo) ⇒ Gio::AppInfo
A duplicate of appinfo.
-
#equal(appinfo1, appinfo2) ⇒ Boolean
True if appinfo1 is equal to appinfo2.
-
#executable ⇒ Gio::filename
Gets the executable's name for the installed application.
-
#get_commandline(appinfo) ⇒ Gio::filename
A string containing the appinfo's commandline, or nil if this information is not available.
-
#get_description(appinfo) ⇒ String
application appinfo, or nil if none.
-
#get_display_name(appinfo) ⇒ String
no display name is available.
-
#get_executable(appinfo) ⇒ Gio::filename
binaries name.
-
#get_icon(appinfo) ⇒ Gio::Icon
if there is no default icon.
-
#get_id(appinfo) ⇒ String
A string containing the application's ID.
-
#get_name(appinfo) ⇒ String
The name of the application for appinfo.
-
#get_supported_types(appinfo) ⇒ Array<String>
A list of content types.
-
#icon ⇒ Gio::Icon
Gets the icon for the application.
-
#id ⇒ String
Gets the ID of an application.
-
#launch(appinfo, files, context) ⇒ Boolean
True on successful launch, false otherwise.
-
#launch_uris(appinfo, uris, context) ⇒ Boolean
True on successful launch, false otherwise.
- #launch_uris_async(appinfo, uris, context, cancellable, callback, user_data) ⇒ nil
-
#launch_uris_finish(appinfo, result) ⇒ Boolean
True on successful launch, false otherwise.
-
#name ⇒ String
Gets the installed name of the application.
-
#remove_supports_type(appinfo, content_type) ⇒ Boolean
True on success, false on error.
-
#set_as_default_for_extension(appinfo, extension) ⇒ Boolean
True on success, false on error.
-
#set_as_default_for_type(appinfo, content_type) ⇒ Boolean
True on success, false on error.
-
#set_as_last_used_for_type(appinfo, content_type) ⇒ Boolean
True on success, false on error.
-
#should_show(appinfo) ⇒ Boolean
True if the appinfo should be shown, false otherwise.
-
#supported_types ⇒ Array<String>
Retrieves the list of content types that app_info claims to support.
-
#supports_files(appinfo) ⇒ Boolean
True if the appinfo supports files.
-
#supports_uris(appinfo) ⇒ Boolean
True if the appinfo supports URIs.
Instance Method Details
#add_supports_type(appinfo, content_type) ⇒ Boolean
Returns true on success, false on error.
#as_default_for_extension=(extension) ⇒ Boolean
Sets the application as the default handler for the given file extension.
#as_default_for_type=(content_type) ⇒ Boolean
Sets the application as the default handler for a given type.
#as_last_used_for_type=(content_type) ⇒ Boolean
Sets the application as the last used application for a given type. This will make the application appear as first in the list returned by g_app_info_get_recommended_for_type(), regardless of the default application for that content type.
#can_delete(appinfo) ⇒ Boolean
Returns true if appinfo can be deleted.
#can_remove_supports_type(appinfo) ⇒ Boolean
Returns true if it is possible to remove supported content types from a given appinfo, false if not.
#commandline ⇒ Gio::filename
Gets the commandline with which the application will be started.
#delete ⇒ Boolean
Tries to delete a GApp::Info.
On some platforms, there may be a difference between user-defined GApp::Infos which can be deleted, and system-wide ones which cannot. See g_app_info_can_delete().
#description ⇒ String
Gets a human-readable description of an installed application. application appinfo, or nil if none.
#display_name ⇒ String
Gets the display name of the application. The display name is often more descriptive to the user than the name itself. no display name is available.
#do_delete(appinfo) ⇒ Boolean
Returns true if appinfo has been deleted.
#dup(appinfo) ⇒ Gio::AppInfo
Returns a duplicate of appinfo.
#equal(appinfo1, appinfo2) ⇒ Boolean
Returns true if appinfo1 is equal to appinfo2. false otherwise.
#executable ⇒ Gio::filename
Gets the executable's name for the installed application.
This is intended to be used for debugging or labelling what program is going to be run. To launch the executable, use g_app_info_launch() and related functions, rather than spawning the return value from this function. binaries name
#get_commandline(appinfo) ⇒ Gio::filename
Returns a string containing the appinfo's commandline, or nil if this information is not available.
#get_description(appinfo) ⇒ String
application appinfo, or nil if none.
#get_display_name(appinfo) ⇒ String
no display name is available.
#get_executable(appinfo) ⇒ Gio::filename
binaries name
#get_icon(appinfo) ⇒ Gio::Icon
if there is no default icon.
#get_id(appinfo) ⇒ String
Returns a string containing the application's ID.
#get_name(appinfo) ⇒ String
Returns the name of the application for appinfo.
#get_supported_types(appinfo) ⇒ Array<String>
Returns a list of content types.
#icon ⇒ Gio::Icon
Gets the icon for the application. if there is no default icon.
#id ⇒ String
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 nil, depending on how the appinfo has been constructed.
#launch(appinfo, files, context) ⇒ Boolean
Returns true on successful launch, false otherwise.
#launch_uris(appinfo, uris, context) ⇒ Boolean
Returns true on successful launch, false otherwise.
#launch_uris_async(appinfo, uris, context, cancellable, callback, user_data) ⇒ nil
#launch_uris_finish(appinfo, result) ⇒ Boolean
Returns true on successful launch, false otherwise.
#name ⇒ String
Gets the installed name of the application.
#remove_supports_type(appinfo, content_type) ⇒ Boolean
Returns true on success, false on error.
#set_as_default_for_extension(appinfo, extension) ⇒ Boolean
Returns true on success, false on error.
#set_as_default_for_type(appinfo, content_type) ⇒ Boolean
Returns true on success, false on error.
#set_as_last_used_for_type(appinfo, content_type) ⇒ Boolean
Returns true on success, false on error.
#should_show(appinfo) ⇒ Boolean
Returns true if the appinfo should be shown, false otherwise.
#supported_types ⇒ Array<String>
Retrieves the list of content types that app_info claims to support. If this information is not provided by the environment, this function will return nil. This function does not take in consideration associations added with g_app_info_add_supports_type(), but only those exported directly by the application.
#supports_files(appinfo) ⇒ Boolean
Returns true if the appinfo supports files.
#supports_uris(appinfo) ⇒ Boolean
Returns true if the appinfo supports URIs.