1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ |
---|
2 | |
---|
3 | /* gnome-vfs-backend.c - Handling of asynchronocity backends in the GNOME |
---|
4 | Virtual File System. |
---|
5 | |
---|
6 | Copyright (C) 2000 Red Hat, Inc. |
---|
7 | Copyright (C) 2000 Eazel, Inc. |
---|
8 | All rights reserved. |
---|
9 | |
---|
10 | The Gnome Library is free software; you can redistribute it and/or |
---|
11 | modify it under the terms of the GNU Library General Public License as |
---|
12 | published by the Free Software Foundation; either version 2 of the |
---|
13 | License, or (at your option) any later version. |
---|
14 | |
---|
15 | The Gnome Library is distributed in the hope that it will be useful, |
---|
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
18 | Library General Public License for more details. |
---|
19 | |
---|
20 | You should have received a copy of the GNU Library General Public |
---|
21 | License along with the Gnome Library; see the file COPYING.LIB. If not, |
---|
22 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
23 | Boston, MA 02111-1307, USA. |
---|
24 | |
---|
25 | Author: Elliot Lee <sopwith@redhat.com> |
---|
26 | */ |
---|
27 | |
---|
28 | #include <config.h> |
---|
29 | #include "gnome-vfs-backend.h" |
---|
30 | |
---|
31 | #include "gnome-vfs-backend-private.h" |
---|
32 | #include "gnome-vfs-module-callback.h" |
---|
33 | #include "gnome-vfs.h" |
---|
34 | #include <gmodule.h> |
---|
35 | #include <stdlib.h> |
---|
36 | #include <string.h> |
---|
37 | #include <unistd.h> |
---|
38 | |
---|
39 | static GModule *gmod = NULL; |
---|
40 | static gboolean (* gnome_vfs_backend_module_init)(gboolean deps_init); |
---|
41 | |
---|
42 | static char *backend_lower; |
---|
43 | |
---|
44 | const char * |
---|
45 | gnome_vfs_backend_name (void) |
---|
46 | { |
---|
47 | return (*backend_lower) ? backend_lower : NULL; |
---|
48 | } |
---|
49 | |
---|
50 | void |
---|
51 | gnome_vfs_backend_loadinit (gpointer app, gpointer modinfo) |
---|
52 | { |
---|
53 | const char *backend; |
---|
54 | char *short_name, *backend_filename, *init_func; |
---|
55 | |
---|
56 | /* Decide which backend module to load, based on |
---|
57 | (a) environment variable |
---|
58 | (b) default |
---|
59 | */ |
---|
60 | if (gmod != NULL) { |
---|
61 | return; |
---|
62 | } |
---|
63 | |
---|
64 | backend = getenv ("GNOME_VFS_BACKEND"); |
---|
65 | if (backend == NULL) { |
---|
66 | backend = "pthread"; |
---|
67 | } |
---|
68 | |
---|
69 | backend_lower = g_strdup (backend); |
---|
70 | g_strdown (backend_lower); |
---|
71 | |
---|
72 | short_name = g_strdup_printf ("gnomevfs-%s", backend); |
---|
73 | backend_filename = g_module_build_path (NULL, short_name); |
---|
74 | |
---|
75 | gmod = g_module_open (backend_filename, G_MODULE_BIND_LAZY); |
---|
76 | if (gmod == NULL) { |
---|
77 | g_error("Could not open %s: %s", backend_filename, g_module_error()); |
---|
78 | } |
---|
79 | g_free (backend_filename); |
---|
80 | |
---|
81 | init_func = g_strdup_printf ("gnome_vfs_%s_init", backend_lower); |
---|
82 | if (!g_module_symbol (gmod, init_func, |
---|
83 | (gpointer *)&gnome_vfs_backend_module_init)) { |
---|
84 | g_module_close (gmod); |
---|
85 | gmod = NULL; |
---|
86 | g_error("Could not locate module initialization function: %s", g_module_error()); |
---|
87 | } |
---|
88 | g_free (init_func); |
---|
89 | |
---|
90 | } |
---|
91 | |
---|
92 | gboolean |
---|
93 | gnome_vfs_backend_init (gboolean deps_init) |
---|
94 | { |
---|
95 | g_assert (gmod); |
---|
96 | g_assert (gnome_vfs_backend_init); |
---|
97 | |
---|
98 | gnome_vfs_backend_module_init (deps_init); |
---|
99 | |
---|
100 | return TRUE; |
---|
101 | } |
---|
102 | |
---|
103 | void |
---|
104 | gnome_vfs_backend_shutdown (void) |
---|
105 | { |
---|
106 | /* find and call the backend shutdown function */ |
---|
107 | void (* thread_backend_shutdown_call) (void); |
---|
108 | |
---|
109 | g_assert (gmod); |
---|
110 | if (g_module_symbol (gmod, "gnome_vfs_thread_backend_shutdown", |
---|
111 | (gpointer)&thread_backend_shutdown_call)) { |
---|
112 | g_assert (thread_backend_shutdown_call); |
---|
113 | (* thread_backend_shutdown_call) (); |
---|
114 | } |
---|
115 | } |
---|
116 | |
---|
117 | typedef GnomeVFSResult (*GnomeVFSAsyncFunction) (); |
---|
118 | |
---|
119 | static GnomeVFSAsyncFunction |
---|
120 | func_lookup(const char *func_name) |
---|
121 | { |
---|
122 | char *name; |
---|
123 | gpointer function; |
---|
124 | |
---|
125 | name = g_strdup_printf ("%s_%s", backend_lower, func_name); |
---|
126 | |
---|
127 | g_assert (gmod); |
---|
128 | if (!g_module_symbol (gmod, name, &function)) { |
---|
129 | function = NULL; |
---|
130 | } |
---|
131 | |
---|
132 | g_free (name); |
---|
133 | |
---|
134 | return (GnomeVFSAsyncFunction) function; |
---|
135 | } |
---|
136 | |
---|
137 | #define CALL_BACKEND(name, parameters) \ |
---|
138 | G_STMT_START { \ |
---|
139 | if (real_##name == NULL) { \ |
---|
140 | real_##name = (void (*)()) func_lookup (#name); \ |
---|
141 | } \ |
---|
142 | if (real_##name == NULL) { \ |
---|
143 | g_warning ("can't find " #name " in the back end"); \ |
---|
144 | } else { \ |
---|
145 | real_##name parameters; \ |
---|
146 | } \ |
---|
147 | } G_STMT_END |
---|
148 | |
---|
149 | #define CALL_BACKEND_RETURN(name, parameters) \ |
---|
150 | G_STMT_START { \ |
---|
151 | if (real_##name == NULL) { \ |
---|
152 | real_##name = func_lookup (#name); \ |
---|
153 | } \ |
---|
154 | if (real_##name == NULL) { \ |
---|
155 | g_warning ("can't find " #name " in the back end"); \ |
---|
156 | return GNOME_VFS_ERROR_INTERNAL; \ |
---|
157 | } \ |
---|
158 | return real_##name parameters; \ |
---|
159 | } G_STMT_END |
---|
160 | |
---|
161 | void |
---|
162 | gnome_vfs_async_open (GnomeVFSAsyncHandle **handle_return, |
---|
163 | const gchar *text_uri, |
---|
164 | GnomeVFSOpenMode open_mode, |
---|
165 | GnomeVFSAsyncOpenCallback callback, |
---|
166 | gpointer callback_data) |
---|
167 | { |
---|
168 | static void |
---|
169 | (*real_gnome_vfs_async_open) (GnomeVFSAsyncHandle **handle_return, |
---|
170 | const gchar *text_uri, |
---|
171 | GnomeVFSOpenMode open_mode, |
---|
172 | GnomeVFSAsyncOpenCallback callback, |
---|
173 | gpointer callback_data) = NULL; |
---|
174 | |
---|
175 | CALL_BACKEND (gnome_vfs_async_open, |
---|
176 | (handle_return, text_uri, open_mode, callback, callback_data)); |
---|
177 | } |
---|
178 | |
---|
179 | void |
---|
180 | gnome_vfs_async_open_uri (GnomeVFSAsyncHandle **handle_return, |
---|
181 | GnomeVFSURI *uri, |
---|
182 | GnomeVFSOpenMode open_mode, |
---|
183 | GnomeVFSAsyncOpenCallback callback, |
---|
184 | gpointer callback_data) |
---|
185 | { |
---|
186 | static void |
---|
187 | (*real_gnome_vfs_async_open_uri) (GnomeVFSAsyncHandle **handle_return, |
---|
188 | GnomeVFSURI *uri, |
---|
189 | GnomeVFSOpenMode open_mode, |
---|
190 | GnomeVFSAsyncOpenCallback callback, |
---|
191 | gpointer callback_data) = NULL; |
---|
192 | |
---|
193 | CALL_BACKEND (gnome_vfs_async_open_uri, |
---|
194 | (handle_return, uri, open_mode, callback, callback_data)); |
---|
195 | } |
---|
196 | |
---|
197 | void |
---|
198 | gnome_vfs_async_open_as_channel (GnomeVFSAsyncHandle **handle_return, |
---|
199 | const gchar *text_uri, |
---|
200 | GnomeVFSOpenMode open_mode, |
---|
201 | guint advised_block_size, |
---|
202 | GnomeVFSAsyncOpenAsChannelCallback callback, |
---|
203 | gpointer callback_data) |
---|
204 | { |
---|
205 | static void |
---|
206 | (*real_gnome_vfs_async_open_as_channel) (GnomeVFSAsyncHandle **handle_return, |
---|
207 | const gchar *text_uri, |
---|
208 | GnomeVFSOpenMode open_mode, |
---|
209 | guint advised_block_size, |
---|
210 | GnomeVFSAsyncOpenAsChannelCallback callback, |
---|
211 | gpointer callback_data) = NULL; |
---|
212 | |
---|
213 | CALL_BACKEND (gnome_vfs_async_open_as_channel, |
---|
214 | (handle_return, text_uri, open_mode, advised_block_size, |
---|
215 | callback, callback_data)); |
---|
216 | } |
---|
217 | |
---|
218 | void |
---|
219 | gnome_vfs_async_create (GnomeVFSAsyncHandle **handle_return, |
---|
220 | const gchar *text_uri, |
---|
221 | GnomeVFSOpenMode open_mode, |
---|
222 | gboolean exclusive, |
---|
223 | guint perm, |
---|
224 | GnomeVFSAsyncOpenCallback callback, |
---|
225 | gpointer callback_data) |
---|
226 | { |
---|
227 | static void |
---|
228 | (*real_gnome_vfs_async_create) (GnomeVFSAsyncHandle **handle_return, |
---|
229 | const gchar *text_uri, |
---|
230 | GnomeVFSOpenMode open_mode, |
---|
231 | gboolean exclusive, |
---|
232 | guint perm, |
---|
233 | GnomeVFSAsyncOpenCallback callback, |
---|
234 | gpointer callback_data) = NULL; |
---|
235 | |
---|
236 | CALL_BACKEND (gnome_vfs_async_create, |
---|
237 | (handle_return, text_uri, open_mode, exclusive, perm, |
---|
238 | callback, callback_data)); |
---|
239 | } |
---|
240 | |
---|
241 | void |
---|
242 | gnome_vfs_async_create_as_channel (GnomeVFSAsyncHandle **handle_return, |
---|
243 | const gchar *text_uri, |
---|
244 | GnomeVFSOpenMode open_mode, |
---|
245 | gboolean exclusive, |
---|
246 | guint perm, |
---|
247 | GnomeVFSAsyncOpenAsChannelCallback callback, |
---|
248 | gpointer callback_data) |
---|
249 | { |
---|
250 | static void |
---|
251 | (*real_gnome_vfs_async_create_as_channel) (GnomeVFSAsyncHandle **handle_return, |
---|
252 | const gchar *text_uri, |
---|
253 | GnomeVFSOpenMode open_mode, |
---|
254 | gboolean exclusive, |
---|
255 | guint perm, |
---|
256 | GnomeVFSAsyncOpenAsChannelCallback callback, |
---|
257 | gpointer callback_data) = NULL; |
---|
258 | |
---|
259 | CALL_BACKEND (gnome_vfs_async_create_as_channel, |
---|
260 | (handle_return, text_uri, open_mode, exclusive, perm, |
---|
261 | callback, callback_data)); |
---|
262 | } |
---|
263 | |
---|
264 | void |
---|
265 | gnome_vfs_async_create_uri (GnomeVFSAsyncHandle **handle_return, |
---|
266 | GnomeVFSURI *text_uri, |
---|
267 | GnomeVFSOpenMode open_mode, |
---|
268 | gboolean exclusive, |
---|
269 | guint perm, |
---|
270 | GnomeVFSAsyncOpenCallback callback, |
---|
271 | gpointer callback_data) |
---|
272 | { |
---|
273 | static void |
---|
274 | (*real_gnome_vfs_async_create_uri) (GnomeVFSAsyncHandle **handle_return, |
---|
275 | GnomeVFSURI *uri, |
---|
276 | GnomeVFSOpenMode open_mode, |
---|
277 | gboolean exclusive, |
---|
278 | guint perm, |
---|
279 | GnomeVFSAsyncOpenCallback callback, |
---|
280 | gpointer callback_data); |
---|
281 | |
---|
282 | CALL_BACKEND (gnome_vfs_async_create_uri, |
---|
283 | (handle_return, text_uri, open_mode, exclusive, perm, |
---|
284 | callback, callback_data)); |
---|
285 | } |
---|
286 | |
---|
287 | |
---|
288 | void |
---|
289 | gnome_vfs_async_create_symbolic_link (GnomeVFSAsyncHandle **handle_return, |
---|
290 | GnomeVFSURI *uri, |
---|
291 | const gchar *uri_reference, |
---|
292 | GnomeVFSAsyncOpenCallback callback, |
---|
293 | gpointer callback_data) |
---|
294 | { |
---|
295 | static void |
---|
296 | (*real_gnome_vfs_async_create_symbolic_link) (GnomeVFSAsyncHandle **handle_return, |
---|
297 | GnomeVFSURI *uri, |
---|
298 | const gchar *uri_reference, |
---|
299 | GnomeVFSAsyncOpenCallback callback, |
---|
300 | gpointer callback_data); |
---|
301 | |
---|
302 | CALL_BACKEND (gnome_vfs_async_create_symbolic_link, |
---|
303 | (handle_return, uri, uri_reference, callback, callback_data)); |
---|
304 | } |
---|
305 | |
---|
306 | void |
---|
307 | gnome_vfs_async_close (GnomeVFSAsyncHandle *handle, |
---|
308 | GnomeVFSAsyncCloseCallback callback, |
---|
309 | gpointer callback_data) |
---|
310 | { |
---|
311 | static void |
---|
312 | (*real_gnome_vfs_async_close) (GnomeVFSAsyncHandle *handle, |
---|
313 | GnomeVFSAsyncCloseCallback callback, |
---|
314 | gpointer callback_data); |
---|
315 | |
---|
316 | CALL_BACKEND (gnome_vfs_async_close, |
---|
317 | (handle, callback, callback_data)); |
---|
318 | } |
---|
319 | |
---|
320 | void |
---|
321 | gnome_vfs_async_read (GnomeVFSAsyncHandle *handle, |
---|
322 | gpointer buffer, |
---|
323 | guint bytes, |
---|
324 | GnomeVFSAsyncReadCallback callback, |
---|
325 | gpointer callback_data) |
---|
326 | { |
---|
327 | static void |
---|
328 | (*real_gnome_vfs_async_read) (GnomeVFSAsyncHandle *handle, |
---|
329 | gpointer buffer, |
---|
330 | guint bytes, |
---|
331 | GnomeVFSAsyncReadCallback callback, |
---|
332 | gpointer callback_data); |
---|
333 | |
---|
334 | CALL_BACKEND (gnome_vfs_async_read, |
---|
335 | (handle, buffer, bytes, |
---|
336 | callback, callback_data)); |
---|
337 | } |
---|
338 | |
---|
339 | void |
---|
340 | gnome_vfs_async_write (GnomeVFSAsyncHandle *handle, |
---|
341 | gconstpointer buffer, |
---|
342 | guint bytes, |
---|
343 | GnomeVFSAsyncWriteCallback callback, |
---|
344 | gpointer callback_data) |
---|
345 | { |
---|
346 | static void |
---|
347 | (*real_gnome_vfs_async_write) (GnomeVFSAsyncHandle *handle, |
---|
348 | gconstpointer buffer, |
---|
349 | guint bytes, |
---|
350 | GnomeVFSAsyncWriteCallback callback, |
---|
351 | gpointer callback_data); |
---|
352 | |
---|
353 | CALL_BACKEND (gnome_vfs_async_write, |
---|
354 | (handle, buffer, bytes, |
---|
355 | callback, callback_data)); |
---|
356 | } |
---|
357 | |
---|
358 | void |
---|
359 | gnome_vfs_async_get_file_info (GnomeVFSAsyncHandle **handle_return, |
---|
360 | GList *uris, |
---|
361 | GnomeVFSFileInfoOptions options, |
---|
362 | GnomeVFSAsyncGetFileInfoCallback callback, |
---|
363 | gpointer callback_data) |
---|
364 | { |
---|
365 | static void |
---|
366 | (*real_gnome_vfs_async_get_file_info) (GnomeVFSAsyncHandle **handle_return, |
---|
367 | GList *uris, |
---|
368 | GnomeVFSFileInfoOptions options, |
---|
369 | GnomeVFSAsyncGetFileInfoCallback callback, |
---|
370 | gpointer callback_data); |
---|
371 | |
---|
372 | CALL_BACKEND (gnome_vfs_async_get_file_info, |
---|
373 | (handle_return, uris, options, |
---|
374 | callback, callback_data)); |
---|
375 | } |
---|
376 | |
---|
377 | void |
---|
378 | gnome_vfs_async_find_directory (GnomeVFSAsyncHandle **handle_return, |
---|
379 | GList *near_uri_list, |
---|
380 | GnomeVFSFindDirectoryKind kind, |
---|
381 | gboolean create_if_needed, |
---|
382 | gboolean find_if_needed, |
---|
383 | guint permissions, |
---|
384 | GnomeVFSAsyncFindDirectoryCallback callback, |
---|
385 | gpointer callback_data) |
---|
386 | { |
---|
387 | static void |
---|
388 | (*real_gnome_vfs_async_find_directory) (GnomeVFSAsyncHandle **handle_return, |
---|
389 | GList *near_uri_list, |
---|
390 | GnomeVFSFindDirectoryKind kind, |
---|
391 | gboolean create_if_needed, |
---|
392 | gboolean find_if_needed, |
---|
393 | guint permissions, |
---|
394 | GnomeVFSAsyncFindDirectoryCallback callback, |
---|
395 | gpointer callback_data); |
---|
396 | |
---|
397 | CALL_BACKEND (gnome_vfs_async_find_directory, |
---|
398 | (handle_return, near_uri_list, kind, create_if_needed, find_if_needed, |
---|
399 | permissions, callback, callback_data)); |
---|
400 | } |
---|
401 | |
---|
402 | void |
---|
403 | gnome_vfs_async_set_file_info (GnomeVFSAsyncHandle **handle_return, |
---|
404 | GnomeVFSURI *uri, |
---|
405 | GnomeVFSFileInfo *info, |
---|
406 | GnomeVFSSetFileInfoMask mask, |
---|
407 | GnomeVFSFileInfoOptions options, |
---|
408 | GnomeVFSAsyncSetFileInfoCallback callback, |
---|
409 | gpointer callback_data) |
---|
410 | { |
---|
411 | static void |
---|
412 | (*real_gnome_vfs_async_set_file_info) (GnomeVFSAsyncHandle **handle_return, |
---|
413 | GnomeVFSURI *uri, |
---|
414 | GnomeVFSFileInfo *info, |
---|
415 | GnomeVFSSetFileInfoMask mask, |
---|
416 | GnomeVFSFileInfoOptions options, |
---|
417 | GnomeVFSAsyncSetFileInfoCallback callback, |
---|
418 | gpointer callback_data); |
---|
419 | |
---|
420 | CALL_BACKEND (gnome_vfs_async_set_file_info, |
---|
421 | (handle_return, uri, info, mask, options, |
---|
422 | callback, callback_data)); |
---|
423 | } |
---|
424 | |
---|
425 | void |
---|
426 | gnome_vfs_async_load_directory_uri (GnomeVFSAsyncHandle **handle_return, |
---|
427 | GnomeVFSURI *uri, |
---|
428 | GnomeVFSFileInfoOptions options, |
---|
429 | GnomeVFSDirectoryFilterType filter_type, |
---|
430 | GnomeVFSDirectoryFilterOptions filter_options, |
---|
431 | const gchar *filter_pattern, |
---|
432 | guint items_per_notification, |
---|
433 | GnomeVFSAsyncDirectoryLoadCallback callback, |
---|
434 | gpointer callback_data) |
---|
435 | { |
---|
436 | static void |
---|
437 | (*real_gnome_vfs_async_load_directory_uri) (GnomeVFSAsyncHandle **handle_return, |
---|
438 | GnomeVFSURI *uri, |
---|
439 | GnomeVFSFileInfoOptions options, |
---|
440 | GnomeVFSDirectoryFilterType filter_type, |
---|
441 | GnomeVFSDirectoryFilterOptions filter_options, |
---|
442 | const gchar *filter_pattern, |
---|
443 | guint items_per_notification, |
---|
444 | GnomeVFSAsyncDirectoryLoadCallback callback, |
---|
445 | gpointer callback_data); |
---|
446 | |
---|
447 | CALL_BACKEND (gnome_vfs_async_load_directory_uri, |
---|
448 | (handle_return, uri, options, |
---|
449 | filter_type, filter_options, |
---|
450 | filter_pattern, items_per_notification, |
---|
451 | callback, callback_data)); |
---|
452 | } |
---|
453 | |
---|
454 | void |
---|
455 | gnome_vfs_async_load_directory (GnomeVFSAsyncHandle **handle_return, |
---|
456 | const gchar *uri, |
---|
457 | GnomeVFSFileInfoOptions options, |
---|
458 | GnomeVFSDirectoryFilterType filter_type, |
---|
459 | GnomeVFSDirectoryFilterOptions filter_options, |
---|
460 | const gchar *filter_pattern, |
---|
461 | guint items_per_notification, |
---|
462 | GnomeVFSAsyncDirectoryLoadCallback callback, |
---|
463 | gpointer callback_data) |
---|
464 | { |
---|
465 | static void |
---|
466 | (*real_gnome_vfs_async_load_directory) (GnomeVFSAsyncHandle **handle_return, |
---|
467 | const gchar *uri, |
---|
468 | GnomeVFSFileInfoOptions options, |
---|
469 | GnomeVFSDirectoryFilterType filter_type, |
---|
470 | GnomeVFSDirectoryFilterOptions filter_options, |
---|
471 | const gchar *filter_pattern, |
---|
472 | guint items_per_notification, |
---|
473 | GnomeVFSAsyncDirectoryLoadCallback callback, |
---|
474 | gpointer callback_data); |
---|
475 | |
---|
476 | CALL_BACKEND (gnome_vfs_async_load_directory, |
---|
477 | (handle_return, uri, options, |
---|
478 | filter_type, filter_options, filter_pattern, items_per_notification, |
---|
479 | callback, callback_data)); |
---|
480 | } |
---|
481 | |
---|
482 | GnomeVFSResult |
---|
483 | gnome_vfs_async_xfer (GnomeVFSAsyncHandle **handle_return, |
---|
484 | const GList *source_uri_list, |
---|
485 | const GList *target_uri_list, |
---|
486 | GnomeVFSXferOptions xfer_options, |
---|
487 | GnomeVFSXferErrorMode error_mode, |
---|
488 | GnomeVFSXferOverwriteMode overwrite_mode, |
---|
489 | GnomeVFSAsyncXferProgressCallback progress_update_callback, |
---|
490 | gpointer update_callback_data, |
---|
491 | GnomeVFSXferProgressCallback progress_sync_callback, |
---|
492 | gpointer sync_callback_data) |
---|
493 | { |
---|
494 | static GnomeVFSResult |
---|
495 | (*real_gnome_vfs_async_xfer) (GnomeVFSAsyncHandle **handle_return, |
---|
496 | const GList *source_uri_list, |
---|
497 | const GList *target_uri_list, |
---|
498 | GnomeVFSXferOptions xfer_options, |
---|
499 | GnomeVFSXferErrorMode error_mode, |
---|
500 | GnomeVFSXferOverwriteMode overwrite_mode, |
---|
501 | GnomeVFSAsyncXferProgressCallback progress_update_callback, |
---|
502 | gpointer update_callback_data, |
---|
503 | GnomeVFSXferProgressCallback progress_sync_callback, |
---|
504 | gpointer sync_callback_data); |
---|
505 | |
---|
506 | CALL_BACKEND_RETURN (gnome_vfs_async_xfer, |
---|
507 | (handle_return, |
---|
508 | source_uri_list, target_uri_list, |
---|
509 | xfer_options, error_mode, overwrite_mode, |
---|
510 | progress_update_callback, update_callback_data, |
---|
511 | progress_sync_callback, sync_callback_data)); |
---|
512 | } |
---|
513 | |
---|
514 | void |
---|
515 | gnome_vfs_async_cancel (GnomeVFSAsyncHandle *handle) |
---|
516 | { |
---|
517 | static void |
---|
518 | (*real_gnome_vfs_async_cancel)(GnomeVFSAsyncHandle *handle); |
---|
519 | |
---|
520 | CALL_BACKEND (gnome_vfs_async_cancel, (handle)); |
---|
521 | } |
---|
522 | |
---|
523 | void |
---|
524 | gnome_vfs_backend_get_current_context (/* OUT */ GnomeVFSContext **context) |
---|
525 | { |
---|
526 | static void |
---|
527 | (*real_gnome_vfs_get_current_context) (GnomeVFSContext **context); |
---|
528 | |
---|
529 | CALL_BACKEND (gnome_vfs_get_current_context, (context)); |
---|
530 | |
---|
531 | } |
---|
532 | |
---|
533 | void |
---|
534 | gnome_vfs_backend_dispatch_module_callback (GnomeVFSAsyncModuleCallback callback, |
---|
535 | gconstpointer in, |
---|
536 | gsize in_size, |
---|
537 | gpointer out, |
---|
538 | gsize out_size, |
---|
539 | gpointer user_data, |
---|
540 | GnomeVFSModuleCallbackResponse response, |
---|
541 | gpointer response_data) |
---|
542 | { |
---|
543 | static void |
---|
544 | (*real_gnome_vfs_dispatch_module_callback) (GnomeVFSAsyncModuleCallback callback, |
---|
545 | gpointer user_data, |
---|
546 | gconstpointer in, gsize in_size, |
---|
547 | gpointer out, gsize out_size, |
---|
548 | GnomeVFSModuleCallbackResponse response, |
---|
549 | gpointer response_data); |
---|
550 | |
---|
551 | CALL_BACKEND (gnome_vfs_dispatch_module_callback, (callback, |
---|
552 | user_data, |
---|
553 | in, in_size, |
---|
554 | out, out_size, |
---|
555 | response, response_data)); |
---|
556 | } |
---|
557 | |
---|
558 | |
---|
559 | |
---|
560 | int |
---|
561 | gnome_vfs_backend_get_job_count (void) |
---|
562 | { |
---|
563 | /* find and call the backend function */ |
---|
564 | |
---|
565 | int (* get_count) (void); |
---|
566 | |
---|
567 | g_assert (gmod != NULL); |
---|
568 | if (g_module_symbol (gmod, |
---|
569 | "gnome_vfs_job_get_count", |
---|
570 | (gpointer) &get_count)) { |
---|
571 | return (* get_count) (); |
---|
572 | } |
---|
573 | |
---|
574 | return -1; |
---|
575 | } |
---|