Top | ![]() |
![]() |
![]() |
![]() |
GDesktopAppInfo * | g_desktop_app_info_new_from_filename () |
GDesktopAppInfo * | g_desktop_app_info_new_from_keyfile () |
GDesktopAppInfo * | g_desktop_app_info_new () |
const char * | g_desktop_app_info_get_filename () |
gboolean | g_desktop_app_info_get_is_hidden () |
gboolean | g_desktop_app_info_get_nodisplay () |
gboolean | g_desktop_app_info_get_show_in () |
const char * | g_desktop_app_info_get_generic_name () |
const char * | g_desktop_app_info_get_categories () |
const char * const * | g_desktop_app_info_get_keywords () |
void | g_desktop_app_info_set_desktop_env () |
void | (*GDesktopAppLaunchCallback) () |
gboolean | g_desktop_app_info_launch_uris_as_manager () |
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.
GDesktopAppInfo *
g_desktop_app_info_new_from_filename (const char *filename
);
Creates a new GDesktopAppInfo.
GDesktopAppInfo *
g_desktop_app_info_new_from_keyfile (GKeyFile *key_file
);
Creates a new GDesktopAppInfo.
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
).
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
.
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.
gboolean
g_desktop_app_info_get_nodisplay (GDesktopAppInfo *info
);
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 g_app_info_should_show()
.
Since 2.30
gboolean g_desktop_app_info_get_show_in (GDesktopAppInfo *info
,const gchar *desktop_env
);
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.
If desktop_env
is NULL
, then the name of the desktop set with
g_desktop_app_info_set_desktop_env()
is used.
Note that g_app_info_should_show()
for info
will include this check (with
NULL
for desktop_env
) as well as additional checks.
TRUE
if the info
should be shown in desktop_env
according to the
OnlyShowIn
and NotShowIn
keys, FALSE
otherwise.
Since 2.30
const char *
g_desktop_app_info_get_generic_name (GDesktopAppInfo *info
);
Gets the generic name from the destkop file.
const char *
g_desktop_app_info_get_categories (GDesktopAppInfo *info
);
Gets the categories from the desktop file.
const char * const *
g_desktop_app_info_get_keywords (GDesktopAppInfo *info
);
Gets the keywords from the desktop file.
Since 2.32
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()
and
g_desktop_app_info_get_show_in()
to evaluate the
OnlyShowIn
and NotShowIn
desktop entry fields.
The Desktop Menu specification recognizes the following:
GNOME |
KDE |
ROX |
XFCE |
LXDE |
Unity |
Old |
Should be called only once; subsequent calls are ignored.
void (*GDesktopAppLaunchCallback) (GDesktopAppInfo *appinfo
,GPid pid
,gpointer user_data
);
During invocation, g_desktop_app_info_launch_uris_as_manager()
may
create one or more child processes. This callback is invoked once
for each, providing the process ID.
gboolean g_desktop_app_info_launch_uris_as_manager (GDesktopAppInfo *appinfo
,GList *uris
,GAppLaunchContext *launch_context
,GSpawnFlags spawn_flags
,GSpawnChildSetupFunc user_setup
,gpointer user_setup_data
,GDesktopAppLaunchCallback pid_callback
,gpointer pid_callback_data
,GError **error
);
This function performs the equivalent of g_app_info_launch_uris()
,
but is intended primarily for operating system components that
launch applications. Ordinary applications should use
g_app_info_launch_uris()
.
In contrast to g_app_info_launch_uris()
, all processes created will
always be run directly as children as if by the UNIX fork()
/exec()
calls.
This guarantee allows additional control over the exact environment
of the child processes, which is provided via a setup function
user_setup
, as well as the process identifier of each child process
via pid_callback
. See g_spawn_async()
for more information about the
semantics of the user_setup
function.
appinfo |
||
uris |
List of URIs. |
[element-type utf8] |
launch_context |
||
spawn_flags |
GSpawnFlags, used for each process |
|
user_setup |
a GSpawnChildSetupFunc, used once for each process. |
[scope call] |
user_setup_data |
User data for |
[closure user_setup] |
pid_callback |
Callback for child processes. |
[scope call] |
pid_callback_data |
User data for |
[closure pid_callback] |
error |
“filename”
property“filename” gchar *
The origin filename of this GDesktopAppInfo
Flags: Read / Write / Construct Only
Default value: NULL