diff options
Diffstat (limited to 'meta/recipes-gnome/gtk+/gtk+-2.12.7/filesystem-volumes.patch')
-rw-r--r-- | meta/recipes-gnome/gtk+/gtk+-2.12.7/filesystem-volumes.patch | 200 |
1 files changed, 0 insertions, 200 deletions
diff --git a/meta/recipes-gnome/gtk+/gtk+-2.12.7/filesystem-volumes.patch b/meta/recipes-gnome/gtk+/gtk+-2.12.7/filesystem-volumes.patch deleted file mode 100644 index 3330f7b681..0000000000 --- a/meta/recipes-gnome/gtk+/gtk+-2.12.7/filesystem-volumes.patch +++ /dev/null | |||
@@ -1,200 +0,0 @@ | |||
1 | Upstream-Status: Inappropriate [enable feature] | ||
2 | |||
3 | Index: gtk+-2.12.3/gtk/gtkfilesystemunix.c | ||
4 | =================================================================== | ||
5 | --- gtk+-2.12.3.orig/gtk/gtkfilesystemunix.c 2007-12-04 16:52:08.000000000 +0000 | ||
6 | +++ gtk+-2.12.3/gtk/gtkfilesystemunix.c 2008-01-02 13:15:02.000000000 +0000 | ||
7 | @@ -38,6 +38,7 @@ | ||
8 | #include <errno.h> | ||
9 | #include <string.h> | ||
10 | #include <sys/stat.h> | ||
11 | +#include <sys/statvfs.h> | ||
12 | #include <sys/types.h> | ||
13 | #include <pwd.h> | ||
14 | #ifdef HAVE_UNISTD_H | ||
15 | @@ -474,7 +475,55 @@ | ||
16 | static GSList * | ||
17 | gtk_file_system_unix_list_volumes (GtkFileSystem *file_system) | ||
18 | { | ||
19 | - return g_slist_append (NULL, get_root_volume ()); | ||
20 | + struct statvfs stv; | ||
21 | + struct stat st; | ||
22 | + GSList * l = g_slist_append (NULL, get_root_volume ()); | ||
23 | + | ||
24 | + if (!statvfs ("/.", &stv)) | ||
25 | + { | ||
26 | + fsblkcnt_t root_blocks = stv.f_blocks; | ||
27 | + fsfilcnt_t root_files = stv.f_files; | ||
28 | + | ||
29 | + GDir * dir; | ||
30 | + if ((dir = g_dir_open ("/media", 0, NULL)) != NULL) | ||
31 | + { | ||
32 | + const gchar * name; | ||
33 | + while ((name = g_dir_read_name (dir)) != NULL) | ||
34 | + { | ||
35 | + gchar * abs_name; | ||
36 | + | ||
37 | + /* Skip ram disks */ | ||
38 | + if (!strcmp (name, "ram")) | ||
39 | + continue; | ||
40 | + | ||
41 | + abs_name = g_strconcat ("/media/", name, NULL); | ||
42 | + | ||
43 | + if (!stat (abs_name, &st) && S_ISDIR (st.st_mode)) | ||
44 | + { | ||
45 | + gchar * dot = g_strconcat (abs_name, "/.", NULL); | ||
46 | + if (!statvfs (dot, &stv) && | ||
47 | + (stv.f_blocks != root_blocks || | ||
48 | + stv.f_files != root_files)) | ||
49 | + { | ||
50 | + GtkFilePath * path = | ||
51 | + gtk_file_system_filename_to_path (file_system, | ||
52 | + abs_name); | ||
53 | + | ||
54 | + if (path) | ||
55 | + l = g_slist_append (l, path); | ||
56 | + } | ||
57 | + | ||
58 | + g_free (dot); | ||
59 | + } | ||
60 | + | ||
61 | + g_free (abs_name); | ||
62 | + } | ||
63 | + | ||
64 | + g_dir_close (dir); | ||
65 | + } | ||
66 | + } | ||
67 | + | ||
68 | + return l; | ||
69 | } | ||
70 | |||
71 | static GtkFileSystemVolume * | ||
72 | @@ -488,13 +537,18 @@ | ||
73 | remove_trailing_slash (const char *filename) | ||
74 | { | ||
75 | int len; | ||
76 | - | ||
77 | + | ||
78 | len = strlen (filename); | ||
79 | |||
80 | - if (len > 1 && filename[len - 1] == '/') | ||
81 | - return g_strndup (filename, len - 1); | ||
82 | - else | ||
83 | - return g_memdup (filename, len + 1); | ||
84 | + if (len > 1) | ||
85 | + { | ||
86 | + gchar *c = g_utf8_prev_char (filename + len); | ||
87 | + | ||
88 | + if (c && *c == '/') | ||
89 | + return g_strndup (filename, len - 1); | ||
90 | + } | ||
91 | + | ||
92 | + return g_memdup (filename, len + 1); | ||
93 | } | ||
94 | |||
95 | /* Delay callback dispatching | ||
96 | @@ -1128,7 +1182,7 @@ | ||
97 | gtk_file_system_unix_volume_get_base_path (GtkFileSystem *file_system, | ||
98 | GtkFileSystemVolume *volume) | ||
99 | { | ||
100 | - return gtk_file_path_new_dup ("/"); | ||
101 | + return gtk_file_path_copy ((GtkFilePath*)volume); | ||
102 | } | ||
103 | |||
104 | static gboolean | ||
105 | @@ -1162,7 +1216,32 @@ | ||
106 | gtk_file_system_unix_volume_get_display_name (GtkFileSystem *file_system, | ||
107 | GtkFileSystemVolume *volume) | ||
108 | { | ||
109 | - return g_strdup (_("File System")); /* Same as Nautilus */ | ||
110 | + gchar * slash; | ||
111 | + gchar * path; | ||
112 | + gchar * c; | ||
113 | + | ||
114 | + g_return_val_if_fail (file_system && volume, NULL); | ||
115 | + | ||
116 | + path = gtk_file_system_path_to_filename (file_system, (GtkFilePath*) volume); | ||
117 | + | ||
118 | + g_return_val_if_fail (path && *path, NULL); | ||
119 | + | ||
120 | + if (path[0] == '/' && !path[1]) | ||
121 | + return g_strdup (_("Filesystem")); /* Same as Nautilus */ | ||
122 | + | ||
123 | + /* Now the media volumes */ | ||
124 | + /* strip trailing / if any */ | ||
125 | + c = g_utf8_prev_char (path + strlen(path)); | ||
126 | + | ||
127 | + if (*c == '/') | ||
128 | + *c = 0; | ||
129 | + | ||
130 | + slash = g_utf8_strrchr (path, -1, '/'); | ||
131 | + | ||
132 | + if (!slash) | ||
133 | + return g_strdup (path); | ||
134 | + | ||
135 | + return g_strdup (slash + 1); | ||
136 | } | ||
137 | |||
138 | static IconType | ||
139 | @@ -1250,10 +1329,57 @@ | ||
140 | GtkFileSystemVolume *volume, | ||
141 | GError **error) | ||
142 | { | ||
143 | - /* FIXME: maybe we just always want to return GTK_STOCK_HARDDISK here? | ||
144 | - * or the new tango icon name? | ||
145 | - */ | ||
146 | - return g_strdup ("gnome-dev-harddisk"); | ||
147 | + gchar * c; | ||
148 | + gchar * slash; | ||
149 | + gchar * path = NULL; | ||
150 | + GtkFilePath * fpath; | ||
151 | + const gchar * id = NULL; | ||
152 | + | ||
153 | + g_return_val_if_fail (file_system && volume, NULL); | ||
154 | + | ||
155 | + fpath = gtk_file_system_volume_get_base_path (file_system, volume); | ||
156 | + | ||
157 | + if (!fpath) | ||
158 | + goto out; | ||
159 | + | ||
160 | + path = gtk_file_system_path_to_filename (file_system, fpath); | ||
161 | + gtk_file_path_free (fpath); | ||
162 | + | ||
163 | + if (!path || !*path || (*path == '/' && !path[1])) | ||
164 | + goto out; | ||
165 | + | ||
166 | + /* Now the media volumes */ | ||
167 | + /* strip trailing / if any */ | ||
168 | + c = g_utf8_prev_char (path + strlen(path)); | ||
169 | + | ||
170 | + if (*c == '/') | ||
171 | + *c = 0; | ||
172 | + | ||
173 | + slash = g_utf8_strrchr (path, -1, '/'); | ||
174 | + | ||
175 | + if (slash) | ||
176 | + { | ||
177 | + slash++; | ||
178 | + | ||
179 | + if (!strcmp (slash, "card")) | ||
180 | + id = "gnome-dev-media-sdmmc"; | ||
181 | + else if (!strcmp (slash, "cf")) | ||
182 | + id = "gnome-dev-media-cf"; | ||
183 | + else if (!strncmp (slash, "mmc", 3)) | ||
184 | + id = "gnome-dev-media-sdmmc"; | ||
185 | + else if (!strcmp (slash, "usbhdd")) | ||
186 | + id = "gnome-dev-removable-usb"; | ||
187 | + else | ||
188 | + id = "gnome-dev-removable"; | ||
189 | + } | ||
190 | + | ||
191 | + out: | ||
192 | + g_free (path); | ||
193 | + | ||
194 | + if (!id) | ||
195 | + id = "gnome-fs-blockdev"; | ||
196 | + | ||
197 | + return g_strdup (id); | ||
198 | } | ||
199 | |||
200 | static char * | ||