gcmd-devel
[Top][All Lists]
Advanced

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

[gcmd-dev] Gui update problem while moving folder.


From: lizard
Subject: [gcmd-dev] Gui update problem while moving folder.
Date: Thu, 24 May 2007 22:25:52 +0200

Hello all,

i was observing the following bug in gcmd for some time now.
If gcmd moves an folder the updated information in the dialogue box is totally 
wrong.
This does not happen if gcmd copies the folder.
Because my C/C++ understanding is minimal i needed some time to track the 
problem down.
Indeed it is not an gcmd problem at all it is an gnome problem.
To show you that i had to rewrite some code in python.
Here it is:

#!/usr/bin/env python

import gnomevfs
import os
import gtk

def progress_update_callback(_reserved,info,data):
        print "update", info.files_total, info.bytes_total, 
info.total_bytes_copied, info.bytes_copied
        if info.phase == gnomevfs.XFER_PHASE_COMPLETED:
            gtk.main_quit()
        return 1

def progress_sync_callback(info,data):
        # print "sync", info.files_total, info.bytes_total, 
info.total_bytes_copied, info.bytes_copied
        return 1
   

def main():
        f1 = gnomevfs.URI("path_to_big_folder")
        f2 = gnomevfs.URI("path_to_some_place_where_content_fits_in")
        handle = gnomevfs.async.xfer(
                source_uri_list=[f1], 
                target_uri_list=[f2], 
                #xfer_options=gnomevfs.XFER_RECURSIVE,
                #xfer_options=gnomevfs.XFER_DEFAULT,
                xfer_options=gnomevfs.XFER_REMOVESOURCE,
                error_mode=gnomevfs.XFER_ERROR_MODE_ABORT,
                overwrite_mode=gnomevfs.XFER_OVERWRITE_MODE_ABORT,
                progress_update_callback = progress_update_callback,
                update_callback_data = 0x4321,
                progress_sync_callback = progress_sync_callback,
                sync_callback_data = 0x1234)
        gtk.main()


if __name__ == '__main__':
            main()


GNOME_VFS_XFER_DEFAULT copies the folder
of course it does this recursive. Or is there another way to copy an
folder?
Unfortunately it does not update some data in GnomeVFSXferProgressInfo.

GNOME_VFS_XFER_RECURSIVE copies the folder too.
This time it does it explicitly recursive and updates all data in 
GnomeVFSXferProgressInfo.

GNOME_VFS_XFER_REMOVESOURCE moves the folder or copies them if not on the same 
file system.
Unfortunately it again does not update some data in GnomeVFSXferProgressInfo.

files_total and bytes_total are the values that get left out.

I would say this is an bug in gnome but i would like to know what you think 
about this?
Should we work around this problem?

To work around the problem gcmd would need to traverse the directories 
recursively down 
the folders and collect the needed data. Additionally could check for the 
needed permissions
before trying to do something and warn the user.
I always asked myself why file managers dont check such things before they 
start the hard work. 
After fooling around with the python code i would say that such a pre check 
should be made by
gnome anyway but it does not.

Maybe i am totally wrong here...
What do you think about this?















reply via email to

[Prev in Thread] Current Thread [Next in Thread]