1 |
leio 08/03/23 00:25:58 |
2 |
|
3 |
Added: |
4 |
libgnomeui-2.22.01-fix-thumbnailing-over-gvfs-mounts.patch |
5 |
Log: |
6 |
New version for GNOME-2.22. Adds a GIO filechooser backend until gtk+-2.14 itself does it for GNOME-2.24 in the future. Other bug fixes |
7 |
(Portage version: 2.1.4.4) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 gnome-base/libgnomeui/files/libgnomeui-2.22.01-fix-thumbnailing-over-gvfs-mounts.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/gnome-base/libgnomeui/files/libgnomeui-2.22.01-fix-thumbnailing-over-gvfs-mounts.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/gnome-base/libgnomeui/files/libgnomeui-2.22.01-fix-thumbnailing-over-gvfs-mounts.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: libgnomeui-2.22.01-fix-thumbnailing-over-gvfs-mounts.patch |
16 |
=================================================================== |
17 |
--- trunk/configure.in 2008/03/12 08:37:37 5583 |
18 |
+++ trunk/configure.in 2008/03/16 09:31:58 5584 |
19 |
@@ -205,6 +206,7 @@ |
20 |
gconf-2.0 >= gconf_required_version dnl |
21 |
pango >= pango_required_version dnl |
22 |
glib-2.0 >= glib_required_version |
23 |
+ gio-2.0 >= gio_required_version |
24 |
gnome-vfs-2.0 >= gnomevfs_required_version dnl |
25 |
$gnome_keyring_requirement" |
26 |
PKG_CHECK_MODULES(LIBGNOMEUI, [$GNOMEUI_MODULES]) |
27 |
--- trunk/configure 2008-03-23 02:13:17.000000000 +0200 |
28 |
+++ trunk/configure 2008-03-23 02:13:24.000000000 +0200 |
29 |
@@ -28507,6 +28507,7 @@ |
30 |
|
31 |
|
32 |
GNOMEUI_MODULES=" libxml-2.0 >= 2.4.20 libgnome-2.0 >= 2.13.7 libgnomecanvas-2.0 >= 2.0.0 libbonoboui-2.0 >= 2.13.1 gconf-2.0 >= 1.1.11 pango >= 1.1.2 glib-2.0 >= 2.15.0 |
33 |
+ gio-2.0 >= 2.15.2 |
34 |
gnome-vfs-2.0 >= 2.7.3 $gnome_keyring_requirement" |
35 |
|
36 |
pkg_failed=no |
37 |
--- trunk/libgnomeui/gnome-vfs-util.c 2008/03/12 08:37:37 5583 |
38 |
+++ trunk/libgnomeui/gnome-vfs-util.c 2008/03/16 09:31:58 5584 |
39 |
@@ -26,6 +26,7 @@ |
40 |
#include <stdio.h> |
41 |
#include <string.h> |
42 |
#include <glib-object.h> |
43 |
+#include <gio/gio.h> |
44 |
|
45 |
#include "gnome-vfs-util.h" |
46 |
|
47 |
@@ -48,7 +49,10 @@ |
48 |
#define LOAD_BUFFER_SIZE 4096 |
49 |
|
50 |
struct GnomeGdkPixbufAsyncHandle { |
51 |
- GnomeVFSAsyncHandle *vfs_handle; |
52 |
+ GFile *file; |
53 |
+ GFileInputStream *file_input_stream; |
54 |
+ GCancellable *cancellable; |
55 |
+ |
56 |
GnomeGdkPixbufLoadCallback load_callback; |
57 |
GnomeGdkPixbufDoneCallback done_callback; |
58 |
gpointer callback_data; |
59 |
@@ -65,18 +69,12 @@ |
60 |
} SizePrepareContext; |
61 |
|
62 |
|
63 |
-static void file_opened_callback (GnomeVFSAsyncHandle *vfs_handle, |
64 |
- GnomeVFSResult result, |
65 |
- gpointer callback_data); |
66 |
-static void file_read_callback (GnomeVFSAsyncHandle *vfs_handle, |
67 |
- GnomeVFSResult result, |
68 |
- gpointer buffer, |
69 |
- GnomeVFSFileSize bytes_requested, |
70 |
- GnomeVFSFileSize bytes_read, |
71 |
- gpointer callback_data); |
72 |
-static void file_closed_callback (GnomeVFSAsyncHandle *handle, |
73 |
- GnomeVFSResult result, |
74 |
- gpointer callback_data); |
75 |
+static void input_stream_read_callback (GObject *source_object, |
76 |
+ GAsyncResult *res, |
77 |
+ gpointer user_data); |
78 |
+static void input_stream_ready_callback (GObject *source_object, |
79 |
+ GAsyncResult *res, |
80 |
+ gpointer user_data); |
81 |
static void load_done (GnomeGdkPixbufAsyncHandle *handle, |
82 |
GnomeVFSResult result, |
83 |
GdkPixbuf *pixbuf); |
84 |
@@ -165,7 +163,6 @@ |
85 |
gboolean preserve_aspect_ratio) |
86 |
{ |
87 |
GnomeVFSResult result; |
88 |
- GnomeVFSHandle *handle; |
89 |
char buffer[LOAD_BUFFER_SIZE]; |
90 |
GnomeVFSFileSize bytes_read; |
91 |
GdkPixbufLoader *loader; |
92 |
@@ -174,13 +171,15 @@ |
93 |
GdkPixbufAnimationIter *iter; |
94 |
gboolean has_frame; |
95 |
SizePrepareContext info; |
96 |
+ GFile *file; |
97 |
+ GFileInputStream *file_input_stream; |
98 |
|
99 |
g_return_val_if_fail (uri != NULL, NULL); |
100 |
|
101 |
- result = gnome_vfs_open (&handle, |
102 |
- uri, |
103 |
- GNOME_VFS_OPEN_READ); |
104 |
- if (result != GNOME_VFS_OK) { |
105 |
+ file = g_file_new_for_uri (uri); |
106 |
+ file_input_stream = g_file_read (file, NULL, NULL); |
107 |
+ if (file_input_stream == NULL) { |
108 |
+ g_object_unref (file); |
109 |
return NULL; |
110 |
} |
111 |
|
112 |
@@ -195,17 +194,22 @@ |
113 |
|
114 |
has_frame = FALSE; |
115 |
|
116 |
+ result = GNOME_VFS_ERROR_GENERIC; |
117 |
while (!has_frame) { |
118 |
- result = gnome_vfs_read (handle, |
119 |
- buffer, |
120 |
- sizeof (buffer), |
121 |
- &bytes_read); |
122 |
- if (result != GNOME_VFS_OK) { |
123 |
+ |
124 |
+ bytes_read = g_input_stream_read (G_INPUT_STREAM (file_input_stream), |
125 |
+ buffer, |
126 |
+ sizeof (buffer), |
127 |
+ NULL, |
128 |
+ NULL); |
129 |
+ if (bytes_read == -1) { |
130 |
break; |
131 |
} |
132 |
+ result = GNOME_VFS_OK; |
133 |
if (bytes_read == 0) { |
134 |
break; |
135 |
} |
136 |
+ |
137 |
if (!gdk_pixbuf_loader_write (loader, |
138 |
(unsigned char *)buffer, |
139 |
bytes_read, |
140 |
@@ -226,13 +230,17 @@ |
141 |
|
142 |
gdk_pixbuf_loader_close (loader, NULL); |
143 |
|
144 |
- if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) { |
145 |
+ if (result != GNOME_VFS_OK) { |
146 |
g_object_unref (G_OBJECT (loader)); |
147 |
- gnome_vfs_close (handle); |
148 |
+ g_input_stream_close (G_INPUT_STREAM (file_input_stream), NULL, NULL); |
149 |
+ g_object_unref (file_input_stream); |
150 |
+ g_object_unref (file); |
151 |
return NULL; |
152 |
} |
153 |
|
154 |
- gnome_vfs_close (handle); |
155 |
+ g_input_stream_close (G_INPUT_STREAM (file_input_stream), NULL, NULL); |
156 |
+ g_object_unref (file_input_stream); |
157 |
+ g_object_unref (file); |
158 |
|
159 |
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); |
160 |
if (pixbuf != NULL) { |
161 |
@@ -260,101 +268,89 @@ |
162 |
handle->done_callback = done_callback; |
163 |
handle->callback_data = callback_data; |
164 |
|
165 |
- gnome_vfs_async_open (&handle->vfs_handle, |
166 |
- uri, |
167 |
- GNOME_VFS_OPEN_READ, |
168 |
- GNOME_VFS_PRIORITY_DEFAULT, |
169 |
- file_opened_callback, |
170 |
- handle); |
171 |
- |
172 |
+ handle->file = g_file_new_for_uri (uri); |
173 |
+ handle->cancellable = g_cancellable_new (); |
174 |
+ g_file_read_async (handle->file, |
175 |
+ G_PRIORITY_DEFAULT, |
176 |
+ handle->cancellable, |
177 |
+ input_stream_ready_callback, |
178 |
+ handle); |
179 |
return handle; |
180 |
} |
181 |
|
182 |
-static void |
183 |
-file_opened_callback (GnomeVFSAsyncHandle *vfs_handle, |
184 |
- GnomeVFSResult result, |
185 |
- gpointer callback_data) |
186 |
+static void |
187 |
+input_stream_ready_callback (GObject *source_object, |
188 |
+ GAsyncResult *res, |
189 |
+ gpointer user_data) |
190 |
{ |
191 |
- GnomeGdkPixbufAsyncHandle *handle; |
192 |
+ GError *error = NULL; |
193 |
+ GnomeGdkPixbufAsyncHandle *handle = user_data; |
194 |
|
195 |
- handle = callback_data; |
196 |
- g_assert (handle->vfs_handle == vfs_handle); |
197 |
- |
198 |
- if (result != GNOME_VFS_OK) { |
199 |
- load_done (handle, result, NULL); |
200 |
+ handle->file_input_stream = g_file_read_finish (G_FILE (source_object), |
201 |
+ res, NULL); |
202 |
+ if (handle->file_input_stream == NULL) { |
203 |
+ /* TODO: could map the GError more precisely to the GnomeVFSError */ |
204 |
+ load_done (handle, GNOME_VFS_ERROR_GENERIC, NULL); |
205 |
return; |
206 |
} |
207 |
|
208 |
handle->loader = gdk_pixbuf_loader_new (); |
209 |
|
210 |
- gnome_vfs_async_read (handle->vfs_handle, |
211 |
- handle->buffer, |
212 |
- sizeof (handle->buffer), |
213 |
- file_read_callback, |
214 |
- handle); |
215 |
+ g_input_stream_read_async (G_INPUT_STREAM (handle->file_input_stream), |
216 |
+ handle->buffer, |
217 |
+ sizeof (handle->buffer), |
218 |
+ G_PRIORITY_DEFAULT, |
219 |
+ handle->cancellable, |
220 |
+ input_stream_read_callback, |
221 |
+ handle); |
222 |
} |
223 |
|
224 |
-static void |
225 |
-file_read_callback (GnomeVFSAsyncHandle *vfs_handle, |
226 |
- GnomeVFSResult result, |
227 |
- gpointer buffer, |
228 |
- GnomeVFSFileSize bytes_requested, |
229 |
- GnomeVFSFileSize bytes_read, |
230 |
- gpointer callback_data) |
231 |
+static void |
232 |
+input_stream_read_callback (GObject *source_object, |
233 |
+ GAsyncResult *res, |
234 |
+ gpointer user_data) |
235 |
{ |
236 |
- GnomeGdkPixbufAsyncHandle *handle; |
237 |
- |
238 |
- handle = callback_data; |
239 |
- g_assert (handle->vfs_handle == vfs_handle); |
240 |
- g_assert (handle->buffer == buffer); |
241 |
+ GnomeGdkPixbufAsyncHandle *handle = user_data; |
242 |
+ gssize bytes_read; |
243 |
+ GnomeVFSResult result; |
244 |
|
245 |
- if (result == GNOME_VFS_OK && bytes_read != 0) { |
246 |
+ bytes_read = g_input_stream_read_finish (G_INPUT_STREAM (source_object), |
247 |
+ res, NULL); |
248 |
+ if (bytes_read == -1) { |
249 |
+ /* TODO: could map the GError more precisely */ |
250 |
+ result = GNOME_VFS_ERROR_GENERIC; |
251 |
+ } else if (bytes_read > 0) { |
252 |
if (!gdk_pixbuf_loader_write (handle->loader, |
253 |
- buffer, |
254 |
+ (const guchar *) handle->buffer, |
255 |
bytes_read, |
256 |
NULL)) { |
257 |
result = GNOME_VFS_ERROR_WRONG_FORMAT; |
258 |
+ } else { |
259 |
+ /* read more */ |
260 |
+ g_input_stream_read_async (G_INPUT_STREAM (handle->file_input_stream), |
261 |
+ handle->buffer, |
262 |
+ sizeof (handle->buffer), |
263 |
+ G_PRIORITY_DEFAULT, |
264 |
+ handle->cancellable, |
265 |
+ input_stream_read_callback, |
266 |
+ handle); |
267 |
+ return; |
268 |
} |
269 |
- gnome_vfs_async_read (handle->vfs_handle, |
270 |
- handle->buffer, |
271 |
- sizeof (handle->buffer), |
272 |
- file_read_callback, |
273 |
- handle); |
274 |
- return; |
275 |
+ } else { |
276 |
+ /* EOF */ |
277 |
+ result = GNOME_VFS_OK; |
278 |
} |
279 |
|
280 |
- switch (result) { |
281 |
- case GNOME_VFS_OK: |
282 |
- if (bytes_read == 0) { |
283 |
- GdkPixbuf *pixbuf; |
284 |
- |
285 |
- pixbuf = gdk_pixbuf_loader_get_pixbuf (handle->loader); |
286 |
- load_done (handle, result, pixbuf); |
287 |
- } |
288 |
- break; |
289 |
- case GNOME_VFS_ERROR_EOF: |
290 |
- { |
291 |
- GdkPixbuf *pixbuf; |
292 |
- |
293 |
- pixbuf = gdk_pixbuf_loader_get_pixbuf (handle->loader); |
294 |
- load_done (handle, pixbuf ? GNOME_VFS_OK : result, pixbuf); |
295 |
- } |
296 |
- break; |
297 |
- default: |
298 |
+ if (result == GNOME_VFS_OK) { |
299 |
+ GdkPixbuf *pixbuf; |
300 |
+ pixbuf = gdk_pixbuf_loader_get_pixbuf (handle->loader); |
301 |
+ load_done (handle, result, pixbuf); |
302 |
+ } else { |
303 |
load_done (handle, result, NULL); |
304 |
- break; |
305 |
} |
306 |
} |
307 |
|
308 |
static void |
309 |
-file_closed_callback (GnomeVFSAsyncHandle *handle, |
310 |
- GnomeVFSResult result, |
311 |
- gpointer callback_data) |
312 |
-{ |
313 |
- g_assert (callback_data == NULL); |
314 |
-} |
315 |
- |
316 |
-static void |
317 |
free_pixbuf_load_handle (GnomeGdkPixbufAsyncHandle *handle) |
318 |
{ |
319 |
if (handle->done_callback) |
320 |
@@ -363,6 +359,17 @@ |
321 |
gdk_pixbuf_loader_close (handle->loader, NULL); |
322 |
g_object_unref (G_OBJECT (handle->loader)); |
323 |
} |
324 |
+ if (handle->file_input_stream != NULL) { |
325 |
+ g_input_stream_close (G_INPUT_STREAM (handle->file_input_stream), NULL, NULL); |
326 |
+ g_object_unref (handle->file_input_stream); |
327 |
+ } |
328 |
+ if (handle->file != NULL) { |
329 |
+ g_object_unref (handle->file); |
330 |
+ } |
331 |
+ if (handle->cancellable != NULL) { |
332 |
+ g_object_unref (handle->cancellable); |
333 |
+ } |
334 |
+ |
335 |
g_free (handle); |
336 |
} |
337 |
|
338 |
@@ -371,12 +378,6 @@ |
339 |
GnomeVFSResult result, |
340 |
GdkPixbuf *pixbuf) |
341 |
{ |
342 |
- if (handle->vfs_handle != NULL) { |
343 |
- if (result != GNOME_VFS_OK) |
344 |
- gnome_vfs_async_cancel (handle->vfs_handle); |
345 |
- else |
346 |
- gnome_vfs_async_close (handle->vfs_handle, file_closed_callback, NULL); |
347 |
- } |
348 |
(* handle->load_callback) (handle, result, pixbuf, handle->callback_data); |
349 |
free_pixbuf_load_handle (handle); |
350 |
} |
351 |
@@ -387,8 +388,8 @@ |
352 |
if (handle == NULL) { |
353 |
return; |
354 |
} |
355 |
- if (handle->vfs_handle != NULL) { |
356 |
- gnome_vfs_async_cancel (handle->vfs_handle); |
357 |
+ if (handle->cancellable != NULL) { |
358 |
+ g_cancellable_cancel (handle->cancellable); |
359 |
} |
360 |
free_pixbuf_load_handle (handle); |
361 |
} |
362 |
|
363 |
|
364 |
|
365 |
-- |
366 |
gentoo-commits@l.g.o mailing list |