Update atk to 1.24.0 release
[fedora-mingw.git] / glib2 / gio-2.16-only-pass-uri-to-gio-apps.patch
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
4 @@ -1,3 +1,5 @@
5 +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
6 +
7  /* GIO - GLib Input, Output and Streaming Library
8   * 
9   * Copyright (C) 2006-2007 Red Hat, Inc.
10 @@ -89,6 +91,7 @@ struct _GDesktopAppInfo
11    char *exec;
12    char *binary;
13    char *path;
14 +  char *vfs_system;
15  
16    guint nodisplay       : 1;
17    guint hidden          : 1;
18 @@ -151,6 +154,7 @@ g_desktop_app_info_finalize (GObject *ob
19    g_free (info->try_exec);
20    g_free (info->exec);
21    g_free (info->binary);
22 +  g_free (info->vfs_system);
23    g_free (info->path);
24    
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);
31    
32    info->icon = NULL;
33    if (info->icon_name)
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, 
43  {
44    GList *uris = *uri_list;
45    char *expanded;
46 -  
47 +  gboolean force_file_uri;
48 +  char force_file_uri_macro;
49 +
50    g_return_if_fail (exec != NULL);
51 -  
52 +
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.
57 +   */
58 +  force_file_uri = FALSE;
59 +  if (macro == 'u' || macro == 'U')
60 +    {
61 +      if (info->vfs_system == NULL || strcmp (info->vfs_system, "gio") != 0)
62 +        {
63 +          switch (macro)
64 +            {
65 +            case 'u':
66 +              force_file_uri_macro = 'f';
67 +              force_file_uri = TRUE;
68 +              break;
69 +            case 'U':
70 +              force_file_uri_macro = 'F';
71 +              force_file_uri = TRUE;
72 +              break;
73 +            }
74 +        }
75 +    }
76 +
77    switch (macro)
78      {
79      case 'u':
80 @@ -528,7 +560,17 @@ expand_macro (char              macro, 
81      case 'n':
82        if (uris)
83         {
84 -         expanded = expand_macro_single (macro, uris->data);
85 +          if (!force_file_uri || g_str_has_prefix (uris->data, "http"))
86 +            {
87 +              expanded = expand_macro_single (macro, uris->data);
88 +            }
89 +          else
90 +            {
91 +              expanded = expand_macro_single (force_file_uri_macro, uris->data);
92 +              if (expanded == NULL)
93 +                expanded = expand_macro_single (macro, uris->data);
94 +            }
95 +
96           if (expanded)
97             {
98               g_string_append (exec, expanded);
99 @@ -545,7 +587,17 @@ expand_macro (char              macro, 
100      case 'N':
101        while (uris)
102         {
103 -         expanded = expand_macro_single (macro, uris->data);
104 +          if (!force_file_uri || g_str_has_prefix (uris->data, "http"))
105 +            {
106 +              expanded = expand_macro_single (macro, uris->data);
107 +            }
108 +          else
109 +            {
110 +              expanded = expand_macro_single (force_file_uri_macro, uris->data);
111 +              if (expanded == NULL)
112 +                expanded = expand_macro_single (macro, uris->data);
113 +            }
114 +
115           if (expanded)
116             {
117               g_string_append (exec, expanded);