Description
gio.AppInfo
and gio.AppLaunchContext
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
gio.File.get_path
()) when using
gio.AppInfo.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
gio.File
constructors
(since gvfs implements the GVfs extension point). As such, if the application needs to examine the URI,
it needs to use
gio.File.get_uri
()
or similar on
gio.File
.
In other words, an application cannot assume that the URI passed to e.g.
gio.File
() constructor
is equal to the result of
gio.File.get_uri
().
Methods
gio.AppInfo.add_supports_type
def add_supports_type(content_type
)
The add_supports_type
() method adds a content type
to the application information to indicate the application is capable of
opening files with the given content type.
gio.AppInfo.can_delete
def can_delete()
Returns : | True if appinfo can be deleted.
|
The can_delete
() method obtains the information
whether the gio.AppInfo
can be deleted. See
gio.AppInfo.delete
().
gio.AppInfo.can_remove_supports_type
def can_remove_supports_type()
Returns : | True if it is possible to remove
supported content types from a given appinfo, False
if not. |
The can_remove_supports_type
() method checks if a
supported content type can be removed from an application.
gio.AppInfo.delete
def delete()
Returns : | True if appinfo has been deleted.
|
The delete
() method tries to delete an
gio.AppInfo
.
On some platforms, there may be a difference between user-defined
gio.AppInfo
s
which can be deleted, and system-wide ones which cannot. See
gio.AppInfo.can_delete
().
gio.AppInfo.dup
def dup()
Returns : | A duplicate of appinfo. |
The dup
() method creates a duplicate of a
gio.AppInfo
.
gio.AppInfo.equal
def equal(icon2
)
appinfo2 :
| the second
gio.AppInfo
|
Returns : | True if appinfo1 is equal to appinfo2.
False otherwise. |
The equal
() method checks if two
gio.AppInfo
s are equal.
gio.AppInfo.get_commandline
def get_commandline()
Returns : | a string containing the appinfo's commandline, or
None if this information is not available.
|
The get_commandline
() method gets the
commandline with which the application will be started.
gio.AppInfo.get_description
def get_description()
Returns : | A string containing a description of the application
appinfo, or None if none. |
The get_description
() method gets a human-readable
description of an installed application.
gio.AppInfo.get_executable
def get_executable()
Returns : | a string containing the appinfo's application
binary's name.
|
The get_description
() method gets the executable's
name for the installed application.
gio.AppInfo.get_icon
def get_icon()
Returns : | the default
gio.Icon for appinfo.
|
The get_icon
() method gets the icon for the application.
gio.AppInfo.get_id
def get_id()
Returns : | a string containing the application's ID.
|
The get_id
() method 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 None
, depending on
how the appinfo has been constructed.
gio.AppInfo.get_name
def get_name()
Returns : | the name of the application for appinfo.
|
The get_name
() method gets the installed
name of the application.
gio.AppInfo.launch
def launch(files
, launch_context
)
The launch
() method 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 lauch the application without arguments pass a None
for 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
gio.File
(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
gio.File.launch_uris
()
instead.
gio.AppInfo.launch_uris
def launch_uris(uris
, launch_context
)
uris :
| a list containing URIs to launch.
|
launch_context :
| a gio.AppLaunchContext
or None . |
Returns : | True on successful launch,
False otherwise.
|
The launch_uris
() method launches the application.
Passes 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 lauch the application without arguments pass a None
for 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.
gio.AppInfo.remove_supports_type
def remove_supports_type(content_type
)
The remove_supports_type
() method removes a
supported type from an application, if possible.
gio.AppInfo.set_as_default_for_extension
def set_as_default_for_extension(extension
)
extension :
| A string containing the file extension (without the dot).
|
The set_as_default_for_extension
() method sets the
application as the default handler for the given file extention.
gio.AppInfo.set_as_default_for_type
def set_as_default_for_type(content_type
)
content_type :
| The content type.
|
The set_as_default_for_type
() method sets the
application as the default handler for a given type.
gio.AppInfo.should_show
def should_show()
Returns : | True if the appinfo should be shown,
False otherwise.
|
The should_show
() method checks if the application
info should be shown in menus that list available applications.
gio.AppInfo.supports_files
def supports_files()
Returns : | True if the appinfo supports files.
|
The supports_files
() method checks if the application
accepts files as arguments.
gio.AppInfo.supports_uris
def supports_uris()
Returns : | True if the appinfo supports uris.
|
The supports_uris
() method checks if the application
accepts uris as arguments.
Functions
gio.app_info_get_all
def app_info_get_all()
The app_info_get_all
() function 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
gio.AppInfo.should_show
().
The returned list does not include applications which have the Hidden key set.
gio.app_info_get_all_for_type
def app_info_get_all_for_type(content_type
)
content_type :
| the content type to find a
gio.AppInfo
for. |
Returns : | A list of gio.AppInfo s
for a given content type or None on error.
|
The app_info_get_all_for_type
() function gets a list of all
gio.AppInfo
s
for a given content type.
gio.app_info_get_default_for_type
def app_info_get_default_for_type(content_type
, must_support_uris
)
content_type :
| the content type to find a
gio.AppInfo
for. |
must_support_uris :
| if True , the
gio.AppInfo
is expected to support URIs |
Returns : | gio.AppInfo
for given content_type or None on error.
|
The app_info_get_default_for_type
() function gets the
gio.AppInfo
that correspond to a given content type.
gio.app_info_get_default_for_uri_scheme
def app_info_get_default_for_uri_scheme(uri_scheme
)
uri_scheme :
| a string containing a URI scheme. |
Returns : | gio.AppInfo
for given uri_scheme or None on error.
|
The app_info_get_default_for_uri_scheme
() function 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".