[glib/glib-2-30] Fix default setting generation in g_desktop_app_info_set_as_last_used
- From: Josselin Mouette <jmouette src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-30] Fix default setting generation in g_desktop_app_info_set_as_last_used
- Date: Sat, 10 Sep 2011 06:30:14 +0000 (UTC)
commit 62a681453993e8618dd5fc41e987fa7308d617b0
Author: Josselin Mouette <joss debian org>
Date: Sat Sep 10 08:26:12 2011 +0200
Fix default setting generation in g_desktop_app_info_set_as_last_used
* Do not ignore the system default
* Do not exclude the last used being set from the default list
This fixes the default applications dialog in control-center.
https://bugzilla.gnome.org/show_bug.cgi?id=658188
gio/gdesktopappinfo.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 64f0349..d065c80 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -1686,18 +1686,29 @@ update_mimeapps_list (const char *desktop_id,
*/
if (!explicit_default)
{
- system_list = get_all_desktop_entries_for_mime_type (content_type, (const char **) list, FALSE, NULL);
+ char *user_default;
+ /* The system default can be in the list, don't exclude it */
+ system_list = get_all_desktop_entries_for_mime_type (content_type, NULL, FALSE, &user_default);
- if (system_list != NULL)
+ string = NULL;
+ if (user_default != NULL)
+ {
+ /* There is an existing default set in a lower priority defaults file, re-use it */
+ string = user_default;
+ }
+ else if (system_list != NULL)
{
string = system_list->data;
-
+ }
+ if (string)
+ {
g_key_file_set_string (key_file,
DEFAULT_APPLICATIONS_GROUP,
content_types[k],
string);
}
+ g_free (user_default);
g_list_free_full (system_list, g_free);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]