Commit 276e6a7b authored by Colin Walters's avatar Colin Walters

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
parent 0dc5d456
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment