]>
Commit | Line | Data |
---|---|---|
9efead13 JR |
1 | diff -ur xfburn-0.4.3/configure.in xfburn-0.4.3-gio/configure.in |
2 | --- xfburn-0.4.3/configure.in 2011-02-24 14:04:52.532017948 +0100 | |
3 | +++ xfburn-0.4.3-gio/configure.in 2011-02-24 14:00:14.464307451 +0100 | |
4 | @@ -40,10 +40,8 @@ | |
5 | XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0]) | |
6 | XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.4.0]) | |
7 | XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.4], [], [XDT_CHECK_PACKAGE([EXO], [exo-1], [0.3.100])]) | |
8 | -XDT_CHECK_OPTIONAL_PACKAGE([THUNAR_VFS], [thunar-vfs-1], [0.3.0], [thunar-vfs], | |
9 | - AC_HELP_STRING([--disable-thunar-vfs], | |
10 | - [Disable the use of Thunar's VFS layer to show mime type and icons in file browser])) | |
11 | -AM_CONDITIONAL([HAVE_THUNAR_VFS], [test "x$THUNAR_VFS_FOUND" = "xyes"]) | |
12 | +XDT_CHECK_PACKAGE([LIBGIO], [gio-2.0], [2.18.0]) | |
13 | +XDT_CHECK_PACKAGE([LIBGIOUNIX], [gio-unix-2.0], [2.16.0]) | |
14 | ||
15 | dnl ********************************** | |
16 | dnl *** Optional support for D-BUS *** | |
17 | diff -ur xfburn-0.4.3/xfburn/xfburn-audio-composition.c xfburn-0.4.3-gio/xfburn/xfburn-audio-composition.c | |
18 | --- xfburn-0.4.3/xfburn/xfburn-audio-composition.c 2009-12-04 08:47:20.000000000 +0100 | |
19 | +++ xfburn-0.4.3-gio/xfburn/xfburn-audio-composition.c 2011-02-24 13:57:29.188307447 +0100 | |
20 | @@ -34,9 +34,7 @@ | |
21 | #include <libxfce4util/libxfce4util.h> | |
22 | #include <libxfcegui4/libxfcegui4.h> | |
23 | ||
24 | -#ifdef HAVE_THUNAR_VFS | |
25 | -#include <thunar-vfs/thunar-vfs.h> | |
26 | -#endif | |
27 | +#include <gio/gio.h> | |
28 | ||
29 | #include <exo/exo.h> | |
30 | ||
31 | @@ -1711,37 +1709,30 @@ | |
32 | if (files) | |
33 | for (i=0; files[i] != NULL && files[i][0] != '\0'; i++) { | |
34 | gchar *full_path; | |
35 | + GFile *vfs_path; | |
36 | ||
37 | -#ifdef HAVE_THUNAR_VFS | |
38 | - ThunarVfsPath *vfs_path; | |
39 | - GError *vfs_error = NULL; | |
40 | - | |
41 | - vfs_path = thunar_vfs_path_new (files[i], &vfs_error); | |
42 | - | |
43 | - if (vfs_error) { | |
44 | - g_warning ("Failed to create vfs path for '%s': %s", files[i], vfs_error->message); | |
45 | - g_error_free (vfs_error); | |
46 | + vfs_path = g_file_new_for_path (files[i]); | |
47 | + if (vfs_path == NULL) { | |
48 | + g_warning ("Failed to create vfs path for '%s'", files[i]); | |
49 | continue; | |
50 | } | |
51 | ||
52 | - if (thunar_vfs_path_get_scheme (vfs_path) != THUNAR_VFS_PATH_SCHEME_FILE) | |
53 | - continue; | |
54 | - full_path = thunar_vfs_path_dup_string (vfs_path); | |
55 | + /* unable to handle non-local files */ | |
56 | + if (G_UNLIKELY (!g_file_has_uri_scheme (vfs_path, "file"))) { | |
57 | + g_object_unref (vfs_path); | |
58 | + continue; | |
59 | + } | |
60 | ||
61 | - thunar_vfs_path_unref (vfs_path); | |
62 | + full_path = g_file_get_path (vfs_path); | |
63 | ||
64 | -#else /* no thunar-vfs */ | |
65 | + /* if there is no local path, use the URI (which always works) */ | |
66 | + if (full_path == NULL) | |
67 | + full_path = g_file_get_uri (vfs_path); | |
68 | ||
69 | - if (g_str_has_prefix (files[i], "file://")) | |
70 | - full_path = g_build_filename (&files[i][7], NULL); | |
71 | - else if (g_str_has_prefix (files[i], "file:")) | |
72 | - full_path = g_build_filename (&files[i][5], NULL); | |
73 | - else | |
74 | - full_path = g_build_filename (files[i], NULL); | |
75 | + /* release the location */ | |
76 | + g_object_unref (vfs_path); | |
77 | ||
78 | - if (full_path[strlen (full_path) - 1] == '\r') | |
79 | - full_path[strlen (full_path) - 1] = '\0'; | |
80 | -#endif | |
81 | + DBG ("Adding path '%s'", full_path); | |
82 | ||
83 | /* remember path to add it later in another thread */ | |
84 | priv->full_paths_to_add = g_list_append (priv->full_paths_to_add, full_path); | |
85 | @@ -1786,29 +1777,47 @@ | |
86 | } | |
87 | } | |
88 | else if (sd->target == gdk_atom_intern ("text/uri-list", FALSE)) { | |
89 | -#ifdef HAVE_THUNAR_VFS | |
90 | GList *vfs_paths = NULL; | |
91 | GList *vfs_path; | |
92 | - GError *error = NULL; | |
93 | + GList *lp; | |
94 | gchar *full_path; | |
95 | + gchar **uris; | |
96 | + gsize n; | |
97 | gboolean ret = FALSE; | |
98 | ||
99 | - vfs_paths = thunar_vfs_path_list_from_string ((gchar *) sd->data, &error); | |
100 | + uris = g_uri_list_extract_uris ((gchar *) sd->data); | |
101 | + | |
102 | + for (n = 0; uris != NULL && uris[n] != NULL; ++n) | |
103 | + vfs_paths = g_list_append (vfs_paths, g_file_new_for_uri (uris[n])); | |
104 | + | |
105 | + g_strfreev (uris); | |
106 | ||
107 | if (G_LIKELY (vfs_paths != NULL)) { | |
108 | ThreadAddFilesDragParams *params; | |
109 | priv->full_paths_to_add = NULL; | |
110 | for (vfs_path = vfs_paths; vfs_path != NULL; vfs_path = g_list_next (vfs_path)) { | |
111 | - ThunarVfsPath *path = THUNAR_VFS_PATH (vfs_path->data); | |
112 | - if (thunar_vfs_path_get_scheme (path) != THUNAR_VFS_PATH_SCHEME_FILE) | |
113 | + GFile *path = g_file_new_for_path (vfs_path->data); | |
114 | + if (path == NULL) | |
115 | continue; | |
116 | - full_path = thunar_vfs_path_dup_string (path); | |
117 | + /* unable to handle non-local files */ | |
118 | + if (G_UNLIKELY (!g_file_has_uri_scheme (path, "file"))) { | |
119 | + g_object_unref (path); | |
120 | + continue; | |
121 | + } | |
122 | + full_path = g_file_get_path (path); | |
123 | + /* if there is no local path, use the URI (which always works) */ | |
124 | + if (full_path == NULL) | |
125 | + full_path = g_file_get_uri (path); | |
126 | + /* release the location */ | |
127 | g_debug ("adding uri path: %s", full_path); | |
128 | - | |
129 | + g_object_unref (path); | |
130 | priv->full_paths_to_add = g_list_prepend (priv->full_paths_to_add, full_path); | |
131 | ret = TRUE; | |
132 | } | |
133 | - thunar_vfs_path_list_free (vfs_paths); | |
134 | + | |
135 | + for (lp = vfs_paths; lp != NULL; lp = lp->next) | |
136 | + g_object_unref (lp->data); | |
137 | + g_list_free (vfs_paths); | |
138 | ||
139 | priv->full_paths_to_add = g_list_reverse (priv->full_paths_to_add); | |
140 | priv->path_where_insert = path_where_insert; | |
141 | @@ -1831,18 +1840,10 @@ | |
142 | cb_adding_done (XFBURN_ADDING_PROGRESS (priv->progress), composition); | |
143 | } | |
144 | } else { | |
145 | - if (G_UNLIKELY (error != NULL)) | |
146 | - g_warning ("text/uri-list drag failed because '%s'", error->message); | |
147 | - else | |
148 | - g_warning("There were no files in the uri list!"); | |
149 | + g_warning("There were no files in the uri list!"); | |
150 | gtk_drag_finish (dc, FALSE, FALSE, t); | |
151 | xfburn_default_cursor (priv->content); | |
152 | } | |
153 | -#else | |
154 | - g_warning ("Receiving this type of drag and drop requires thunar-vfs support, sorry!"); | |
155 | - gtk_drag_finish (dc, FALSE, FALSE, t); | |
156 | - xfburn_default_cursor (priv->content); | |
157 | -#endif | |
158 | } | |
159 | else { | |
160 | g_warning ("Trying to receive an unsupported drag target, this should not happen."); | |
161 | diff -ur xfburn-0.4.3/xfburn/xfburn-data-composition.c xfburn-0.4.3-gio/xfburn/xfburn-data-composition.c | |
162 | --- xfburn-0.4.3/xfburn/xfburn-data-composition.c 2009-12-04 08:46:43.000000000 +0100 | |
163 | +++ xfburn-0.4.3-gio/xfburn/xfburn-data-composition.c 2011-02-24 13:57:48.743307448 +0100 | |
164 | @@ -37,9 +37,7 @@ | |
165 | #include <libxfce4util/libxfce4util.h> | |
166 | #include <libxfcegui4/libxfcegui4.h> | |
167 | ||
168 | -#ifdef HAVE_THUNAR_VFS | |
169 | -#include <thunar-vfs/thunar-vfs.h> | |
170 | -#endif | |
171 | +#include <gio/gio.h> | |
172 | ||
173 | #include <exo/exo.h> | |
174 | ||
175 | @@ -288,9 +286,7 @@ | |
176 | ||
177 | GtkTargetEntry gte_src[] = { { "XFBURN_TREE_PATHS", GTK_TARGET_SAME_WIDGET, DATA_COMPOSITION_DND_TARGET_INSIDE } }; | |
178 | GtkTargetEntry gte_dest[] = { { "XFBURN_TREE_PATHS", GTK_TARGET_SAME_WIDGET, DATA_COMPOSITION_DND_TARGET_INSIDE }, | |
179 | -#ifdef HAVE_THUNAR_VFS | |
180 | { "text/uri-list", 0, DATA_COMPOSITION_DND_TARGET_TEXT_URI_LIST }, | |
181 | -#endif | |
182 | { "text/plain;charset=utf-8", 0, DATA_COMPOSITION_DND_TARGET_TEXT_PLAIN }, | |
183 | }; | |
184 | ||
185 | @@ -1188,14 +1184,14 @@ | |
186 | } | |
187 | /* new file */ | |
188 | else if (S_ISREG (s.st_mode) || S_ISCHR(s.st_mode) || S_ISBLK(s.st_mode) || S_ISLNK (s.st_mode)) { | |
189 | -#ifdef HAVE_THUNAR_VFS | |
190 | GdkScreen *screen; | |
191 | GtkIconTheme *icon_theme; | |
192 | - ThunarVfsMimeDatabase *mime_database = NULL; | |
193 | - ThunarVfsMimeInfo *mime_info = NULL; | |
194 | - const gchar *mime_icon_name = NULL; | |
195 | - GdkPixbuf *mime_icon = NULL; | |
196 | + GdkPixbuf *mime_icon_pixbuf = NULL; | |
197 | gint x,y; | |
198 | + GFile *file = NULL; | |
199 | + GFileInfo *info = NULL; | |
200 | + GIcon *mime_icon = NULL; | |
201 | + GtkIconInfo *icon_info = NULL; | |
202 | ||
203 | if (s.st_size > MAXIMUM_ISO_FILE_SIZE) { | |
204 | gdk_threads_enter (); | |
205 | @@ -1208,45 +1204,35 @@ | |
206 | gdk_threads_enter (); | |
207 | screen = gtk_widget_get_screen (GTK_WIDGET (dc)); | |
208 | icon_theme = gtk_icon_theme_get_for_screen (screen); | |
209 | - | |
210 | - mime_database = thunar_vfs_mime_database_get_default (); | |
211 | - mime_info = thunar_vfs_mime_database_get_info_for_file (mime_database, path, NULL); | |
212 | - | |
213 | gtk_icon_size_lookup (GTK_ICON_SIZE_SMALL_TOOLBAR, &x, &y); | |
214 | - mime_icon_name = thunar_vfs_mime_info_lookup_icon_name (mime_info, icon_theme); | |
215 | - mime_icon = gtk_icon_theme_load_icon (icon_theme, mime_icon_name, x, 0, NULL); | |
216 | -#endif | |
217 | - | |
218 | + | |
219 | + file = g_file_new_for_path(path); | |
220 | + info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL); | |
221 | + mime_icon = g_content_type_get_icon (g_file_info_get_content_type (info)); | |
222 | + icon_info = gtk_icon_theme_lookup_by_gicon (icon_theme, mime_icon, x, GTK_ICON_LOOKUP_USE_BUILTIN); | |
223 | + mime_icon_pixbuf = gtk_icon_info_load_icon (icon_info, NULL); | |
224 | + gtk_icon_info_free (icon_info); | |
225 | + | |
226 | gtk_tree_store_append (GTK_TREE_STORE (model), iter, parent); | |
227 | ||
228 | humansize = xfburn_humanreadable_filesize (s.st_size); | |
229 | ||
230 | -#ifdef HAVE_THUNAR_VFS | |
231 | gtk_tree_store_set (GTK_TREE_STORE (model), iter, | |
232 | - DATA_COMPOSITION_COLUMN_ICON, (G_IS_OBJECT (mime_icon) ? mime_icon : icon_file), | |
233 | + DATA_COMPOSITION_COLUMN_ICON, (G_IS_OBJECT (mime_icon_pixbuf) ? mime_icon_pixbuf : icon_file), | |
234 | DATA_COMPOSITION_COLUMN_CONTENT, name, | |
235 | DATA_COMPOSITION_COLUMN_HUMANSIZE, humansize, | |
236 | DATA_COMPOSITION_COLUMN_SIZE, (guint64) s.st_size, | |
237 | DATA_COMPOSITION_COLUMN_PATH, path, | |
238 | DATA_COMPOSITION_COLUMN_TYPE, DATA_COMPOSITION_TYPE_FILE, -1); | |
239 | -#else | |
240 | - gtk_tree_store_set (GTK_TREE_STORE (model), iter, | |
241 | - DATA_COMPOSITION_COLUMN_ICON, icon_file, | |
242 | - DATA_COMPOSITION_COLUMN_CONTENT, name, | |
243 | - DATA_COMPOSITION_COLUMN_HUMANSIZE, humansize, | |
244 | - DATA_COMPOSITION_COLUMN_SIZE, (guint64) s.st_size, | |
245 | - DATA_COMPOSITION_COLUMN_PATH, path, | |
246 | - DATA_COMPOSITION_COLUMN_TYPE, DATA_COMPOSITION_TYPE_FILE, -1); | |
247 | -#endif | |
248 | ||
249 | xfburn_disc_usage_add_size (XFBURN_DISC_USAGE (priv->disc_usage), s.st_size); | |
250 | -#ifdef HAVE_THUNAR_VFS | |
251 | + | |
252 | + g_object_unref (mime_icon); | |
253 | if (G_LIKELY (G_IS_OBJECT (mime_icon))) | |
254 | g_object_unref (mime_icon); | |
255 | - thunar_vfs_mime_info_unref (mime_info); | |
256 | - g_object_unref (mime_database); | |
257 | + if (G_LIKELY (G_IS_OBJECT (file))) | |
258 | + g_object_unref(file); | |
259 | gdk_threads_leave (); | |
260 | -#endif | |
261 | } | |
262 | g_free (humansize); | |
263 | g_free (parent); | |
264 | @@ -1672,37 +1658,28 @@ | |
265 | ||
266 | for (i=0; files[i] != NULL && files[i][0] != '\0'; i++) { | |
267 | gchar *full_path; | |
268 | + GFile *vfs_path; | |
269 | ||
270 | -#ifdef HAVE_THUNAR_VFS | |
271 | - ThunarVfsPath *vfs_path; | |
272 | - GError *vfs_error = NULL; | |
273 | - | |
274 | - vfs_path = thunar_vfs_path_new (files[i], &vfs_error); | |
275 | - | |
276 | - if (vfs_error) { | |
277 | - g_warning ("Failed to create vfs path for '%s': %s", files[i], vfs_error->message); | |
278 | - g_error_free (vfs_error); | |
279 | + vfs_path = g_file_new_for_path (files[i]); | |
280 | + if (vfs_path == NULL) { | |
281 | + g_warning ("Failed to create vfs path for '%s'", files[i]); | |
282 | continue; | |
283 | } | |
284 | ||
285 | - if (thunar_vfs_path_get_scheme (vfs_path) != THUNAR_VFS_PATH_SCHEME_FILE) | |
286 | - continue; | |
287 | - full_path = thunar_vfs_path_dup_string (vfs_path); | |
288 | + /* unable to handle non-local files */ | |
289 | + if (G_UNLIKELY (!g_file_has_uri_scheme (vfs_path, "file"))) { | |
290 | + g_object_unref (vfs_path); | |
291 | + continue; | |
292 | + } | |
293 | ||
294 | - thunar_vfs_path_unref (vfs_path); | |
295 | + full_path = g_file_get_path (vfs_path); | |
296 | ||
297 | -#else /* no thunar-vfs */ | |
298 | + /* if there is no local path, use the URI (which always works) */ | |
299 | + if (full_path == NULL) | |
300 | + full_path = g_file_get_uri (vfs_path); | |
301 | ||
302 | - if (g_str_has_prefix (files[i], "file://")) | |
303 | - full_path = g_build_filename (&files[i][7], NULL); | |
304 | - else if (g_str_has_prefix (files[i], "file:")) | |
305 | - full_path = g_build_filename (&files[i][5], NULL); | |
306 | - else | |
307 | - full_path = g_build_filename (files[i], NULL); | |
308 | - | |
309 | - if (full_path[strlen (full_path) - 1] == '\r') | |
310 | - full_path[strlen (full_path) - 1] = '\0'; | |
311 | -#endif | |
312 | + /* release the location */ | |
313 | + g_object_unref (vfs_path); | |
314 | ||
315 | DBG ("Adding path '%s'", full_path); | |
316 | ||
317 | @@ -1731,26 +1708,45 @@ | |
318 | gtk_drag_finish (dc, TRUE, FALSE, t); | |
319 | } | |
320 | else if (sd->target == gdk_atom_intern ("text/uri-list", FALSE)) { | |
321 | -#ifdef HAVE_THUNAR_VFS | |
322 | GList *vfs_paths = NULL; | |
323 | GList *vfs_path; | |
324 | - GError *error = NULL; | |
325 | + GList *lp; | |
326 | gchar *full_path; | |
327 | + gchar **uris; | |
328 | + gsize n; | |
329 | + | |
330 | + uris = g_uri_list_extract_uris ((gchar *) sd->data); | |
331 | + | |
332 | + for (n = 0; uris != NULL && uris[n] != NULL; ++n) | |
333 | + vfs_paths = g_list_append (vfs_paths, g_file_new_for_uri (uris[n])); | |
334 | ||
335 | - vfs_paths = thunar_vfs_path_list_from_string ((gchar *) sd->data, &error); | |
336 | + g_strfreev (uris); | |
337 | ||
338 | if (G_LIKELY (vfs_paths != NULL)) { | |
339 | ThreadAddFilesDragParams *params; | |
340 | priv->full_paths_to_add = NULL; | |
341 | for (vfs_path = vfs_paths; vfs_path != NULL; vfs_path = g_list_next (vfs_path)) { | |
342 | - ThunarVfsPath *path = THUNAR_VFS_PATH (vfs_path->data); | |
343 | - if (thunar_vfs_path_get_scheme (path) != THUNAR_VFS_PATH_SCHEME_FILE) | |
344 | + GFile *path = g_file_new_for_path (vfs_path->data); | |
345 | + if (path == NULL) | |
346 | continue; | |
347 | - full_path = thunar_vfs_path_dup_string (path); | |
348 | + /* unable to handle non-local files */ | |
349 | + if (G_UNLIKELY (!g_file_has_uri_scheme (path, "file"))) { | |
350 | + g_object_unref (path); | |
351 | + continue; | |
352 | + } | |
353 | + full_path = g_file_get_path (path); | |
354 | + /* if there is no local path, use the URI (which always works) */ | |
355 | + if (full_path == NULL) | |
356 | + full_path = g_file_get_uri (path); | |
357 | + /* release the location */ | |
358 | g_debug ("adding uri path: %s", full_path); | |
359 | + g_object_unref (path); | |
360 | priv->full_paths_to_add = g_list_prepend (priv->full_paths_to_add, full_path); | |
361 | } | |
362 | - thunar_vfs_path_list_free (vfs_paths); | |
363 | + | |
364 | + for (lp = vfs_paths; lp != NULL; lp = lp->next) | |
365 | + g_object_unref (lp->data); | |
366 | + g_list_free (vfs_paths); | |
367 | ||
368 | priv->full_paths_to_add = g_list_reverse (priv->full_paths_to_add); | |
369 | /* FIXME: path_where_insert is always NULL here */ | |
370 | @@ -1769,18 +1765,10 @@ | |
371 | ||
372 | gtk_drag_finish (dc, TRUE, FALSE, t); | |
373 | } else { | |
374 | - if (G_UNLIKELY (error != NULL)) | |
375 | - g_warning ("text/uri-list drag failed because '%s'", error->message); | |
376 | - else | |
377 | - g_warning("There were no files in the uri list!"); | |
378 | + g_warning("There were no files in the uri list!"); | |
379 | gtk_drag_finish (dc, FALSE, FALSE, t); | |
380 | xfburn_default_cursor (priv->content); | |
381 | } | |
382 | -#else | |
383 | - g_warning ("Receiving this type of drag and drop requires thunar-vfs support, sorry!"); | |
384 | - gtk_drag_finish (dc, FALSE, FALSE, t); | |
385 | - xfburn_default_cursor (priv->content); | |
386 | -#endif | |
387 | } | |
388 | else { | |
389 | g_warning ("Trying to receive an unsupported drag target, this should not happen."); | |
390 | diff -ur xfburn-0.4.3/xfburn/xfburn-device-box.c xfburn-0.4.3-gio/xfburn/xfburn-device-box.c | |
391 | --- xfburn-0.4.3/xfburn/xfburn-device-box.c 2009-10-30 01:48:01.000000000 +0100 | |
392 | +++ xfburn-0.4.3-gio/xfburn/xfburn-device-box.c 2011-02-23 19:38:47.129911724 +0100 | |
393 | @@ -25,10 +25,6 @@ | |
394 | #include <libxfce4util/libxfce4util.h> | |
395 | #include <libxfcegui4/libxfcegui4.h> | |
396 | ||
397 | -#ifdef HAVE_THUNAR_VFS | |
398 | -#include <thunar-vfs/thunar-vfs.h> | |
399 | -#endif | |
400 | - | |
401 | #include "xfburn-device-list.h" | |
402 | #include "xfburn-device-box.h" | |
403 | #include "xfburn-settings.h" | |
404 | diff -ur xfburn-0.4.3/xfburn/xfburn-directory-browser.c xfburn-0.4.3-gio/xfburn/xfburn-directory-browser.c | |
405 | --- xfburn-0.4.3/xfburn/xfburn-directory-browser.c 2009-10-24 23:18:10.000000000 +0200 | |
406 | +++ xfburn-0.4.3-gio/xfburn/xfburn-directory-browser.c 2011-02-24 12:09:31.490336444 +0100 | |
407 | @@ -28,9 +28,7 @@ | |
408 | #include <libxfce4util/libxfce4util.h> | |
409 | #include <libxfcegui4/libxfcegui4.h> | |
410 | ||
411 | -#ifdef HAVE_THUNAR_VFS | |
412 | -#include <thunar-vfs/thunar-vfs.h> | |
413 | -#endif | |
414 | +#include <gio/gio.h> | |
415 | ||
416 | #include <exo/exo.h> | |
417 | ||
418 | @@ -315,44 +313,35 @@ | |
419 | } | |
420 | else if ((s.st_mode & S_IFREG)) { | |
421 | GtkTreeIter iter; | |
422 | -#ifdef HAVE_THUNAR_VFS | |
423 | - ThunarVfsMimeDatabase *mime_database = NULL; | |
424 | - ThunarVfsMimeInfo *mime_info = NULL; | |
425 | - const gchar *mime_icon_name = NULL; | |
426 | - GdkPixbuf *mime_icon = NULL; | |
427 | - const gchar *mime_str = NULL; | |
428 | -#endif | |
429 | - | |
430 | + GFileInfo *mime_info = NULL; | |
431 | + GIcon *mime_icon = NULL; | |
432 | + GdkPixbuf *mime_icon_pixbuf = NULL; | |
433 | + const gchar *mime_str = NULL; | |
434 | + GFile *file = NULL; | |
435 | + const gchar *content_type = NULL; | |
436 | + | |
437 | gtk_list_store_append (GTK_LIST_STORE (model), &iter); | |
438 | - | |
439 | -#ifdef HAVE_THUNAR_VFS | |
440 | - mime_database = thunar_vfs_mime_database_get_default (); | |
441 | - mime_info = thunar_vfs_mime_database_get_info_for_file (mime_database, path_utf8, NULL); | |
442 | - | |
443 | - mime_icon_name = thunar_vfs_mime_info_lookup_icon_name (mime_info, icon_theme); | |
444 | - mime_icon = gtk_icon_theme_load_icon (icon_theme, mime_icon_name, x, 0, NULL); | |
445 | - | |
446 | - mime_str = thunar_vfs_mime_info_get_comment (mime_info); | |
447 | - | |
448 | + | |
449 | + file = g_file_new_for_path(path_utf8); | |
450 | + mime_info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL); | |
451 | + content_type = g_file_info_get_content_type (mime_info); | |
452 | + mime_icon = g_content_type_get_icon (content_type); | |
453 | + if (mime_icon != NULL) { | |
454 | + GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon (icon_theme, mime_icon, x, GTK_ICON_LOOKUP_USE_BUILTIN); | |
455 | + if (icon_info != NULL) { | |
456 | + mime_icon_pixbuf = gtk_icon_info_load_icon (icon_info, NULL); | |
457 | + gtk_icon_info_free (icon_info); | |
458 | + mime_str = g_content_type_get_description (content_type); | |
459 | gtk_list_store_set (GTK_LIST_STORE (model), &iter, | |
460 | - DIRECTORY_BROWSER_COLUMN_ICON, (G_IS_OBJECT (mime_icon) ? mime_icon : icon_file), | |
461 | + DIRECTORY_BROWSER_COLUMN_ICON, (G_IS_OBJECT (mime_icon_pixbuf) ? mime_icon_pixbuf : icon_file), | |
462 | DIRECTORY_BROWSER_COLUMN_FILE, dir_entry, | |
463 | DIRECTORY_BROWSER_COLUMN_HUMANSIZE, humansize, | |
464 | DIRECTORY_BROWSER_COLUMN_SIZE, (guint64) s.st_size, | |
465 | DIRECTORY_BROWSER_COLUMN_TYPE, mime_str, DIRECTORY_BROWSER_COLUMN_PATH, path_utf8, -1); | |
466 | - | |
467 | - if (G_LIKELY (G_IS_OBJECT (mime_icon))) | |
468 | - g_object_unref (mime_icon); | |
469 | - thunar_vfs_mime_info_unref (mime_info); | |
470 | - g_object_unref (mime_database); | |
471 | -#else | |
472 | - gtk_list_store_set (GTK_LIST_STORE (model), &iter, | |
473 | - DIRECTORY_BROWSER_COLUMN_ICON, icon_file, | |
474 | - DIRECTORY_BROWSER_COLUMN_FILE, dir_entry, | |
475 | - DIRECTORY_BROWSER_COLUMN_HUMANSIZE, humansize, | |
476 | - DIRECTORY_BROWSER_COLUMN_SIZE, (guint64) s.st_size, | |
477 | - DIRECTORY_BROWSER_COLUMN_TYPE, _("File"), DIRECTORY_BROWSER_COLUMN_PATH, path_utf8, -1); | |
478 | -#endif | |
479 | + } | |
480 | + g_object_unref (mime_icon); | |
481 | + } | |
482 | + g_object_unref(file); | |
483 | } | |
484 | g_free (humansize); | |
485 | g_free (path_utf8); | |
486 | diff -ur xfburn-0.4.3/xfburn/xfburn-main.c xfburn-0.4.3-gio/xfburn/xfburn-main.c | |
487 | --- xfburn-0.4.3/xfburn/xfburn-main.c 2009-10-31 23:15:01.000000000 +0100 | |
488 | +++ xfburn-0.4.3-gio/xfburn/xfburn-main.c 2011-02-23 19:41:09.739911724 +0100 | |
489 | @@ -31,10 +31,6 @@ | |
490 | #include <libxfce4util/libxfce4util.h> | |
491 | #include <libxfcegui4/libxfcegui4.h> | |
492 | ||
493 | -#ifdef HAVE_THUNAR_VFS | |
494 | -#include <thunar-vfs/thunar-vfs.h> | |
495 | -#endif | |
496 | - | |
497 | #ifdef HAVE_GST | |
498 | #include <gst/gst.h> | |
499 | #endif | |
500 | @@ -275,20 +271,10 @@ | |
501 | ||
502 | xfburn_settings_init (); | |
503 | ||
504 | -#ifdef HAVE_THUNAR_VFS | |
505 | - thunar_vfs_init (); | |
506 | - g_message ("Using Thunar-VFS %d.%d.%d", THUNAR_VFS_MAJOR_VERSION, THUNAR_VFS_MINOR_VERSION, THUNAR_VFS_MICRO_VERSION); | |
507 | -#else | |
508 | - g_message ("Thunar-VFS not available, using default implementation"); | |
509 | -#endif | |
510 | - | |
511 | #ifdef HAVE_HAL | |
512 | error_msg = xfburn_hal_manager_create_global (); | |
513 | if (error_msg) { | |
514 | xfce_err (error_msg); | |
515 | -#ifdef HAVE_THUNAR_VFS | |
516 | - thunar_vfs_shutdown (); | |
517 | -#endif | |
518 | gdk_threads_leave (); | |
519 | burn_finish (); | |
520 | return EXIT_FAILURE; | |
521 | @@ -417,10 +403,6 @@ | |
522 | xfburn_hal_manager_shutdown (); | |
523 | #endif | |
524 | ||
525 | -#ifdef HAVE_THUNAR_VFS | |
526 | - thunar_vfs_shutdown (); | |
527 | -#endif | |
528 | - | |
529 | xfburn_settings_flush (); | |
530 | xfburn_settings_free (); | |
531 |