Re: [PATCH] Don't show "Open Folder" in folder popup menu
- From: Martin Wehner <martin wehner gmail com>
- To: Christian Neumair <chris gnome-de org>
- Cc: nautilus-list gnome org
- Subject: Re: [PATCH] Don't show "Open Folder" in folder popup menu
- Date: Wed, 17 Aug 2005 23:34:55 +0200
On Mon, 2005-07-25 at 22:09 +0200, Christian Neumair wrote:
> 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.)
I dunno, but this strikes me as a pretty convoluted way of implementing
it. I mean, 3 new function types and a function with 8 arguments that
does the opposite of what the name claims because one of the arguments
inverts the result? And as a side-effect you end up with the name of the
handler to filter in 3 different places. Do you have anything special in
mind with this �eneric architecture?
How about the attached, simplified version?
Martin
? Debug
? depcomp
? nautilus-2.11.90.tar.gz
? nautilus-2.11.91.tar.gz
? nautilus-folder-handler.desktop
? nautilus.vpj
? stamp-h1
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 -w -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 17 Aug 2005 20:52:16 -0000
@@ -31,6 +31,29 @@
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <string.h>
+static GList*
+filter_nautilus_handler (GList *apps)
+{
+ GList *l, *next;
+ GnomeVFSMimeApplication *application;
+
+ l = apps;
+ while (l != NULL) {
+ application = (GnomeVFSMimeApplication *) l->data;
+ next = l->next;
+
+ if (strcmp (gnome_vfs_mime_application_get_desktop_id (application),
+ "nautilus-folder-handler.desktop") == 0) {
+ gnome_vfs_mime_application_free (application);
+ apps = g_list_delete_link (apps, l);
+ }
+
+ l = next;
+ }
+
+ return apps;
+}
+
static gboolean
nautilus_mime_actions_check_if_minimum_attributes_ready (NautilusFile *file)
{
@@ -138,7 +161,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
@@ -156,20 +179,22 @@ nautilus_mime_get_open_with_applications
result = get_open_with_mime_applications (file);
- return g_list_reverse (result);
+ return filter_nautilus_handler (result);
}
GList *
nautilus_mime_get_applications_for_file (NautilusFile *file)
{
char *mime_type;
+ GList *result;
if (!nautilus_mime_actions_check_if_minimum_attributes_ready (file)) {
return NULL;
}
mime_type = nautilus_file_get_mime_type (file);
+ result = gnome_vfs_mime_get_all_applications (mime_type);
- return gnome_vfs_mime_get_all_applications (mime_type);
+ return filter_nautilus_handler (result);
}
gboolean
@@ -183,6 +208,7 @@ nautilus_mime_has_any_applications_for_f
mime_type = nautilus_file_get_mime_type (file);
apps = gnome_vfs_mime_get_all_applications_for_uri (uri, mime_type);
+ apps = filter_nautilus_handler (apps);
if (apps) {
result = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]