GIcon *icon;
char **only_show_in;
char **not_show_in;
+ char **mimetypes;
char *try_exec;
char *exec;
char *binary;
g_object_unref (info->icon);
g_strfreev (info->only_show_in);
g_strfreev (info->not_show_in);
+ g_strfreev (info->mimetypes);
g_free (info->try_exec);
g_free (info->exec);
g_free (info->binary);
info->icon_name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL, NULL);
info->only_show_in = g_key_file_get_string_list (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, NULL, NULL);
info->not_show_in = g_key_file_get_string_list (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN, NULL, NULL);
+ info->mimetypes = g_key_file_get_string_list (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_MIME_TYPE, NULL, NULL);
info->try_exec = try_exec;
info->exec = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL);
info->path = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_PATH, NULL);
}
static gboolean
+g_desktop_app_info_supports_mimetype (GDesktopAppInfo *appinfo,
+ const char *mimetype)
+{
+ int i;
+
+ if (appinfo->mimetypes == NULL)
+ return FALSE;
+
+ for (i = 0; appinfo->mimetypes[i] != NULL; i++)
+ {
+ if (strcmp (appinfo->mimetypes[i], mimetype) == 0)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
g_desktop_app_info_add_supports_type (GAppInfo *appinfo,
const char *content_type,
GError **error)
char *dirname;
char *filename;
+ if (g_desktop_app_info_supports_mimetype (info, content_type))
+ return TRUE; /* Already supported */
+
keyfile = g_key_file_new ();
if (!g_key_file_load_from_file (keyfile, info->filename,
G_KEY_FILE_KEEP_COMMENTS |
char *filename;
char *dirname;
+ if (!g_desktop_app_info_supports_mimetype (info, content_type))
+ return TRUE; /* Already not supported */
+
keyfile = g_key_file_new ();
if (!g_key_file_load_from_file (keyfile, info->filename,
G_KEY_FILE_KEEP_COMMENTS |