gvfs r1216 - in trunk: . programs
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: gvfs r1216 - in trunk: . programs
- Date: Fri, 1 Feb 2008 13:30:36 +0000 (GMT)
Author: alexl
Date: Fri Feb 1 13:30:36 2008
New Revision: 1216
URL: http://svn.gnome.org/viewvc/gvfs?rev=1216&view=rev
Log:
2008-02-01 Alexander Larsson <alexl redhat com>
* programs/gvfs-open.c:
Pass on uris unmodified to avoid roundtripping
through GFile which can be destructive.
Modified:
trunk/ChangeLog
trunk/programs/gvfs-open.c
Modified: trunk/programs/gvfs-open.c
==============================================================================
--- trunk/programs/gvfs-open.c (original)
+++ trunk/programs/gvfs-open.c Fri Feb 1 13:30:36 2008
@@ -48,11 +48,12 @@
}
static void
-open (GFile *file)
+open (GFile *file, char *arg_string)
{
GAppInfo *app;
GError *error;
- GList *l;
+ GList l = {NULL};
+ gboolean res;
error = NULL;
app = g_file_query_default_handler (file, NULL, &error);
@@ -67,19 +68,32 @@
return;
}
- l = g_list_prepend (NULL, file);
+ if (g_file_is_native (file))
+ {
+ /* For normal files, pass in the canonicalized GFile as path */
+ l.data = file;
+ res = g_app_info_launch (app, &l,
+ NULL, &error);
+ }
+ else
+ {
+ /* However, for uris, use the original string, as it might be
+ modified by passing throught GFile (e.g. mailto: links)
+ */
+ l.data = arg_string;
+ res = g_app_info_launch_uris (app, &l,
+ NULL, &error);
+ }
- if (!g_app_info_launch (app, l,
- NULL, &error))
+ if (!res)
{
/* Translators: the first %s is the program name, the second one */
/* is the URI of the file, the third is the error message. */
g_printerr (_("%s: %s: error launching application: %s\n"),
- g_get_prgname (), g_file_get_uri (file), error->message);
- g_error_free (error);
+ g_get_prgname (), g_file_get_uri (file), error->message);
+ g_error_free (error);
}
-
- g_list_free (l);
+
g_object_unref (app);
return;
@@ -136,7 +150,7 @@
do
{
file = g_file_new_for_commandline_arg (locations[i]);
- open (file);
+ open (file, locations[i]);
g_object_unref (file);
}
while (locations[++i] != NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]