GAppInfo: GAppInfo

Description Methods and Functions Hierarchy Implementations Detailed Description Structures Convenient Construction Enums and Flags Author(s) References

Description

Application information and launch contexts

Methods and Functions

gAppInfoCreateFromCommandline(commandline, application.name = NULL, flags = "G_APP_INFO_CREATE_NONE", .errwarn = TRUE)
gAppInfoDup(object)
gAppInfoEqual(object, appinfo2)
gAppInfoGetId(object)
gAppInfoGetName(object)
gAppInfoGetDescription(object)
gAppInfoGetExecutable(object)
gAppInfoGetCommandline(object)
gAppInfoGetIcon(object)
gAppInfoLaunch(object, files, launch.context, .errwarn = TRUE)
gAppInfoSupportsFiles(object)
gAppInfoSupportsUris(object)
gAppInfoLaunchUris(object, uris, launch.context, .errwarn = TRUE)
gAppInfoShouldShow(object)
gAppInfoCanDelete(object)
gAppInfoDelete(object)
gAppInfoResetTypeAssociations(content.type)
gAppInfoSetAsDefaultForType(object, content.type, .errwarn = TRUE)
gAppInfoSetAsDefaultForExtension(object, extension, .errwarn = TRUE)
gAppInfoAddSupportsType(object, content.type, .errwarn = TRUE)
gAppInfoCanRemoveSupportsType(object)
gAppInfoRemoveSupportsType(object, content.type, .errwarn = TRUE)
gAppInfoGetAll()
gAppInfoGetAllForType(content.type)
gAppInfoGetDefaultForType(content.type, must.support.uris)
gAppInfoGetDefaultForUriScheme(uri.scheme)
gAppInfoLaunchDefaultForUri(uri, launch.context, .errwarn = TRUE)
gAppLaunchContextGetDisplay(object, info, files)
gAppLaunchContextGetStartupNotifyId(object, info, files)
gAppLaunchContextLaunchFailed(object, startup.notify.id)
gAppLaunchContextNew()
gAppLaunchContext()

Hierarchy

1
2
3
4
5
6
GFlags
   +----GAppInfoCreateFlags
GInterface
   +----GAppInfo
GObject
   +----GAppLaunchContext

Implementations

GAppInfo is implemented by GDesktopAppInfo.

Detailed Description

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 gFileGetPath) when using gAppInfoLaunch 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 GFile constructors (since gvfs implements the GVfs extension point). As such, if the application needs to examine the URI, it needs to use gFileGetUri or similar on GFile. In other words, an application cannot assume that the URI passed to e.g. gFileNewForCommandlineArg is equal to the result of gFileGetUri. The following snippet illustrates this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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.

Structures

GAppInfo

Information about an installed application and methods to launch it (with file arguments).

GAppLaunchContext

Integrating the launch with the launching application. This is used to handle for instance startup notification and launching the new application on the same screen as the launching window.

Convenient Construction

gAppLaunchContext is the equivalent of gAppLaunchContextNew.

Enums and Flags

GAppInfoCreateFlags

Flags used when creating a GAppInfo.

one

No flags.

eeds-terminal

Application opens in a terminal window.

Author(s)

Derived by RGtkGen from GTK+ documentation

References

https://developer.gnome.org/gio/stable/GAppInfo.html


RGtk2 documentation built on Oct. 14, 2021, 5:08 p.m.

Related to GAppInfo in RGtk2...