Re: Updated proposal for making the GtkFileChooser code asynchronous



On Fri, 9 Dec 2005, Kristian Rietveld wrote:

1. Let's start out with a somewhat more general change.  We need to be able
  to cancel currently running asynchronous operations.  For this we need
  to have a handle on an operation, so we need to introduce a
  GtkFileSystemHandle.  The GtkFileSystemHandle will be a GObject:

  struct _GtkFileSystemHandle
  {
    GObject parent_instance;

    GtkFileSystem *file_system;

    guint cancelled : 1;		/* indicates whether the operation
					   has been cancelled or not */
  };

  struct _GtkFileSystemHandleClass
  {
    GObjectClass parent_class;
  };

  File system backends can of course subclass GtkFileSystemHandle and
  add their own fields as required.  We will add a call which we can use to
  actually cancel an operation:

  void gtk_file_system_cancel_operation (GtkFileSystemHandle  *handle);

is ->cancelled to be exported as a GObject property ::cancelled as well,
so one could possibly listen to ::notify::cancelled?

4. gtk_file_system_create_folder() needs to be changed in order to be able
  to operate asynchronously.  The new prototypes:

  typedef void (* GtkFileSystemCreateFolderCallback) (GtkFileSystemHandle
*handle,
                                                      const GtkFilePath        *path
                                                      GError                   *error,
                                                      gpointer                  data);

  GtkFileSystemHandle *gtk_file_system_create_folder (GtkFileSystem                      *file_system,
                                                      const GtkFilePath                  *path,
                                                      GtkFileSystemCreateFolderCallback   callback,
                                                      gpointer                            data);

  The error reporting works on the same way as the other functions.

does cancellation of gtk_file_system_create_folder() guarantee that no
new folder was created?
- what happens if gtk_file_system_cancel_operation() is called after a
  successfull mkdir() but before GtkFileSystemCreateFolderCallback() is called?
- what happens if gtk_file_system_cancel_operation() is called after
  GtkFileSystemCreateFolderCallback() was called (or from within)?

thanks,

-kris.

---
ciaoTJ



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