Re: Getting applications for a particular mimetype.



> Is this a bug in the _all_applications function (which is what galeon is
> using), or is the documentation incorrect when it says:
> 
> "Return an alphabetically sorted list of GnomeVFSMimeApplication data
> structures representing all applications in the MIME database registered
> to handle files of MIME type mime_type (and supertypes)."
> 

Yeah, I think that's a bug in gnome-vfs, this part of the code isn't
really easy to get right. I wrote the attached patch yesterday, I
believe that should fix that. Can you test it ? You'll have to add new
handlers after applying the patch for it to (hopefully) work.

Christophe
Index: libgnomevfs/gnome-vfs-mime-handlers.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-mime-handlers.c,v
retrieving revision 1.99
diff -u -r1.99 gnome-vfs-mime-handlers.c
--- libgnomevfs/gnome-vfs-mime-handlers.c	24 Apr 2003 17:51:53 -0000	1.99
+++ libgnomevfs/gnome-vfs-mime-handlers.c	13 May 2003 07:42:59 -0000
@@ -1056,6 +1059,7 @@
 	GList *short_list_addition_list;
 	GList *short_list_removal_list;
 	GnomeVFSResult result;
+	GList *it;
 
 	/* Get base list. */
 	short_list_id_list = comma_separated_str_to_str_list
@@ -1066,6 +1070,18 @@
 	short_list_removal_list = str_list_difference (short_list_id_list, application_ids);
 	addition_string = str_list_to_comma_separated_str (short_list_addition_list);
 	removal_string = str_list_to_comma_separated_str (short_list_removal_list);
+
+	/* Make sure the newly added app_ids are already associated to this 
+	 * mime type in the application registry
+	 */
+	for (it = short_list_addition_list; it != NULL; it = it->next) {
+		/* add_mime_type won't do anything if mime_type is already
+		 * associated with it->data
+		 */
+		gnome_vfs_application_registry_add_mime_type (it->data, mime_type);		
+	}
+	gnome_vfs_application_registry_sync ();
+
 	g_list_free_deep (short_list_id_list);
 	g_list_free (short_list_addition_list);
 	g_list_free (short_list_removal_list);

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]