Re: Patch: add camel folder reasons to sentbox and outbox while send queue is processed



Sergio Villar Senin escribiu:
> Philip Van Hoof escribiu:
>> No, not approved. In TnyCamelSendQueue you must first check whether the
>> TnyFolder are a TNY_IS_CAMEL_FOLDER, before doing this.
> 
> Done on behalf of Dape :-)

Actually I did some more changes. First of all I changed some variable
names to fit better with the naming conventions of tinymail. Secondly I
moved some code of the branch to look like the trunk. And I'm also
attaching a patch for the trunk that lacked of a couple of unreasons in
case the thread could not be created.

Br
Index: libtinymail-camel/tny-camel-send-queue.c
===================================================================
--- libtinymail-camel/tny-camel-send-queue.c	(revision 3651)
+++ libtinymail-camel/tny-camel-send-queue.c	(working copy)
@@ -608,13 +608,22 @@
 	g_object_unref (info->device);
 	g_object_unref (info->self);
 
+	if (TNY_IS_CAMEL_FOLDER (info->outbox)) {
+		TnyCamelFolderPriv *opriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->outbox);
+		_tny_camel_folder_unreason (opriv);
+	}
+	if (TNY_IS_CAMEL_FOLDER (info->sentbox)) {
+		TnyCamelFolderPriv *spriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox);
+		_tny_camel_folder_unreason (spriv);
+	}
+
+	g_object_unref (info->outbox);
+	g_object_unref (info->sentbox);
+
 	if (info->outbox_account)
 		g_object_unref (info->outbox_account);
 	if (info->sentbox_account)
 		g_object_unref (info->sentbox_account);
-
-	g_object_unref (info->outbox);
-	g_object_unref (info->sentbox);
 	g_object_unref (info->trans_account);
 
 	g_slice_free (MainThreadInfo, info);
@@ -667,13 +676,30 @@
 			info->outbox_account = tny_folder_get_account (info->outbox);
 			info->trans_account = (TnyTransportAccount *) g_object_ref (priv->trans_account);
 
+		        if (TNY_IS_CAMEL_FOLDER (info->outbox)) {
+		                TnyCamelFolderPriv *opriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->outbox);
+			        _tny_camel_folder_reason (opriv);
+		        }
+		        if (TNY_IS_CAMEL_FOLDER (info->sentbox)) {
+		                TnyCamelFolderPriv *spriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox);
+		                _tny_camel_folder_reason (spriv);
+		        }			
 
 			emit_queue_control_signals (self, TNY_SEND_QUEUE_START);
 
 			priv->thread = g_thread_create (thread_main, info, FALSE, NULL);
 
-			if (priv->thread == NULL)
+			if (priv->thread == NULL) {
 				emit_queue_control_signals (self, TNY_SEND_QUEUE_STOP);
+			        if (TNY_IS_CAMEL_FOLDER (info->outbox)) {
+		        	        TnyCamelFolderPriv *opriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->outbox);
+					_tny_camel_folder_unreason (opriv);
+				}
+			        if (TNY_IS_CAMEL_FOLDER (info->sentbox)) {
+			                TnyCamelFolderPriv *spriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox);
+			                _tny_camel_folder_unreason (spriv);
+			        }
+			}
 		}
 	}
 
Index: libtinymail-camel/tny-camel-send-queue.c
===================================================================
--- libtinymail-camel/tny-camel-send-queue.c	(revision 3651)
+++ libtinymail-camel/tny-camel-send-queue.c	(working copy)
@@ -793,7 +793,6 @@
 	g_object_unref (info->device);
 	g_object_unref (info->self);
 
-
 	if (TNY_IS_CAMEL_FOLDER (info->sentbox)) {
 		TnyCamelFolderPriv *spriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox);
 		_tny_camel_folder_unreason (spriv);
@@ -863,22 +862,30 @@
 			info->outbox_account = tny_folder_get_account (info->outbox);
 			info->trans_account = (TnyTransportAccount *) g_object_ref (priv->trans_account);
 
+			if (TNY_IS_CAMEL_FOLDER (info->outbox)) {
+				TnyCamelFolderPriv *opriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->outbox);
+				_tny_camel_folder_reason (opriv);
+			}
 			if (TNY_IS_CAMEL_FOLDER (info->sentbox)) {
 				TnyCamelFolderPriv *spriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox);
 				_tny_camel_folder_reason (spriv);
 			}
 
-			if (TNY_IS_CAMEL_FOLDER (info->outbox)) {
-				TnyCamelFolderPriv *opriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->outbox);
-				_tny_camel_folder_reason (opriv);
-			}
-
 			emit_queue_control_signals (self, TNY_SEND_QUEUE_START);
 
 			priv->thread = g_thread_create (thread_main, info, FALSE, NULL);
 
-			if (priv->thread == NULL)
+			if (priv->thread == NULL) {
 				emit_queue_control_signals (self, TNY_SEND_QUEUE_STOP);
+			        if (TNY_IS_CAMEL_FOLDER (info->outbox)) {
+		        	        TnyCamelFolderPriv *opriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->outbox);
+					_tny_camel_folder_unreason (opriv);
+				}
+			        if (TNY_IS_CAMEL_FOLDER (info->sentbox)) {
+			                TnyCamelFolderPriv *spriv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox);
+			                _tny_camel_folder_unreason (spriv);
+			        }
+			}
 		}
 	}
 


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