#define MIME_CACHE_GROUP "MIME Cache"
#define GENERIC_NAME_KEY "GenericName"
#define FULL_NAME_KEY "X-GNOME-FullName"
+#define KEYWORDS_KEY "X-GNOME-Keywords"
enum {
PROP_0,
char *comment;
char *icon_name;
GIcon *icon;
+ char **keywords;
char **only_show_in;
char **not_show_in;
char *try_exec;
g_free (info->icon_name);
if (info->icon)
g_object_unref (info->icon);
+ g_strfreev (info->keywords);
g_strfreev (info->only_show_in);
g_strfreev (info->not_show_in);
g_free (info->try_exec);
info->name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL);
info->generic_name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, GENERIC_NAME_KEY, NULL, NULL);
info->fullname = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, FULL_NAME_KEY, NULL, NULL);
+ info->keywords = g_key_file_get_locale_string_list (key_file, G_KEY_FILE_DESKTOP_GROUP, KEYWORDS_KEY, NULL, NULL, NULL);
info->comment = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL);
info->nodisplay = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, NULL) != FALSE;
info->icon_name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL, NULL);
new_info->name = g_strdup (info->name);
new_info->generic_name = g_strdup (info->generic_name);
new_info->fullname = g_strdup (info->fullname);
+ new_info->keywords = g_strdupv (info->keywords);
new_info->comment = g_strdup (info->comment);
new_info->nodisplay = info->nodisplay;
new_info->icon_name = g_strdup (info->icon_name);
}
/**
+ * g_desktop_app_info_get_keywords:
+ * @info: a #GDesktopAppInfo
+ *
+ * Gets the keywords from the desktop file.
+ *
+ * Returns: The value of the X-GNOME-Keywords key
+ *
+ * Since: 2.32
+ */
+const char * const *
+g_desktop_app_info_get_keywords (GDesktopAppInfo *info)
+{
+ return (const char * const *)info->keywords;
+}
+
+/**
* g_desktop_app_info_get_generic_name:
* @info: a #GDesktopAppInfo
*
key_file = g_key_file_new ();
load_succeeded = g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, NULL);
- if (!load_succeeded || !g_key_file_has_group (key_file, ADDED_ASSOCIATIONS_GROUP))
+ if (!load_succeeded ||
+ (!g_key_file_has_group (key_file, ADDED_ASSOCIATIONS_GROUP) &&
+ !g_key_file_has_group (key_file, REMOVED_ASSOCIATIONS_GROUP) &&
+ !g_key_file_has_group (key_file, DEFAULT_APPLICATIONS_GROUP)))
{
g_key_file_free (key_file);
key_file = g_key_file_new ();
g_strfreev (list);
}
- g_strfreev (content_types);
+ g_strfreev (content_types);
data = g_key_file_to_data (key_file, &data_size, error);
g_key_file_free (key_file);
-
+
res = g_file_set_contents (filename, data, data_size, error);
mime_info_cache_reload (NULL);
-
+
g_free (filename);
g_free (data);
-
+
return res;
}