1 diff -up glib-2.17.3/gio/gdesktopappinfo.c.only-pass-uri-to-gio-apps glib-2.17.3/gio/gdesktopappinfo.c
2 --- glib-2.17.3/gio/gdesktopappinfo.c.only-pass-uri-to-gio-apps 2008-07-02 17:13:13.000000000 -0400
3 +++ glib-2.17.3/gio/gdesktopappinfo.c 2008-07-03 13:21:42.000000000 -0400
5 +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
7 /* GIO - GLib Input, Output and Streaming Library
9 * Copyright (C) 2006-2007 Red Hat, Inc.
10 @@ -89,6 +91,7 @@ struct _GDesktopAppInfo
18 @@ -151,6 +154,7 @@ g_desktop_app_info_finalize (GObject *ob
19 g_free (info->try_exec);
21 g_free (info->binary);
22 + g_free (info->vfs_system);
25 G_OBJECT_CLASS (g_desktop_app_info_parent_class)->finalize (object);
26 @@ -254,6 +258,7 @@ g_desktop_app_info_new_from_keyfile (GKe
27 info->terminal = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TERMINAL, NULL) != FALSE;
28 info->startup_notify = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY, NULL) != FALSE;
29 info->hidden = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_HIDDEN, NULL) != FALSE;
30 + info->vfs_system = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-Gnome-Vfs-System", NULL);
34 @@ -392,6 +397,7 @@ g_desktop_app_info_dup (GAppInfo *appinf
35 new_info->exec = g_strdup (info->exec);
36 new_info->binary = g_strdup (info->binary);
37 new_info->path = g_strdup (info->path);
38 + new_info->vfs_system = g_strdup (info->vfs_system);
39 new_info->hidden = info->hidden;
40 new_info->terminal = info->terminal;
41 new_info->startup_notify = info->startup_notify;
42 @@ -517,9 +523,35 @@ expand_macro (char macro,
44 GList *uris = *uri_list;
47 + gboolean force_file_uri;
48 + char force_file_uri_macro;
50 g_return_if_fail (exec != NULL);
53 + /* On %u and %U, only pass gio URI's if the desktop file has the
54 + * X-Gnome-Vfs-System key set to 'gio' or if FUSE is not available.
55 + * Otherwise we pass in a POSIX file path pointing to the URI via
56 + * the FUSE mount in ~/.gvfs.
58 + force_file_uri = FALSE;
59 + if (macro == 'u' || macro == 'U')
61 + if (info->vfs_system == NULL || strcmp (info->vfs_system, "gio") != 0)
66 + force_file_uri_macro = 'f';
67 + force_file_uri = TRUE;
70 + force_file_uri_macro = 'F';
71 + force_file_uri = TRUE;
80 @@ -528,7 +560,17 @@ expand_macro (char macro,
84 - expanded = expand_macro_single (macro, uris->data);
85 + if (!force_file_uri || g_str_has_prefix (uris->data, "http"))
87 + expanded = expand_macro_single (macro, uris->data);
91 + expanded = expand_macro_single (force_file_uri_macro, uris->data);
92 + if (expanded == NULL)
93 + expanded = expand_macro_single (macro, uris->data);
98 g_string_append (exec, expanded);
99 @@ -545,7 +587,17 @@ expand_macro (char macro,
103 - expanded = expand_macro_single (macro, uris->data);
104 + if (!force_file_uri || g_str_has_prefix (uris->data, "http"))
106 + expanded = expand_macro_single (macro, uris->data);
110 + expanded = expand_macro_single (force_file_uri_macro, uris->data);
111 + if (expanded == NULL)
112 + expanded = expand_macro_single (macro, uris->data);
117 g_string_append (exec, expanded);