glib r7268 - trunk/gio
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7268 - trunk/gio
- Date: Mon, 28 Jul 2008 18:58:34 +0000 (UTC)
Author: matthiasc
Date: Mon Jul 28 18:58:34 2008
New Revision: 7268
URL: http://svn.gnome.org/viewvc/glib?rev=7268&view=rev
Log:
2008-07-28 Matthias Clasen <mclasen redhat com>
Bug 545157 â wrong/no list of "open with" applications for .cc and
.cpp files
* gdesktopappinfo.c (get_all_desktop_entries_for_mime_type):
Collect all ancestors, not just direct parents. Pointed
out by Bastien Nocera
Modified:
trunk/gio/ChangeLog
trunk/gio/gdesktopappinfo.c
Modified: trunk/gio/gdesktopappinfo.c
==============================================================================
--- trunk/gio/gdesktopappinfo.c (original)
+++ trunk/gio/gdesktopappinfo.c Mon Jul 28 18:58:34 2008
@@ -2433,11 +2433,39 @@
char **mime_types;
char **default_entries;
char **removed_associations;
- int i,j;
+ int i, j, k;
+ GPtrArray *array;
+ char **anc;
mime_info_cache_init ();
+ /* collect all ancestors */
mime_types = _g_unix_content_type_get_parents (base_mime_type);
+ array = g_ptr_array_new ();
+ for (i = 0; mime_types[i]; i++)
+ {
+ g_print ("%s\n", mime_types[i]);
+ g_ptr_array_add (array, mime_types[i]);
+ }
+ g_free (mime_types);
+ for (i = 0; i < array->len; i++)
+ {
+ anc = _g_unix_content_type_get_parents (g_ptr_array_index (array, i));
+ for (j = 0; anc[j]; j++)
+ {
+ for (k = 0; k < array->len; k++)
+ {
+ if (strcmp (anc[j], g_ptr_array_index (array, k)) == 0)
+ break;
+ }
+ if (k == array->len) /* not found */
+ g_ptr_array_add (array, g_strdup (anc[j]));
+ }
+ g_strfreev (anc);
+ }
+ g_ptr_array_add (array, NULL);
+ mime_types = g_ptr_array_free (array, FALSE);
+
G_LOCK (mime_info_cache);
removed_entries = NULL;
@@ -2458,7 +2486,7 @@
for (j = 0; default_entries != NULL && default_entries[j] != NULL; j++)
desktop_entries = append_desktop_entry (desktop_entries, default_entries[j], removed_entries);
- /* Then removed assiciations from mimeapps.list */
+ /* Then removed associations from mimeapps.list */
removed_associations = g_hash_table_lookup (dir->mimeapps_list_removed_map, mime_type);
for (j = 0; removed_associations != NULL && removed_associations[j] != NULL; j++)
removed_entries = append_desktop_entry (removed_entries, removed_associations[j], NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]