4 >Module Callbacks</TITLE
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64
10 TITLE="GnomeVFS - Filesystem Abstraction library"
11 HREF="index.html"><LINK
13 TITLE="Basic File Operations"
14 HREF="file-operations.html"><LINK
17 HREF="gnome-vfs-xfer.html"><LINK
19 TITLE="Standard Callbacks"
20 HREF="gnome-vfs-standard-callbacks.html"></HEAD
43 >GnomeVFS - Filesystem Abstraction library</FONT
52 HREF="gnome-vfs-xfer.html"
57 ><<< Previous Page</B
90 HREF="file-operations.html"
106 HREF="gnome-vfs-standard-callbacks.html"
111 >Next Page >>></B
120 NAME="GNOME-VFS-MODULE-CALLBACKS"
130 >Module Callbacks -- registering for special callbacks from gnome-vfs module operations</DIV
132 CLASS="REFSYNOPSISDIV"
150 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSMODULECALLBACK"
151 >*GnomeVFSModuleCallback</A
153 HREF=../glib/glib-basic-types.html#GCONSTPOINTER
154 >gconstpointer</A> in,
156 HREF=../glib/glib-basic-types.html#GSIZE
159 HREF=../glib/glib-basic-types.html#GPOINTER
162 HREF=../glib/glib-basic-types.html#GSIZE
165 HREF=../glib/glib-basic-types.html#GPOINTER
166 >gpointer</A> callback_data);
168 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSMODULECALLBACKRESPONSE"
169 >*GnomeVFSModuleCallbackResponse</A
172 HREF=../glib/glib-basic-types.html#GPOINTER
173 >gpointer</A> response_data);
175 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSASYNCMODULECALLBACK"
176 >*GnomeVFSAsyncModuleCallback</A
178 HREF=../glib/glib-basic-types.html#GCONSTPOINTER
179 >gconstpointer</A> in,
181 HREF=../glib/glib-basic-types.html#GSIZE
184 HREF=../glib/glib-basic-types.html#GPOINTER
187 HREF=../glib/glib-basic-types.html#GSIZE
190 HREF=../glib/glib-basic-types.html#GPOINTER
191 >gpointer</A> callback_data,
193 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSMODULECALLBACKRESPONSE"
194 >GnomeVFSModuleCallbackResponse</A
197 HREF=../glib/glib-basic-types.html#GPOINTER
198 >gpointer</A> response_data);
200 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-MODULE-CALLBACK-SET-DEFAULT"
201 >gnome_vfs_module_callback_set_default</A
203 (const char *callback_name,
205 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSMODULECALLBACK"
206 >GnomeVFSModuleCallback</A
209 HREF=../glib/glib-basic-types.html#GPOINTER
210 >gpointer</A> callback_data,
212 HREF=../glib/glib-datasets.html#GDESTROYNOTIFY
213 >GDestroyNotify</A> destroy_notify);
215 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-MODULE-CALLBACK-PUSH"
216 >gnome_vfs_module_callback_push</A
217 > (const char *callback_name,
219 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSMODULECALLBACK"
220 >GnomeVFSModuleCallback</A
223 HREF=../glib/glib-basic-types.html#GPOINTER
224 >gpointer</A> callback_data,
226 HREF=../glib/glib-datasets.html#GDESTROYNOTIFY
227 >GDestroyNotify</A> destroy_notify);
229 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-MODULE-CALLBACK-POP"
230 >gnome_vfs_module_callback_pop</A
231 > (const char *callback_name);
233 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-ASYNC-MODULE-CALLBACK-SET-DEFAULT"
234 >gnome_vfs_async_module_callback_set_default</A
236 (const char *callback_name,
238 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSASYNCMODULECALLBACK"
239 >GnomeVFSAsyncModuleCallback</A
242 HREF=../glib/glib-basic-types.html#GPOINTER
243 >gpointer</A> callback_data,
245 HREF=../glib/glib-datasets.html#GDESTROYNOTIFY
246 >GDestroyNotify</A> destroy_notify);
248 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-ASYNC-MODULE-CALLBACK-PUSH"
249 >gnome_vfs_async_module_callback_push</A
251 (const char *callback_name,
253 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSASYNCMODULECALLBACK"
254 >GnomeVFSAsyncModuleCallback</A
257 HREF=../glib/glib-basic-types.html#GPOINTER
258 >gpointer</A> callback_data,
260 HREF=../glib/glib-datasets.html#GDESTROYNOTIFY
261 >GDestroyNotify</A> destroy_notify);
263 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-ASYNC-MODULE-CALLBACK-POP"
264 >gnome_vfs_async_module_callback_pop</A
266 (const char *callback_name);</PRE
279 >Sometimes, a module operation will want to call back to the
280 application before completing. For example, it may want to request
281 that the application prompt the user for a username and password to
282 access a particular URI. Or it may want to provide a status message
283 that the application can display.</P
285 >Such callbacks are handled using the module callback mechanism.</P
287 >Module callbacks may be set globally for all threads, or they may be
288 temporarilly overridden using a per-thread stack. Normally the stack
289 is not inherited by new threads; however, async operations are run
290 with a set of callbacks that corresponds to when the operation was
293 >There are also special async module callbacks. Async callbacks are
294 only invoked from async module operations, and take precedence over
295 sync callbacks in this case, if set. They are dispatched on the main
296 thread. Also, unlike regular callbacks, they do not need to provide
297 the answer right away. Instead, they can arrange to have a response
298 function called at any later time. This enables async callbacks to pop
299 up non-modal dialogs or schedule other async work before providing a
316 NAME="GNOMEVFSMODULECALLBACK"
318 >GnomeVFSModuleCallback ()</H3
327 CLASS="PROGRAMLISTING"
328 >void (*GnomeVFSModuleCallback) (<A
329 HREF=../glib/glib-basic-types.html#GCONSTPOINTER
330 >gconstpointer</A> in,
332 HREF=../glib/glib-basic-types.html#GSIZE
335 HREF=../glib/glib-basic-types.html#GPOINTER
338 HREF=../glib/glib-basic-types.html#GSIZE
341 HREF=../glib/glib-basic-types.html#GPOINTER
342 >gpointer</A> callback_data);</PRE
347 >This is the type of a callback function that gets set for a module
350 >When the callback is invoked, the user function is called with an
356 > argument, the exact type of which depends on the specific
357 callback. It is generally a pointer to a struct with several fields
358 that provide information to the callback.</P
365 > argument is used to return a values from the
366 callback. Once again the exact type depends on the specific
367 callback. It is generally a pointer to a pre-allocated struct with
368 several fields that the callback function should fill in before
373 CLASS="INFORMALTABLE"
402 > The in argument for this callback; the exact type depends on the specific callback</TD
419 > Size of the in argument; useful for sanity-checking</TD
436 > The out argument for this callback; the exact type depends on the specific callback</TD
453 > Size of the out argument; useful for sanity-checking</TD
475 > specified when this callback was set</TD
490 NAME="GNOMEVFSMODULECALLBACKRESPONSE"
492 >GnomeVFSModuleCallbackResponse ()</H3
501 CLASS="PROGRAMLISTING"
502 >void (*GnomeVFSModuleCallbackResponse)
504 HREF=../glib/glib-basic-types.html#GPOINTER
505 >gpointer</A> response_data);</PRE
510 >This is the type of the response function passed to a
512 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSASYNCMODULECALLBACK"
513 >GnomeVFSAsyncModuleCallback</A
514 >(). It should be called when the async
515 callback has completed.</P
519 CLASS="INFORMALTABLE"
553 > argument originally passed to the async callback</TD
568 NAME="GNOMEVFSASYNCMODULECALLBACK"
570 >GnomeVFSAsyncModuleCallback ()</H3
579 CLASS="PROGRAMLISTING"
580 >void (*GnomeVFSAsyncModuleCallback) (<A
581 HREF=../glib/glib-basic-types.html#GCONSTPOINTER
582 >gconstpointer</A> in,
584 HREF=../glib/glib-basic-types.html#GSIZE
587 HREF=../glib/glib-basic-types.html#GPOINTER
590 HREF=../glib/glib-basic-types.html#GSIZE
593 HREF=../glib/glib-basic-types.html#GPOINTER
594 >gpointer</A> callback_data,
596 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSMODULECALLBACKRESPONSE"
597 >GnomeVFSModuleCallbackResponse</A
600 HREF=../glib/glib-basic-types.html#GPOINTER
601 >gpointer</A> response_data);</PRE
606 >This is the type of a callback function that gets set for an async
609 >Such callbacks are useful when you are using the API and want
610 callbacks to be handled from the main thread, for instance if they
611 need to put up a dialog.</P
614 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSMODULECALLBACK"
615 >GnomeVFSModuleCallback</A
616 >(), an async callback has <TT
627 arguments for passing data into and out of the callback. However,
628 an async callback does not need to fill in the <TT
634 returning. Instead, it can arrange to have the work done from a
635 callback on the main loop, from another thread, etc. The <TT
641 function should be called by whatever code finishes the work of the
647 > as an argument once the <TT
653 is filled in and the callback is done.</P
665 > arguments are guaranteed to remain valid until the
671 > function is called.</P
675 CLASS="INFORMALTABLE"
704 > The in argument for this callback; the exact type depends on the specific callback</TD
721 > Size of the in argument; useful for sanity-checking</TD
738 > The out argument for this callback; the exact type depends on the specific callback</TD
755 > Size of the out argument; useful for sanity-checking</TD
777 > specified when this callback was set</TD
794 > Response function to call when the callback is completed</TD
811 > Argument to pass to <TT
831 NAME="GNOME-VFS-MODULE-CALLBACK-SET-DEFAULT"
833 >gnome_vfs_module_callback_set_default ()</H3
842 CLASS="PROGRAMLISTING"
843 >void gnome_vfs_module_callback_set_default
844 (const char *callback_name,
846 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSMODULECALLBACK"
847 >GnomeVFSModuleCallback</A
850 HREF=../glib/glib-basic-types.html#GPOINTER
851 >gpointer</A> callback_data,
853 HREF=../glib/glib-datasets.html#GDESTROYNOTIFY
854 >GDestroyNotify</A> destroy_notify);</PRE
859 >Set the default callback for <TT
875 > will be called with <TT
881 same thread as the gnome-vfs operation that invokes it. The default
882 value is shared for all threads, but setting it is thread-safe.</P
884 >Use this function if you want to set a handler to be used by your
885 whole application. You can use <A
886 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-MODULE-CALLBACK-PUSH"
887 >gnome_vfs_module_callback_push</A
889 set a callback function that will temporarily override the default
890 on the current thread instead. Or you can also use
892 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-ASYNC-MODULE-CALLBACK-SET-DEFAULT"
893 >gnome_vfs_async_module_callback_set_default</A
895 callback function.</P
902 > may be called on any thread - it is not
903 guaranteed to be called on the main thread.</P
907 CLASS="INFORMALTABLE"
936 > The name of the module callback to set</TD
953 > The function to call when the callback is invoked</TD
970 > Pointer to pass as the <TT
997 > Function to call when <TT
1002 > is to be freed.</TD
1017 NAME="GNOME-VFS-MODULE-CALLBACK-PUSH"
1019 >gnome_vfs_module_callback_push ()</H3
1028 CLASS="PROGRAMLISTING"
1029 >void gnome_vfs_module_callback_push (const char *callback_name,
1031 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSMODULECALLBACK"
1032 >GnomeVFSModuleCallback</A
1035 HREF=../glib/glib-basic-types.html#GPOINTER
1036 >gpointer</A> callback_data,
1038 HREF=../glib/glib-datasets.html#GDESTROYNOTIFY
1039 >GDestroyNotify</A> destroy_notify);</PRE
1049 > as a temprary handler for <TT
1060 will be called with <TT
1065 > on the same thread as the
1066 gnome-vfs operation that invokes it. The temporary handler is set
1070 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-MODULE-CALLBACK-POP"
1071 >gnome_vfs_module_callback_pop</A
1072 >() removes the most recently set
1073 temporary handler. The temporary handlers are treated as a first-in
1076 >Use this function to set a temporary callback handler for a single
1077 call or a few calls. You can use
1079 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-MODULE-CALLBACK-SET-DEFAULT"
1080 >gnome_vfs_module_callback_set_default</A
1081 >() to set a callback function
1082 that will establish a permanent global setting for all threads
1090 > may be called on any thread - it is not
1091 guaranteed to be called on the main thread.</P
1095 CLASS="INFORMALTABLE"
1124 > The name of the module callback to set temporarily</TD
1141 > The function to call when the callback is invoked</TD
1158 > Pointer to pass as the <TT
1185 > Function to call when <TT
1190 > is to be freed.</TD
1205 NAME="GNOME-VFS-MODULE-CALLBACK-POP"
1207 >gnome_vfs_module_callback_pop ()</H3
1216 CLASS="PROGRAMLISTING"
1217 >void gnome_vfs_module_callback_pop (const char *callback_name);</PRE
1222 >Remove the temporary handler for <TT
1229 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-MODULE-CALLBACK-PUSH"
1230 >gnome_vfs_module_callback_push</A
1231 >(). If another temporary
1232 handler was previously set on the same thread, it becomes the
1233 current handler. Otherwise, the default handler, if any, becomes
1236 >The temporary handlers are treated as a first-in first-out
1241 CLASS="INFORMALTABLE"
1270 > The name of the module callback to remove a temporary handler for</TD
1285 NAME="GNOME-VFS-ASYNC-MODULE-CALLBACK-SET-DEFAULT"
1287 >gnome_vfs_async_module_callback_set_default ()</H3
1296 CLASS="PROGRAMLISTING"
1297 >void gnome_vfs_async_module_callback_set_default
1298 (const char *callback_name,
1300 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSASYNCMODULECALLBACK"
1301 >GnomeVFSAsyncModuleCallback</A
1304 HREF=../glib/glib-basic-types.html#GPOINTER
1305 >gpointer</A> callback_data,
1307 HREF=../glib/glib-datasets.html#GDESTROYNOTIFY
1308 >GDestroyNotify</A> destroy_notify);</PRE
1313 >Set the default async callback for <TT
1329 > will be called with <TT
1335 from a callback on the main thread. It will be passed a response
1336 function which should be called to signal completion of the callback.
1337 The callback function itself may return in the meantime.</P
1339 >The default value is shared for all threads, but setting it is
1342 >Use this function if you want to globally set a callback handler
1343 for use with async operations.</P
1346 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-ASYNC-MODULE-CALLBACK-PUSH"
1347 >gnome_vfs_async_module_callback_push</A
1349 callback function that will temporarily override the default on the
1350 current thread instead. Or you can also use
1352 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-MODULE-CALLBACK-SET-DEFAULT"
1353 >gnome_vfs_module_callback_set_default</A
1354 >() to set a regular callback
1362 > may be called on any thread - it is not
1363 guaranteed to be called on the main thread.</P
1367 CLASS="INFORMALTABLE"
1396 > The name of the async module callback to set</TD
1413 > The function to call when the callback is invoked</TD
1430 > Pointer to pass as the <TT
1457 > Function to call when <TT
1462 > is to be freed.</TD
1477 NAME="GNOME-VFS-ASYNC-MODULE-CALLBACK-PUSH"
1479 >gnome_vfs_async_module_callback_push ()</H3
1488 CLASS="PROGRAMLISTING"
1489 >void gnome_vfs_async_module_callback_push
1490 (const char *callback_name,
1492 HREF="gnome-vfs-module-callbacks.html#GNOMEVFSASYNCMODULECALLBACK"
1493 >GnomeVFSAsyncModuleCallback</A
1496 HREF=../glib/glib-basic-types.html#GPOINTER
1497 >gpointer</A> callback_data,
1499 HREF=../glib/glib-datasets.html#GDESTROYNOTIFY
1500 >GDestroyNotify</A> destroy_notify);</PRE
1510 > as a temprary async handler for
1521 > will be called with <TT
1527 from a callback on the main thread. It will be passed a response
1528 function which should be called to signal completion of the
1529 callback. The callback function itself may return in the meantime.</P
1531 >The temporary async handler is set per-thread.</P
1534 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-ASYNC-MODULE-CALLBACK-POP"
1535 >gnome_vfs_async_module_callback_pop</A
1536 >() removes the most recently set
1537 temporary temporary handler. The temporary async handlers are
1538 treated as a first-in first-out stack.</P
1540 >Use this function to set a temporary async callback handler for a
1541 single call or a few calls. You can use
1543 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-ASYNC-MODULE-CALLBACK-SET-DEFAULT"
1544 >gnome_vfs_async_module_callback_set_default</A
1546 callback function that will establish a permanent global setting
1547 for all threads instead.</P
1554 > may be called on any thread - it is not
1555 guaranteed to be called on the main thread.</P
1559 CLASS="INFORMALTABLE"
1588 > The name of the module callback to set temporarily</TD
1605 > The function to call when the callback is invoked</TD
1622 > Pointer to pass as the <TT
1649 > Function to call when <TT
1654 > is to be freed.</TD
1669 NAME="GNOME-VFS-ASYNC-MODULE-CALLBACK-POP"
1671 >gnome_vfs_async_module_callback_pop ()</H3
1680 CLASS="PROGRAMLISTING"
1681 >void gnome_vfs_async_module_callback_pop
1682 (const char *callback_name);</PRE
1687 >Remove the temporary async handler for <TT
1694 HREF="gnome-vfs-module-callbacks.html#GNOME-VFS-ASYNC-MODULE-CALLBACK-PUSH"
1695 >gnome_vfs_async_module_callback_push</A
1697 temporary async handler was previously set on the same thread, it
1698 becomes the current handler. Otherwise, the default async handler,
1699 if any, becomes current.</P
1701 >The temporary async handlers are treated as a first-in first-out
1706 CLASS="INFORMALTABLE"
1735 > The name of the module callback to remove a temporary handler for</TD
1753 HREF="gnome-vfs-standard-callbacks.html"
1754 >Standard Callbacks</A
1760 CLEAR="all"><BR><TABLE
1772 HREF="gnome-vfs-xfer.html"
1777 ><<< Previous Page</B
1810 HREF="file-operations.html"
1826 HREF="gnome-vfs-standard-callbacks.html"
1831 >Next Page >>></B
1854 >Standard Callbacks</B