Re: [PATCH] resubmission for the add-tny_camel_send_queue_new_with_folders() patch
- From: "Martin Bonnin" <martinbonnin gmail com>
- To: "Philip Van Hoof" <spam pvanhoof be>
- Cc: tinymail-devel-list <tinymail-devel-list gnome org>
- Subject: Re: [PATCH] resubmission for the add-tny_camel_send_queue_new_with_folders() patch
- Date: Sun, 26 Oct 2008 17:21:19 +0100
2008/10/26 Philip Van Hoof
<spam pvanhoof be>
On Sun, 2008-10-26 at 17:01 +0100, Martin Bonnin wrote:
>
> +TnySendQueue*
> +tny_camel_send_queue_new_with_folders (TnyCamelTransportAccount
> *trans_account, TnyFolder *outbox, TnyFolder *sentbox)
> +{
> + TnyCamelSendQueue *self = g_object_new
> (TNY_TYPE_CAMEL_SEND_QUEUE, NULL);
> + TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE
> (self);
> +
> + g_assert (TNY_IS_CAMEL_TRANSPORT_ACCOUNT (trans_account));
> + priv->outbox_cache = g_object_ref(outbox);
> + priv->sentbox_cache = g_object_ref(sentbox);
You are leaking the existing outbox_cache and sentbox_cache here.
Add these in front of the lines:
if (priv->sentbox_cache)
g_object_unref (priv->sentbox_cache);
if (priv->outbox_cache)
g_object_unref (priv->outbox_cache);
It's not likely that they'll be filled in,
Yes, the cache folders are null just after object creation.
but it's good practice
nonetheless to do this.
Ok, attached the revised patch
--
Martin
Index: libtinymail-camel/tny-camel-send-queue.c
===================================================================
--- libtinymail-camel/tny-camel-send-queue.c (révision 3788)
+++ libtinymail-camel/tny-camel-send-queue.c (copie de travail)
@@ -1297,6 +1297,37 @@
return TNY_SEND_QUEUE (self);
}
+/**
+ * tny_camel_send_queue_new_with_folders:
+ * @trans_account: A #TnyCamelTransportAccount instance
+ *
+ * Create a new #TnySendQueue instance implemented for Camel,
+ * Using custom-supplied outbox and sentbox
+ *
+ * Return value: A new #TnySendQueue instance implemented for Camel
+ **/
+TnySendQueue*
+tny_camel_send_queue_new_with_folders (TnyCamelTransportAccount *trans_account, TnyFolder *outbox, TnyFolder *sentbox)
+{
+ TnyCamelSendQueue *self = g_object_new (TNY_TYPE_CAMEL_SEND_QUEUE, NULL);
+ TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE (self);
+
+ g_assert (TNY_IS_CAMEL_TRANSPORT_ACCOUNT (trans_account));
+
+ if (priv->sentbox_cache)
+ g_object_unref (priv->sentbox_cache);
+ if (priv->outbox_cache)
+ g_object_unref (priv->outbox_cache);
+
+ priv->outbox_cache = g_object_ref(outbox);
+ priv->sentbox_cache = g_object_ref(sentbox);
+
+ tny_camel_send_queue_set_transport_account (self, trans_account);
+
+ return TNY_SEND_QUEUE (self);
+}
+
+
static void
on_setonline_happened (TnyCamelAccount *account, gboolean online, gpointer user_data)
{
Index: libtinymail-camel/tny-camel-send-queue.h
===================================================================
--- libtinymail-camel/tny-camel-send-queue.h (révision 3788)
+++ libtinymail-camel/tny-camel-send-queue.h (copie de travail)
@@ -60,6 +60,8 @@
TnySendQueue* tny_camel_send_queue_new (TnyCamelTransportAccount *trans_account);
+TnySendQueue* tny_camel_send_queue_new_with_folders (TnyCamelTransportAccount *trans_account, TnyFolder *outbox, TnyFolder *sentbox);
+
void tny_camel_send_queue_flush (TnyCamelSendQueue *self);
TnyCamelTransportAccount* tny_camel_send_queue_get_transport_account (TnyCamelSendQueue *self);
Index: ChangeLog
===================================================================
--- ChangeLog (révision 3788)
+++ ChangeLog (copie de travail)
@@ -1,3 +1,9 @@
+2008-10-26 Rob Taylor <rob taylor codethink co uk>
+ & Martin Bonnin <martinbonnin gmail com>
+
+ * Re-submission for the add-tny_camel_send_queue_new_with_folders() patch:
+ It allows to create a Camel SendQueue with user-supplied outbox and sendbox
+
2008-10-24 Rob Taylor <rob taylor codethink co uk>
& Martin Bonnin <martinbonnin gmail com>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]