DesktopAppInfo

gio.desktop_app_info.DesktopAppInfo is an implementation of gio.app_info.AppInfo based on desktop files.

Note that <gio/gdesktopappinfo.h> belongs to the UNIX-specific GIO interfaces, thus you have to use the gio-unix-2.0.pc pkg-config file or the GioUnix-2.0 GIR namespace when using it.

Constructors

this
this(string desktopId)

Creates a new #GDesktopAppInfo based on a desktop file id.

Members

Functions

getActionName
string getActionName(string actionName)

Gets the user-visible display name of the "additional application action" specified by action_name.

getBoolean
bool getBoolean(string key)

Looks up a boolean value in the keyfile backing info.

getCategories
string getCategories()

Gets the categories from the desktop file.

getFilename
string getFilename()

When info was created from a known filename, return it. In some situations such as the #GDesktopAppInfo returned from gio.desktop_app_info.DesktopAppInfo.newFromKeyfile, this function will return null.

getGenericName
string getGenericName()

Gets the generic name from the desktop file.

getIsHidden
bool getIsHidden()

A desktop file is hidden if the Hidden key in it is set to True.

getKeywords
string[] getKeywords()

Gets the keywords from the desktop file.

getLocaleString
string getLocaleString(string key)

Looks up a localized string value in the keyfile backing info translated to the current locale.

getNodisplay
bool getNodisplay()

Gets the value of the NoDisplay key, which helps determine if the application info should be shown in menus. See G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY and gio.app_info.AppInfo.shouldShow.

getShowIn
bool getShowIn(string desktopEnv)

Checks if the application info should be shown in menus that list available applications for a specific name of the desktop, based on the OnlyShowIn and NotShowIn keys.

getStartupWmClass
string getStartupWmClass()

Retrieves the StartupWMClass field from info. This represents the WM_CLASS property of the main window of the application, if launched through info.

getString
string getString(string key)

Looks up a string value in the keyfile backing info.

getStringList
string[] getStringList(string key)

Looks up a string list value in the keyfile backing info.

hasKey
bool hasKey(string key)

Returns whether key exists in the "Desktop Entry" group of the keyfile backing info.

launchAction
void launchAction(string actionName, gio.app_launch_context.AppLaunchContext launchContext)

Activates the named application action.

launchUrisAsManager
bool launchUrisAsManager(string[] uris, gio.app_launch_context.AppLaunchContext launchContext, glib.types.SpawnFlags spawnFlags, glib.types.SpawnChildSetupFunc userSetup, gio.types.DesktopAppLaunchCallback pidCallback)

This function performs the equivalent of gio.app_info.AppInfo.launchUris, but is intended primarily for operating system components that launch applications. Ordinary applications should use gio.app_info.AppInfo.launchUris.

launchUrisAsManagerWithFds
bool launchUrisAsManagerWithFds(string[] uris, gio.app_launch_context.AppLaunchContext launchContext, glib.types.SpawnFlags spawnFlags, glib.types.SpawnChildSetupFunc userSetup, gio.types.DesktopAppLaunchCallback pidCallback, int stdinFd, int stdoutFd, int stderrFd)

Equivalent to gio.desktop_app_info.DesktopAppInfo.launchUrisAsManager but allows you to pass in file descriptors for the stdin, stdout and stderr streams of the launched process.

listActions
string[] listActions()

Returns the list of "additional application actions" supported on the desktop file, as per the desktop file specification.

Static functions

getImplementations
gio.desktop_app_info.DesktopAppInfo[] getImplementations(string interface_)

Gets all applications that implement interface.

newFromFilename
gio.desktop_app_info.DesktopAppInfo newFromFilename(string filename)

Creates a new #GDesktopAppInfo.

newFromKeyfile
gio.desktop_app_info.DesktopAppInfo newFromKeyfile(glib.key_file.KeyFile keyFile)

Creates a new #GDesktopAppInfo.

setDesktopEnv
void setDesktopEnv(string desktopEnv)

Sets the name of the desktop that the application is running in. This is used by gio.app_info.AppInfo.shouldShow and gio.desktop_app_info.DesktopAppInfo.getShowIn to evaluate the OnlyShowIn and NotShowIn desktop entry fields.

Mixed In Members

From mixin AppInfoT!()

addSupportsType
bool addSupportsType(string contentType)

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

canDelete
bool canDelete()

Obtains the information whether the #GAppInfo can be deleted. See gio.app_info.AppInfo.delete_.

canRemoveSupportsType
bool canRemoveSupportsType()

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

delete_
bool delete_()

Tries to delete a #GAppInfo.

dup
gio.app_info.AppInfo dup()

Creates a duplicate of a #GAppInfo.

equal
bool equal(gio.app_info.AppInfo appinfo2)

Checks if two #GAppInfos are equal.

getCommandline
string getCommandline()

Gets the commandline with which the application will be started.

getDescription
string getDescription()

Gets a human-readable description of an installed application.

getDisplayName
string getDisplayName()

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

getExecutable
string getExecutable()

Gets the executable's name for the installed application.

getIcon
gio.icon.Icon getIcon()

Gets the icon for the application.

getId
string getId()

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.

getName
string getName()

Gets the installed name of the application.

getSupportedTypes
string[] getSupportedTypes()

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 null. This function does not take in consideration associations added with gio.app_info.AppInfo.addSupportsType, but only those exported directly by the application.

launch
bool launch(gio.file.File[] files, gio.app_launch_context.AppLaunchContext context)

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

launchUris
bool launchUris(string[] uris, gio.app_launch_context.AppLaunchContext context)

Launches the application. This passes the uris to the launched application as arguments, using the optional context to get information about the details of the launcher (like what screen it is on). On error, error will be set accordingly. If the application only supports one URI per invocation as part of their command-line, multiple instances of the application will be spawned.

launchUrisAsync
void launchUrisAsync(string[] uris, gio.app_launch_context.AppLaunchContext context, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Async version of gio.app_info.AppInfo.launchUris.

launchUrisFinish
bool launchUrisFinish(gio.async_result.AsyncResult result)

Finishes a gio.app_info.AppInfo.launchUrisAsync operation.

removeSupportsType
bool removeSupportsType(string contentType)

Removes a supported type from an application, if possible.

setAsDefaultForExtension
bool setAsDefaultForExtension(string extension)

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

setAsDefaultForType
bool setAsDefaultForType(string contentType)

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

setAsLastUsedForType
bool setAsLastUsedForType(string contentType)

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 gio.app_info.AppInfo.getRecommendedForType, regardless of the default application for that content type.

shouldShow
bool shouldShow()

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

supportsFiles
bool supportsFiles()

Checks if the application accepts files as arguments.

supportsUris
bool supportsUris()

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

Inherited Members

From ObjectG

setGObject
void setGObject(void* cObj, Flag!"Take" take)

Set the GObject of a D ObjectG wrapper.

cPtr
void* cPtr(Flag!"Dup" dup)

Get a pointer to the underlying C object.

ref_
void* ref_(void* gObj)

Calls g_object_ref() on a GObject.

unref
unref(void* gObj)

Calls g_object_unref() on a GObject.

getType
GType getType()

Get the GType of an object.

gType
GType gType [@property getter]

GObject GType property.

self
ObjectG self()

Convenience method to return this cast to a type. For use in D with statements.

getDObject
T getDObject(void* cptr, Flag!"Take" take)

Template to get the D object from a C GObject and cast it to the given D object type.

connectSignalClosure
ulong connectSignalClosure(string signalDetail, DClosure closure, Flag!"After" after)

Connect a D closure to an object signal.

setProperty
void setProperty(string propertyName, T val)

Template for setting a GObject property.

getProperty
T getProperty(string propertyName)

Template for getting a GObject property.

compatControl
size_t compatControl(size_t what, void* data)
bindProperty
gobject.binding.Binding bindProperty(string sourceProperty, gobject.object.ObjectG target, string targetProperty, gobject.types.BindingFlags flags)

Creates a binding between source_property on source and target_property on target.

bindPropertyFull
gobject.binding.Binding bindPropertyFull(string sourceProperty, gobject.object.ObjectG target, string targetProperty, gobject.types.BindingFlags flags, gobject.closure.Closure transformTo, gobject.closure.Closure transformFrom)

Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

forceFloating
void forceFloating()

This function is intended for #GObject implementations to re-enforce a floating[floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling gobject.object.ObjectG.refSink.

freezeNotify
void freezeNotify()

Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one #GObject::notify signal is emitted for each property modified while the object is frozen.

getData
void* getData(string key)

Gets a named field from the objects table of associations (see gobject.object.ObjectG.setData).

getProperty
void getProperty(string propertyName, gobject.value.Value value)

Gets a property of an object.

getQdata
void* getQdata(glib.types.Quark quark)

This function gets back user data pointers stored via gobject.object.ObjectG.setQdata.

getv
void getv(string[] names, gobject.value.Value[] values)

Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

isFloating
bool isFloating()

Checks whether object has a floating[floating-ref] reference.

notify
void notify(string propertyName)

Emits a "notify" signal for the property property_name on object.

notifyByPspec
void notifyByPspec(gobject.param_spec.ParamSpec pspec)

Emits a "notify" signal for the property specified by pspec on object.

refSink
gobject.object.ObjectG refSink()

Increase the reference count of object, and possibly remove the floating[floating-ref] reference, if object has a floating reference.

runDispose
void runDispose()

Releases all references to other objects. This can be used to break reference cycles.

setData
void setData(string key, void* data)

Each object carries around a table of associations from strings to pointers. This function lets you set an association.

setProperty
void setProperty(string propertyName, gobject.value.Value value)

Sets a property on an object.

stealData
void* stealData(string key)

Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

stealQdata
void* stealQdata(glib.types.Quark quark)

This function gets back user data pointers stored via gobject.object.ObjectG.setQdata and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

thawNotify
void thawNotify()

Reverts the effect of a previous call to gobject.object.ObjectG.freezeNotify. The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

watchClosure
void watchClosure(gobject.closure.Closure closure)

This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling gobject.closure.Closure.invalidate on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, gobject.object.ObjectG.ref_ and gobject.object.ObjectG.unref are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

connectNotify
ulong connectNotify(string detail, T callback, Flag!"After" after)

Connect to Notify signal.

From AppInfo

createFromCommandline
gio.app_info.AppInfo createFromCommandline(string commandline, string applicationName, gio.types.AppInfoCreateFlags flags)

Creates a new #GAppInfo from the given information.

getAll
gio.app_info.AppInfo[] getAll()

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

getAllForType
gio.app_info.AppInfo[] getAllForType(string contentType)

Gets a list of all #GAppInfos for a given content type, including the recommended and fallback #GAppInfos. See gio.app_info.AppInfo.getRecommendedForType and gio.app_info.AppInfo.getFallbackForType.

getDefaultForType
gio.app_info.AppInfo getDefaultForType(string contentType, bool mustSupportUris)

Gets the default #GAppInfo for a given content type.

getDefaultForTypeAsync
void getDefaultForTypeAsync(string contentType, bool mustSupportUris, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Asynchronously gets the default #GAppInfo for a given content type.

getDefaultForTypeFinish
gio.app_info.AppInfo getDefaultForTypeFinish(gio.async_result.AsyncResult result)

Finishes a default #GAppInfo lookup started by gio.app_info.AppInfo.getDefaultForTypeAsync.

getDefaultForUriScheme
gio.app_info.AppInfo getDefaultForUriScheme(string uriScheme)

Gets the default application for handling URIs with the given URI scheme. A URI scheme is the initial part of the URI, up to but not including the ':', e.g. "http", "ftp" or "sip".

getDefaultForUriSchemeAsync
void getDefaultForUriSchemeAsync(string uriScheme, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Asynchronously gets the default application for handling URIs with the given URI scheme. A URI scheme is the initial part of the URI, up to but not including the ':', e.g. "http", "ftp" or "sip".

getDefaultForUriSchemeFinish
gio.app_info.AppInfo getDefaultForUriSchemeFinish(gio.async_result.AsyncResult result)

Finishes a default #GAppInfo lookup started by gio.app_info.AppInfo.getDefaultForUriSchemeAsync.

getFallbackForType
gio.app_info.AppInfo[] getFallbackForType(string contentType)

Gets a list of fallback #GAppInfos for a given content type, i.e. those applications which claim to support the given content type by MIME type subclassing and not directly.

getRecommendedForType
gio.app_info.AppInfo[] getRecommendedForType(string contentType)

Gets a list of recommended #GAppInfos for a given content type, i.e. those applications which claim to support the given content type exactly, and not by MIME type subclassing. Note that the first application of the list is the last used one, i.e. the last one for which gio.app_info.AppInfo.setAsLastUsedForType has been called.

launchDefaultForUri
bool launchDefaultForUri(string uri, gio.app_launch_context.AppLaunchContext context)

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.

launchDefaultForUriAsync
void launchDefaultForUriAsync(string uri, gio.app_launch_context.AppLaunchContext context, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Async version of gio.app_info.AppInfo.launchDefaultForUri.

launchDefaultForUriFinish
bool launchDefaultForUriFinish(gio.async_result.AsyncResult result)

Finishes an asynchronous launch-default-for-uri operation.

resetTypeAssociations
void resetTypeAssociations(string contentType)

Removes all changes to the type associations done by gio.app_info.AppInfo.setAsDefaultForType, gio.app_info.AppInfo.setAsDefaultForExtension, gio.app_info.AppInfo.addSupportsType or gio.app_info.AppInfo.removeSupportsType.

addSupportsType
bool addSupportsType(string contentType)

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

canDelete
bool canDelete()

Obtains the information whether the #GAppInfo can be deleted. See gio.app_info.AppInfo.delete_.

canRemoveSupportsType
bool canRemoveSupportsType()

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

delete_
bool delete_()

Tries to delete a #GAppInfo.

dup
gio.app_info.AppInfo dup()

Creates a duplicate of a #GAppInfo.

equal
bool equal(gio.app_info.AppInfo appinfo2)

Checks if two #GAppInfos are equal.

getCommandline
string getCommandline()

Gets the commandline with which the application will be started.

getDescription
string getDescription()

Gets a human-readable description of an installed application.

getDisplayName
string getDisplayName()

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

getExecutable
string getExecutable()

Gets the executable's name for the installed application.

getIcon
gio.icon.Icon getIcon()

Gets the icon for the application.

getId
string getId()

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.

getName
string getName()

Gets the installed name of the application.

getSupportedTypes
string[] getSupportedTypes()

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 null. This function does not take in consideration associations added with gio.app_info.AppInfo.addSupportsType, but only those exported directly by the application.

launch
bool launch(gio.file.File[] files, gio.app_launch_context.AppLaunchContext context)

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

launchUris
bool launchUris(string[] uris, gio.app_launch_context.AppLaunchContext context)

Launches the application. This passes the uris to the launched application as arguments, using the optional context to get information about the details of the launcher (like what screen it is on). On error, error will be set accordingly. If the application only supports one URI per invocation as part of their command-line, multiple instances of the application will be spawned.

launchUrisAsync
void launchUrisAsync(string[] uris, gio.app_launch_context.AppLaunchContext context, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Async version of gio.app_info.AppInfo.launchUris.

launchUrisFinish
bool launchUrisFinish(gio.async_result.AsyncResult result)

Finishes a gio.app_info.AppInfo.launchUrisAsync operation.

removeSupportsType
bool removeSupportsType(string contentType)

Removes a supported type from an application, if possible.

setAsDefaultForExtension
bool setAsDefaultForExtension(string extension)

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

setAsDefaultForType
bool setAsDefaultForType(string contentType)

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

setAsLastUsedForType
bool setAsLastUsedForType(string contentType)

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 gio.app_info.AppInfo.getRecommendedForType, regardless of the default application for that content type.

shouldShow
bool shouldShow()

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

supportsFiles
bool supportsFiles()

Checks if the application accepts files as arguments.

supportsUris
bool supportsUris()

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