From bug 310382 [1]: 'Right click on a folder, in the "open with" submenu you'll find an "Open Folder" item. You'll also find this item among the action buttons of the info side pane (where it looks even weirder). If you select it, the selected folder will open with nautilus.' We install a handler for good reasons (launching from other desktop environments, for instance). But we should a) not show this handler from within Nautilus (fixed by attached patch. Hope you like the architecture.) b) rename the "Name" in nautilus-folder-handler.desktop to "Nautilus" or "Nautilus File Manager". If the latter is chosen, GenericName has to be adapted as well. -- Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-mime-actions.c =================================================================== RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-mime-actions.c,v retrieving revision 1.116 diff -u -p -r1.116 nautilus-mime-actions.c --- libnautilus-private/nautilus-mime-actions.c 25 Nov 2004 14:13:37 -0000 1.116 +++ libnautilus-private/nautilus-mime-actions.c 25 Jul 2005 20:00:05 -0000 @@ -31,6 +31,65 @@ #include <libgnomevfs/gnome-vfs-mime-handlers.h> #include <string.h> +typedef GList * (* ApplicationListGetFunc) (gpointer data); +typedef GList * (* ApplicationListGetFunc2) (gpointer data, gpointer data_2); +typedef gboolean (* ApplicationListMatchFunc) (GnomeVFSMimeApplication *application, + gpointer data); + +static gboolean +match_desktop_id (GnomeVFSMimeApplication *application, + const gpointer data) +{ + g_return_val_if_fail (application != NULL, FALSE); + g_return_val_if_fail (data != NULL, FALSE); + + return (strcmp (gnome_vfs_mime_application_get_desktop_id (application), data) == 0); +} + +static GList * +nautilus_mime_actions_get_matched_mime_types (ApplicationListGetFunc get_func, + ApplicationListGetFunc2 get_func_2, + ApplicationListMatchFunc match_func, + gboolean exclusive, + gpointer get_func_data, + gpointer get_func_2_data, + gpointer get_func_2_data_2, + gpointer match_func_data) +{ + GList *candidates, *l, *ret; + GnomeVFSMimeApplication *application; + gboolean success; + + candidates = ret = NULL; + + if (get_func != NULL) { + candidates = get_func (get_func_data); + } + if (get_func_2 != NULL) { + candidates = g_list_concat (candidates, + get_func_2 (get_func_2_data, get_func_2_data_2)); + } + + for (l = candidates; l != NULL; l = l->next) { + application = (GnomeVFSMimeApplication *) l->data; + + success = match_func (application, match_func_data); + if (exclusive) { + success = !success; + } + + if (success) { + ret = g_list_prepend (ret, application); + } else { + gnome_vfs_mime_application_free (application); + } + } + + g_list_free (candidates); + + return g_list_reverse (ret); +} + static gboolean nautilus_mime_actions_check_if_minimum_attributes_ready (NautilusFile *file) { @@ -138,7 +197,7 @@ get_open_with_mime_applications (Nautilu g_free (uri); g_free (guessed_mime_type); - return result; + return g_list_reverse (result); } /* Get a list of applications for the Open With menu. This is @@ -148,15 +207,13 @@ get_open_with_mime_applications (Nautilu GList * nautilus_mime_get_open_with_applications_for_file (NautilusFile *file) { - GList *result; - if (!nautilus_mime_actions_check_if_open_with_attributes_ready (file)) { return NULL; } - result = get_open_with_mime_applications (file); - - return g_list_reverse (result); + return nautilus_mime_actions_get_matched_mime_types + ((ApplicationListGetFunc) get_open_with_mime_applications, NULL, + match_desktop_id, TRUE, file, NULL, NULL, "nautilus-folder-handler.desktop"); } GList * @@ -169,7 +226,9 @@ nautilus_mime_get_applications_for_file } mime_type = nautilus_file_get_mime_type (file); - return gnome_vfs_mime_get_all_applications (mime_type); + return nautilus_mime_actions_get_matched_mime_types + ((ApplicationListGetFunc) gnome_vfs_mime_get_all_applications, NULL, + match_desktop_id, TRUE, mime_type, NULL, NULL, "nautilus-folder-handler.desktop"); } gboolean @@ -182,7 +241,9 @@ nautilus_mime_has_any_applications_for_f uri = nautilus_file_get_uri (file); mime_type = nautilus_file_get_mime_type (file); - apps = gnome_vfs_mime_get_all_applications_for_uri (uri, mime_type); + apps = nautilus_mime_actions_get_matched_mime_types + (NULL, (ApplicationListGetFunc2) gnome_vfs_mime_get_all_applications_for_uri, + match_desktop_id, TRUE, NULL, uri, mime_type, "nautilus-folder-handler.desktop"); if (apps) { result = TRUE;
Attachment:
signature.asc
Description: This is a digitally signed message part