GIO Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces |
#include <gio/gdesktopappinfo.h> GDesktopAppInfo; GDesktopAppInfo * g_desktop_app_info_new_from_filename (const char *filename
); GDesktopAppInfo * g_desktop_app_info_new_from_keyfile (GKeyFile *key_file
); GDesktopAppInfo * g_desktop_app_info_new (const char *desktop_id
); const char * g_desktop_app_info_get_filename (GDesktopAppInfo *info
); gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info
); void g_desktop_app_info_set_desktop_env (const char *desktop_env
);
GDesktopAppInfo is an implementation of GAppInfo 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 when using it.
typedef struct _GDesktopAppInfo GDesktopAppInfo;
Information about an installed application from a desktop file.
GDesktopAppInfo * g_desktop_app_info_new_from_filename
(const char *filename
);
Creates a new GDesktopAppInfo.
|
the path of a desktop file, in the GLib filename encoding |
Returns : |
a new GDesktopAppInfo or NULL on error. |
GDesktopAppInfo * g_desktop_app_info_new_from_keyfile (GKeyFile *key_file
);
Creates a new GDesktopAppInfo.
|
an opened GKeyFile |
Returns : |
a new GDesktopAppInfo or NULL on error. |
Since 2.18
GDesktopAppInfo * g_desktop_app_info_new (const char *desktop_id
);
Creates a new GDesktopAppInfo based on a desktop file id.
A desktop file id is the basename of the desktop file, including the
.desktop extension. GIO is looking for a desktop file with this name
in the applications
subdirectories of the XDG data
directories (i.e. the directories specified in the
XDG_DATA_HOME
and XDG_DATA_DIRS
environment
variables). GIO also supports the prefix-to-subdirectory mapping that is
described in the Menu Spec
(i.e. a desktop id of kde-foo.desktop will match
/usr/share/applications/kde/foo.desktop
).
|
the desktop file id |
Returns : |
a new GDesktopAppInfo, or NULL if no desktop file with that id |
const char * g_desktop_app_info_get_filename (GDesktopAppInfo *info
);
When info
was created from a known filename, return it. In some
situations such as the GDesktopAppInfo returned from
g_desktop_app_info_new_from_keyfile()
, this function will return NULL
.
|
a GDesktopAppInfo |
Returns : |
The full path to the file for info , or NULL if not known. |
Since 2.24
gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info
);
A desktop file is hidden if the Hidden key in it is set to True.
|
a GDesktopAppInfo. |
Returns : |
TRUE if hidden, FALSE otherwise. |
void g_desktop_app_info_set_desktop_env (const char *desktop_env
);
Sets the name of the desktop that the application is running in.
This is used by g_app_info_should_show()
to evaluate the
OnlyShowIn
and NotShowIn
desktop entry fields.
The Desktop Menu specification recognizes the following:
GNOME |
KDE |
ROX |
XFCE |
Old |
Should be called only once; subsequent calls are ignored.
|
a string specifying what desktop this is |