[nautilus] Don't show apps that don't support files or uris



commit 7cf1d12219bb175df6d34f682ffdc1bc90ffb6b7
Author: William Jon McCann <jmccann redhat com>
Date:   Sun Aug 26 11:58:21 2012 -0400

    Don't show apps that don't support files or uris
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682729

 src/nautilus-mime-actions.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index 72ca36f..cf925c7 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -258,16 +258,22 @@ filter_nautilus_handler (GList *apps)
 }
 
 static GList*
-filter_non_uri_apps (GList *apps)
+filter_non_uri_apps (GList *apps,
+		     gboolean accept_files)
 {
 	GList *l, *next;
 	GAppInfo *app;
 
 	for (l = apps; l != NULL; l = next) {
+		gboolean support;
+
 		app = l->data;
 		next = l->next;
-		
-		if (!g_app_info_supports_uris (app)) {
+		support = g_app_info_supports_uris (app);
+		if (accept_files) {
+			support |= g_app_info_supports_files (app);
+		}
+		if (!support) {
 			apps = g_list_delete_link (apps, l);
 			g_object_unref (app);
 		}
@@ -275,7 +281,6 @@ filter_non_uri_apps (GList *apps)
 	return apps;
 }
 
-
 static gboolean
 nautilus_mime_actions_check_if_required_attributes_ready (NautilusFile *file)
 {
@@ -442,12 +447,10 @@ nautilus_mime_get_applications_for_file (NautilusFile *file)
 		}
 		g_free (uri_scheme);
 	}
-	
-	if (!file_has_local_path (file)) {
-		/* Filter out non-uri supporting apps */
-		result = filter_non_uri_apps (result);
-	}
-	
+
+	/* Filter out non-uri supporting apps */
+	result = filter_non_uri_apps (result, file_has_local_path (file));
+
 	result = g_list_sort (result, (GCompareFunc) application_compare_by_name);
 	g_free (mime_type);
 



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