Re: What to return in async transfer callbacks?



On Mon, 2005-09-26 at 11:32 +0200, Matthias Kaeppler wrote:
> Alexander Larsson wrote:
> > This whole API is less than ideal, and not much documented. Try reading
> > nautilus/libnautilus-private/nautilus-file-operations.c to see how its
> > used.
> 
> You can say that again. (Though I am still glad we have it!)
> I'll take a peek at that file, thanks.
> 
> By the way, there is another thing I stumbled over while using gnome-vfs 
> (as far as I can tell, this applies to both the C and the C++ API):
> It seems to me that the names and descriptions of these two callbacks 
> have been confused. The first one is called progress_update_callback and 
> is not really documented. Everything said about this callback is:
> 
> "called periodically to keep the client appraised of progress in 
> completing the XFer operation, and the current phase of operation."
> 
> Then there is the other one called progress_sync_callback:
> 
> "called when the program requires responses to interactive queries (e.g. 
> overwriting files, handling errors, etc"
> 
>  From my observations, it's actually vice versa. The first function I 
> pass to gnome_vfs_async_xfer is the interaction slot, where user 
> interaction happens. It's e.g. called when you try to overwrite a file.
> The second one, the (so called) sync callback, is in fact the update 
> callback. It is called when the transfer progresses.

Yes, that is wrong. I'm not sure who wrote that docs. Here is how it
really works:
The sync callbacks get called after *every* file operation (such as move
of a file), and should be very fast (i.e. can't do ui stuff). Its mainly
used to track the actual changes in the filesystem (nautilus needs this
to figure out what files have changed etc).
The async callback is called "periodically" to let you change the
progress bar in the ui, and when there is a need to ask the user how to
progress (e.g. overwrite?).

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a genetically engineered guitar-strumming werewolf on a search for his 
missing sister. She's a warm-hearted renegade opera singer descended from a 
line of powerful witches. They fight crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]