summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-program-choosing.c
diff options
context:
space:
mode:
authorChristian Neumair <cneumair@gnome.org>2008-07-17 20:08:25 +0000
committerChristian Neumair <cneumair@src.gnome.org>2008-07-17 20:08:25 +0000
commit8f974b3021b93504b22eb73ae322618f5a1bd403 (patch)
tree720dd28441186904695fe86b53848d25651ac979 /libnautilus-private/nautilus-program-choosing.c
parent8ca35768508f418a74dba51d43dd524c8bca75b1 (diff)
downloadnautilus-8f974b3021b93504b22eb73ae322618f5a1bd403.tar.gz
Pass textual URIs instead of GFiles to GAppInfo for remote files, similar
2008-07-17 Christian Neumair <cneumair@gnome.org> * libnautilus-private/nautilus-program-choosing.c (nautilus_launch_application): Pass textual URIs instead of GFiles to GAppInfo for remote files, similar to nautilus_launch_desktop_file(). Fixes #543448. Discovered by Kamil Páral. svn path=/trunk/; revision=14372
Diffstat (limited to 'libnautilus-private/nautilus-program-choosing.c')
-rw-r--r--libnautilus-private/nautilus-program-choosing.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c
index 2151b8363..22856e315 100644
--- a/libnautilus-private/nautilus-program-choosing.c
+++ b/libnautilus-private/nautilus-program-choosing.c
@@ -147,24 +147,35 @@ nautilus_launch_application (GAppInfo *application,
GList *files,
GtkWindow *parent_window)
{
- char *uri_scheme;
- GList *locations, *l;
+ char *uri, *uri_scheme;
+ GList *locations, *uris, *l;
GFile *location;
NautilusFile *file;
gboolean result;
GError *error;
EelAppLaunchContext *launch_context;
NautilusIconInfo *icon;
+ int count, total;
g_assert (files != NULL);
+ /* count the number of uris with local paths */
+ count = 0;
+ total = g_list_length (files);
locations = NULL;
+ uris = NULL;
for (l = files; l != NULL; l = l->next) {
file = NAUTILUS_FILE (l->data);
location = nautilus_file_get_activation_location (file);
+ uri = nautilus_file_get_activation_uri (file);
+
+ if (g_file_is_native (location)) {
+ count++;
+ }
locations = g_list_prepend (locations, location);
+ uris = g_list_prepend (uris, uri);
}
locations = g_list_reverse (locations);
@@ -182,10 +193,23 @@ nautilus_launch_application (GAppInfo *application,
}
error = NULL;
- result = g_app_info_launch (application,
- locations,
- G_APP_LAUNCH_CONTEXT (launch_context),
- &error);
+
+ if (count == total) {
+ /* All files are local, so we can use g_app_info_launch () with
+ * the file list we constructed before.
+ */
+ result = g_app_info_launch (application,
+ locations,
+ G_APP_LAUNCH_CONTEXT (launch_context),
+ &error);
+ } else {
+ /* Some files are non local, better use g_app_info_launch_uris ().
+ */
+ result = g_app_info_launch_uris (application,
+ uris,
+ G_APP_LAUNCH_CONTEXT (launch_context),
+ &error);
+ }
g_object_unref (launch_context);
@@ -216,6 +240,7 @@ nautilus_launch_application (GAppInfo *application,
}
eel_g_object_list_free (locations);
+ eel_g_list_free_deep (uris);
}
/**