mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
GDesktopAppInfo: Add g_desktop_app_info_get_categories()
This is needed to rebase gnome-menus on top of GDesktopAppInfo. https://bugzilla.gnome.org/show_bug.cgi?id=647903
This commit is contained in:
parent
0dc5d45692
commit
276e6a7be8
@ -104,6 +104,7 @@ struct _GDesktopAppInfo
|
||||
char *exec;
|
||||
char *binary;
|
||||
char *path;
|
||||
char *categories;
|
||||
|
||||
guint nodisplay : 1;
|
||||
guint hidden : 1;
|
||||
@ -177,6 +178,7 @@ g_desktop_app_info_finalize (GObject *object)
|
||||
g_free (info->exec);
|
||||
g_free (info->binary);
|
||||
g_free (info->path);
|
||||
g_free (info->categories);
|
||||
|
||||
G_OBJECT_CLASS (g_desktop_app_info_parent_class)->finalize (object);
|
||||
}
|
||||
@ -319,6 +321,7 @@ g_desktop_app_info_load_from_keyfile (GDesktopAppInfo *info,
|
||||
info->startup_notify = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY, NULL) != FALSE;
|
||||
info->no_fuse = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-GIO-NoFuse", NULL) != FALSE;
|
||||
info->hidden = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_HIDDEN, NULL) != FALSE;
|
||||
info->categories = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_CATEGORIES, NULL);
|
||||
|
||||
info->icon = NULL;
|
||||
if (info->icon_name)
|
||||
@ -637,6 +640,19 @@ g_desktop_app_info_get_icon (GAppInfo *appinfo)
|
||||
return info->icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_desktop_app_info_get_categories:
|
||||
* @info: a #GDesktopAppInfo
|
||||
*
|
||||
* Returns: The unparsed Categories key from the file; i.e. no attempt
|
||||
* is made to split it by ';' or validate it.
|
||||
*/
|
||||
const char *
|
||||
g_desktop_app_info_get_categories (GDesktopAppInfo *info)
|
||||
{
|
||||
return info->categories;
|
||||
}
|
||||
|
||||
static char *
|
||||
expand_macro_single (char macro, char *uri)
|
||||
{
|
||||
|
@ -50,6 +50,8 @@ GDesktopAppInfo *g_desktop_app_info_new_from_keyfile (GKeyFile *key_file
|
||||
|
||||
const char * g_desktop_app_info_get_filename (GDesktopAppInfo *info);
|
||||
|
||||
const char * g_desktop_app_info_get_categories (GDesktopAppInfo *info);
|
||||
|
||||
GDesktopAppInfo *g_desktop_app_info_new (const char *desktop_id);
|
||||
gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user