Application information, to describe applications installed on the system, and launch them. More...
Inherits Glib::Interface.
Inherited by Gio::DesktopAppInfo.
Public Member Functions | |
virtual | ~AppInfo () |
GAppInfo* | gobj () |
Provides access to the underlying C GObject. | |
const GAppInfo* | gobj () const |
Provides access to the underlying C GObject. | |
bool | equal (const Glib::RefPtr< AppInfo >& other) const |
Checks if two AppInfos are equal. | |
std::string | get_id () const |
Gets the ID of an application. | |
std::string | get_name () const |
Gets the installed name of the application. | |
std::string | get_description () const |
Gets a human-readable description of an installed application. | |
std::string | get_executable () const |
Gets the executable's name for the installed application. | |
std::string | get_commandline () const |
Gets the commandline with which the application will be started. | |
Glib::RefPtr< Icon > | get_icon () |
Gets the icon for the application. | |
const Glib::RefPtr< const Icon > | get_icon () const |
Gets the icon for the application. | |
bool | launch (const Glib::ListHandle< std::string >& files, const Glib::RefPtr< AppLaunchContext >& launch_context) |
Launches the application. | |
bool | supports_uris () const |
Checks if the application supports reading files and directories from URIs. | |
bool | supports_files () const |
Checks if the application accepts files as arguments. | |
bool | launch_uris (const Glib::ListHandle< std::string >& uris, GAppLaunchContext* launch_context) |
Launches the application. | |
bool | should_show () const |
Checks if the application info should be shown in menus that list available applications. | |
bool | can_delete () const |
Obtains the information whether the GAppInfo can be deleted. | |
bool | do_delete () |
Tries to delete an AppInfo. | |
bool | set_as_default_for_type (const std::string& content_type) |
Sets the application as the default handler for a given type. | |
bool | set_as_default_for_extension (const std::string& extension) |
Sets the application as the default handler for the given file extention. | |
bool | add_supports_type (const std::string& content_type) |
Adds a content type to the application information to indicate the application is capable of opening files with the given content type. | |
bool | can_remove_supports_type () const |
Checks if a supported content type can be removed from an application. | |
bool | remove_supports_type (const std::string& content_type) |
Removes a supported type from an application, if possible. | |
Static Public Member Functions | |
static void | add_interface (GType gtype_implementer) |
static Glib::RefPtr< AppInfo > | create_from_commandline (const std::string& commandline, const std::string& application_name, AppInfoCreateFlags flags) |
static Glib::ListHandle < Glib::RefPtr< AppInfo > > | get_all () |
Gets a list of all of the applications currently registered on this system. | |
static Glib::ListHandle < Glib::RefPtr< AppInfo > > | get_all_for_type (const std::string& content_type) |
Gets a list of all AppInfo s for a given content type. | |
static Glib::RefPtr< AppInfo > | get_default_for_type (const std::string& content_type, bool must_support_uris=true) |
Gets the AppInfo that correspond to a given content type. | |
static Glib::RefPtr< AppInfo > | get_default_for_uri_scheme (const std::string& uri_scheme) |
Gets the default application for launching applications using this URI scheme. | |
static void | reset_type_associations (const std::string& content_type) |
Removes all changes to the type associations done by g_app_info_set_as_default_for_type(), g_app_info_set_as_default_for_extension(), g_app_info_add_supports_type() of g_app_info_remove_supports_type(). | |
static bool | launch_default_for_uri (const std::string& uri, const Glib::RefPtr< AppLaunchContext >& context) |
Utility function that launches the default application registered to handle the specified uri. | |
static bool | launch_default_for_uri (const std::string& uri) |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gio::AppInfo > | wrap (GAppInfo* object, bool take_copy=false) |
A Glib::wrap() method for this object. |
Application information, to describe applications installed on the system, and launch them.
See also AppLaunchContext.
virtual Gio::AppInfo::~AppInfo | ( | ) | [virtual] |
static void Gio::AppInfo::add_interface | ( | GType | gtype_implementer | ) | [static] |
bool Gio::AppInfo::add_supports_type | ( | const std::string & | content_type | ) |
Adds a content type to the application information to indicate the application is capable of opening files with the given content type.
content_type | A string. |
true
on success, false
on error. bool Gio::AppInfo::can_delete | ( | ) | const |
Obtains the information whether the GAppInfo can be deleted.
See g_app_info_delete().
true
if appinfo can be deletedbool Gio::AppInfo::can_remove_supports_type | ( | ) | const |
Checks if a supported content type can be removed from an application.
true
if it is possible to remove supported content types from a given appinfo, false
if not. static Glib::RefPtr<AppInfo> Gio::AppInfo::create_from_commandline | ( | const std::string & | commandline, | |
const std::string & | application_name, | |||
AppInfoCreateFlags | flags | |||
) | [static] |
bool Gio::AppInfo::do_delete | ( | ) |
Tries to delete an AppInfo.
On some platforms, there may be a difference between user-defined AppInfos which can be deleted, and system-wide ones which cannot. See g_app_info_can_delete().
true
if appinfo has been deletedbool Gio::AppInfo::equal | ( | const Glib::RefPtr< AppInfo >& | other | ) | const |
Checks if two AppInfos are equal.
appinfo2 | The second AppInfo. |
true
if appinfo1 is equal to appinfo2. false
otherwise. static Glib::ListHandle<Glib::RefPtr<AppInfo> > Gio::AppInfo::get_all | ( | ) | [static] |
Gets a list of all of the applications currently registered on this system.
For desktop files, this includes applications that have <literal>NoDisplay=true</literal> set or are excluded from display by means of <literal>OnlyShowIn</literal> or <literal>NotShowIn</literal>. See g_app_info_should_show(). The returned list does not include applications which have the <literal>Hidden</literal> key set.
static Glib::ListHandle<Glib::RefPtr<AppInfo> > Gio::AppInfo::get_all_for_type | ( | const std::string & | content_type | ) | [static] |
std::string Gio::AppInfo::get_commandline | ( | ) | const |
Gets the commandline with which the application will be started.
0
if this information is not availablestatic Glib::RefPtr<AppInfo> Gio::AppInfo::get_default_for_type | ( | const std::string & | content_type, | |
bool | must_support_uris = true | |||
) | [static] |
static Glib::RefPtr<AppInfo> Gio::AppInfo::get_default_for_uri_scheme | ( | const std::string & | uri_scheme | ) | [static] |
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. |
0
on error. std::string Gio::AppInfo::get_description | ( | ) | const |
Gets a human-readable description of an installed application.
0
if none. std::string Gio::AppInfo::get_executable | ( | ) | const |
Gets the executable's name for the installed application.
const Glib::RefPtr<const Icon> Gio::AppInfo::get_icon | ( | ) | const |
Gets the icon for the application.
Glib::RefPtr<Icon> Gio::AppInfo::get_icon | ( | ) |
Gets the icon for the application.
std::string Gio::AppInfo::get_id | ( | ) | const |
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 0
, depending on how the appinfo has been constructed.
std::string Gio::AppInfo::get_name | ( | ) | const |
Gets the installed name of the application.
const GAppInfo* Gio::AppInfo::gobj | ( | ) | const [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::Interface.
Reimplemented in Gio::DesktopAppInfo.
GAppInfo* Gio::AppInfo::gobj | ( | ) | [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::Interface.
Reimplemented in Gio::DesktopAppInfo.
bool Gio::AppInfo::launch | ( | const Glib::ListHandle< std::string >& | files, | |
const Glib::RefPtr< AppLaunchContext >& | launch_context | |||
) |
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 0
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 g_app_info_launch_uris() instead.
files | A List of File objects. | |
launch_context | A AppLaunchContext or 0 . |
true
on successful launch, false
otherwise. static bool Gio::AppInfo::launch_default_for_uri | ( | const std::string & | uri | ) | [static] |
static bool Gio::AppInfo::launch_default_for_uri | ( | const std::string & | uri, | |
const Glib::RefPtr< AppLaunchContext >& | context | |||
) | [static] |
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 AppLaunchContext. |
true
on success, false
on error. bool Gio::AppInfo::launch_uris | ( | const Glib::ListHandle< std::string >& | uris, | |
GAppLaunchContext * | launch_context | |||
) |
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 0
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.
uris | A List containing URIs to launch. | |
launch_context | A AppLaunchContext or 0 . |
true
on successful launch, false
otherwise. bool Gio::AppInfo::remove_supports_type | ( | const std::string & | content_type | ) |
Removes a supported type from an application, if possible.
content_type | A string. |
true
on success, false
on error. static void Gio::AppInfo::reset_type_associations | ( | const std::string & | content_type | ) | [static] |
Removes all changes to the type associations done by g_app_info_set_as_default_for_type(), g_app_info_set_as_default_for_extension(), g_app_info_add_supports_type() of g_app_info_remove_supports_type().
content_type | A content type. |
bool Gio::AppInfo::set_as_default_for_extension | ( | const std::string & | extension | ) |
Sets the application as the default handler for the given file extention.
extension | A string containing the file extension (without the dot). |
true
on success, false
on error. bool Gio::AppInfo::set_as_default_for_type | ( | const std::string & | content_type | ) |
Sets the application as the default handler for a given type.
content_type | The content type. |
true
on success, false
on error. bool Gio::AppInfo::should_show | ( | ) | const |
Checks if the application info should be shown in menus that list available applications.
true
if the appinfo should be shown, false
otherwise. bool Gio::AppInfo::supports_files | ( | ) | const |
Checks if the application accepts files as arguments.
true
if the appinfo supports files. bool Gio::AppInfo::supports_uris | ( | ) | const |
Checks if the application supports reading files and directories from URIs.
true
if the appinfo supports URIs. Glib::RefPtr< Gio::AppInfo > wrap | ( | GAppInfo * | object, | |
bool | take_copy = false | |||
) | [related] |
A Glib::wrap() method for this object.
object | The C instance. | |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |