Re: Patch: transfer_msg_async update_callback function



On Tue, May 08, 2007 at 06:50:45PM +0200, Javier Fernandez wrote:
> On Tue, May 08, 2007 at 06:19:32PM +0200, Javier Fernandez wrote:
> > Hi all,
> > 
> > This is an experimental patch to allow tny_camel_transfer_msgs_async 
> > function to send back progress information, by calling update_callback 
> > function.
> 
> I added a new status code: 
>         TNY_FOLDER_STATUS_CODE_XFER_MSGS = 4,
> 

Use idl_stopper to prevent calls of update_callback after callback
execution.


--
Javier Fernández García-Boente
Ingeniero en Informática                 
mailto:jfernandez igalia com                    
Igalia http://www.igalia.com
Telf. +34 981 91 39 91  
Fax.  +34 981 91 39 49
 
Index: libtinymail-camel/tny-camel-folder.c
===================================================================
--- libtinymail-camel/tny-camel-folder.c	(revision 1878)
+++ libtinymail-camel/tny-camel-folder.c	(working copy)
@@ -1986,14 +1986,14 @@
 }
 
 static void
-tny_camel_folder_transfer_msgs_async (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, gpointer user_data)
+tny_camel_folder_transfer_msgs_async (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, TnyStatusCallback status_callback, gpointer user_data)
 {
-	TNY_CAMEL_FOLDER_GET_CLASS (self)->transfer_msgs_async_func (self, header_list, folder_dst, delete_originals, callback, user_data);
+	TNY_CAMEL_FOLDER_GET_CLASS (self)->transfer_msgs_async_func (self, header_list, folder_dst, delete_originals, callback, status_callback, user_data);
 	return;
 }
 
 static void
-tny_camel_folder_transfer_msgs_async_default (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, gpointer user_data)
+tny_camel_folder_transfer_msgs_async_default (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, TnyStatusCallback status_callback, gpointer user_data)
 {
 	TransferMsgsInfo *info;
 	GThread *thread;
@@ -2720,13 +2720,13 @@
 }
 
 static void 
-tny_camel_folder_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, gpointer user_data)
+tny_camel_folder_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data)
 {
-	TNY_CAMEL_FOLDER_GET_CLASS (self)->get_folders_async_func (self, list, callback, query, user_data);
+	TNY_CAMEL_FOLDER_GET_CLASS (self)->get_folders_async_func (self, list, callback, query, status_callback, user_data);
 }
 
 static void 
-tny_camel_folder_get_folders_async_default (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, gpointer user_data)
+tny_camel_folder_get_folders_async_default (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data)
 {
 	GetFoldersInfo *info;
 	GThread *thread;
Index: libtinymail-camel/tny-camel-folder.h
===================================================================
--- libtinymail-camel/tny-camel-folder.h	(revision 1878)
+++ libtinymail-camel/tny-camel-folder.h	(working copy)
@@ -75,7 +75,7 @@
 	void (*refresh_async_func) (TnyFolder *self, TnyRefreshFolderCallback callback, TnyStatusCallback status_callback, gpointer user_data);
 	void (*refresh_func) (TnyFolder *self, GError **err);
 	void (*transfer_msgs_func) (TnyFolder *self, TnyList *headers, TnyFolder *folder_dst, gboolean delete_originals, GError **err);
-	void (*transfer_msgs_async_func) (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, gpointer user_data);
+	void (*transfer_msgs_async_func) (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, TnyStatusCallback status_callback, gpointer user_data);
 	TnyFolder* (*copy_func) (TnyFolder *self, TnyFolderStore *into, const gchar *new_name, gboolean del, GError **err);
 	void (*poke_status_func) (TnyFolder *self);
 	void (*add_observer_func) (TnyFolder *self, TnyFolderObserver *observer);
@@ -84,7 +84,7 @@
 	gchar* (*get_url_string_func) (TnyFolder *self);
 	TnyFolderCaps (*get_caps_func) (TnyFolder *self);
 
-	void (*get_folders_async_func) (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, gpointer user_data);
+	void (*get_folders_async_func) (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data);
 	void (*get_folders_func) (TnyFolderStore *self, TnyList *list, TnyFolderStoreQuery *query, GError **err);
 	void (*remove_folder_func) (TnyFolderStore *self, TnyFolder *folder, GError **err);
 	TnyFolder* (*create_folder_func) (TnyFolderStore *self, const gchar *name, GError **err);
Index: libtinymail-camel/tny-camel-store-account.c
===================================================================
--- libtinymail-camel/tny-camel-store-account.c	(revision 1878)
+++ libtinymail-camel/tny-camel-store-account.c	(working copy)
@@ -812,13 +812,13 @@
 }
 
 static void
-tny_camel_store_account_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, gpointer user_data)
+tny_camel_store_account_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data)
 {
-	TNY_CAMEL_STORE_ACCOUNT_GET_CLASS (self)->get_folders_async_func (self, list, callback, query, user_data);
+	TNY_CAMEL_STORE_ACCOUNT_GET_CLASS (self)->get_folders_async_func (self, list, callback, query, status_callback, user_data);
 }
 
 static void 
-tny_camel_store_account_get_folders_async_default (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, gpointer user_data)
+tny_camel_store_account_get_folders_async_default (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data)
 {
 	GetFoldersInfo *info;
 	GThread *thread;
Index: libtinymail-camel/tny-camel-store-account.h
===================================================================
--- libtinymail-camel/tny-camel-store-account.h	(revision 1878)
+++ libtinymail-camel/tny-camel-store-account.h	(working copy)
@@ -49,7 +49,7 @@
 	TnyCamelAccountClass parent;
 
 	/* virtual methods */
-	void (*get_folders_async_func) (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, gpointer user_data);
+	void (*get_folders_async_func) (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data);
 	void (*get_folders_func) (TnyFolderStore *self, TnyList *list, TnyFolderStoreQuery *query, GError **err);
 	void (*remove_folder_func) (TnyFolderStore *self, TnyFolder *folder, GError **err);
 	TnyFolder* (*create_folder_func) (TnyFolderStore *self, const gchar *name, GError **err);
Index: libtinymailui-gtk/tny-gtk-folder-store-tree-model.c
===================================================================
--- libtinymailui-gtk/tny-gtk-folder-store-tree-model.c	(revision 1878)
+++ libtinymailui-gtk/tny-gtk-folder-store-tree-model.c	(working copy)
@@ -115,7 +115,7 @@
 	hlrp->self = self;
 	hlrp->parent_tree_iter = parent_tree_iter;
 
-	tny_folder_store_get_folders_async (store, folders, recurse_get_folders_callback, self->query, hlrp);
+	tny_folder_store_get_folders_async (store, folders, recurse_get_folders_callback, NULL, self->query, hlrp);
 }
 
 static void
Index: libtinymail/tny-combined-account.c
===================================================================
--- libtinymail/tny-combined-account.c	(revision 1878)
+++ libtinymail/tny-combined-account.c	(working copy)
@@ -299,11 +299,11 @@
 }
 
 static void
-tny_combined_account_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, gpointer user_data)
+tny_combined_account_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data)
 {
 	TnyCombinedAccountPriv *priv = TNY_COMBINED_ACCOUNT_GET_PRIVATE (self);
 
-	tny_folder_store_get_folders_async (TNY_FOLDER_STORE (priv->store_account), list, callback, query, user_data);
+	tny_folder_store_get_folders_async (TNY_FOLDER_STORE (priv->store_account), list, callback, query, status_callback, user_data);
 }
 
 static void
Index: libtinymail/tny-folder-store.c
===================================================================
--- libtinymail/tny-folder-store.c	(revision 1878)
+++ libtinymail/tny-folder-store.c	(working copy)
@@ -295,7 +295,7 @@
  *
  **/
 void 
-tny_folder_store_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, gpointer user_data)
+tny_folder_store_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data)
 {
 #ifdef DBC /* require */
 	g_assert (TNY_IS_FOLDER_STORE (self));
@@ -307,7 +307,7 @@
 	g_assert (TNY_FOLDER_STORE_GET_IFACE (self)->get_folders_async_func != NULL);
 #endif
 
-	TNY_FOLDER_STORE_GET_IFACE (self)->get_folders_async_func (self, list, callback, query, user_data);
+	TNY_FOLDER_STORE_GET_IFACE (self)->get_folders_async_func (self, list, callback, query, status_callback, user_data);
 
 #ifdef DBC /* ensure */
 #endif
Index: libtinymail/tny-merge-folder.c
===================================================================
--- libtinymail/tny-merge-folder.c	(revision 1878)
+++ libtinymail/tny-merge-folder.c	(working copy)
@@ -737,7 +737,7 @@
 }
 
 static void
-tny_merge_folder_transfer_msgs_async (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, gpointer user_data)
+tny_merge_folder_transfer_msgs_async (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, TnyStatusCallback status_callback, gpointer user_data)
 {
 	TransferMsgsInfo *info;
 	GThread *thread;
Index: libtinymail/tny-folder-store.h
===================================================================
--- libtinymail/tny-folder-store.h	(revision 1878)
+++ libtinymail/tny-folder-store.h	(working copy)
@@ -48,7 +48,7 @@
    void (*remove_folder_func) (TnyFolderStore *self, TnyFolder *folder, GError **err);
    TnyFolder* (*create_folder_func) (TnyFolderStore *self, const gchar *name, GError **err);
    void (*get_folders_func) (TnyFolderStore *self, TnyList *list, TnyFolderStoreQuery *query, GError **err);
-   void (*get_folders_async_func) (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, gpointer user_data);
+	void (*get_folders_async_func) (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data);
    void (*add_observer_func) (TnyFolderStore *self, TnyFolderStoreObserver *observer);
    void (*remove_observer_func) (TnyFolderStore *self, TnyFolderStoreObserver *observer);
 
@@ -59,7 +59,7 @@
 void tny_folder_store_remove_folder (TnyFolderStore *self, TnyFolder *folder, GError **err);
 TnyFolder *tny_folder_store_create_folder (TnyFolderStore *self, const gchar *name, GError **err);
 void tny_folder_store_get_folders (TnyFolderStore *self, TnyList *list, TnyFolderStoreQuery *query, GError **err);
-void tny_folder_store_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, gpointer user_data);
+void tny_folder_store_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data);
 void tny_folder_store_add_observer (TnyFolderStore *self, TnyFolderStoreObserver *observer);
 void tny_folder_store_remove_observer (TnyFolderStore *self, TnyFolderStoreObserver *observer);
 
Index: libtinymail/tny-folder.c
===================================================================
--- libtinymail/tny-folder.c	(revision 1878)
+++ libtinymail/tny-folder.c	(working copy)
@@ -761,6 +761,7 @@
  * @folder_dst: the TnyFolder where the msgs will be transfered
  * @delete_originals: if TRUE then move msgs, else copy them
  * @callback: The callback handler
+ * @status_callback: the status callback handler
  * @user_data: user data for the callback
  * 
  * Transfers messages of which the headers are in @header_list from @self to 
@@ -784,7 +785,7 @@
  * this method if you want API or ABI compatibility with your binary.
  **/
 void 
-tny_folder_transfer_msgs_async (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, gpointer user_data)
+tny_folder_transfer_msgs_async (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, TnyStatusCallback status_callback, gpointer user_data)
 {
 #ifdef DBC /* require */
 	g_assert (TNY_IS_FOLDER (self));
@@ -796,7 +797,7 @@
 	g_assert (TNY_FOLDER_GET_IFACE (self)->transfer_msgs_async_func != NULL);
 #endif
 
-	TNY_FOLDER_GET_IFACE (self)->transfer_msgs_async_func (self, header_list, folder_dst, delete_originals, callback, user_data);
+	TNY_FOLDER_GET_IFACE (self)->transfer_msgs_async_func (self, header_list, folder_dst, delete_originals, callback, status_callback, user_data);
 	return;
 }
 
Index: libtinymail/tny-folder.h
===================================================================
--- libtinymail/tny-folder.h	(revision 1878)
+++ libtinymail/tny-folder.h	(working copy)
@@ -107,7 +107,7 @@
 	void (*refresh_async_func) (TnyFolder *self, TnyRefreshFolderCallback callback, TnyStatusCallback status_callback, gpointer user_data);
 	void (*refresh_func) (TnyFolder *self, GError **err);
 	void (*transfer_msgs_func) (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, GError **err);
-	void (*transfer_msgs_async_func) (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, gpointer user_data);
+	void (*transfer_msgs_async_func) (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, TnyStatusCallback status_callback, gpointer user_data);
 	TnyFolder* (*copy_func) (TnyFolder *self, TnyFolderStore *into, const gchar *new_name, gboolean del, GError **err);
 	void (*poke_status_func) (TnyFolder *self);
 	void (*add_observer_func) (TnyFolder *self, TnyFolderObserver *observer);
@@ -143,7 +143,7 @@
 void tny_folder_refresh_async (TnyFolder *self, TnyRefreshFolderCallback callback, TnyStatusCallback status_callback, gpointer user_data);
 void tny_folder_refresh (TnyFolder *self, GError **err);
 void tny_folder_transfer_msgs (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, GError **err);
-void tny_folder_transfer_msgs_async (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, gpointer user_data);
+void tny_folder_transfer_msgs_async (TnyFolder *self, TnyList *header_list, TnyFolder *folder_dst, gboolean delete_originals, TnyTransferMsgsCallback callback, TnyStatusCallback status_callback, gpointer user_data);
 TnyFolder* tny_folder_copy (TnyFolder *self, TnyFolderStore *into, const gchar *new_name, gboolean del, GError **err);
 void tny_folder_poke_status (TnyFolder *self);
 void tny_folder_add_observer (TnyFolder *self, TnyFolderObserver *observer);


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