Changeset 2445
- Timestamp:
- 07/10/07 16:50:57
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-send-queue.c (modified) (5 diffs)
- trunk/libtinymail/tny-send-queue.c (modified) (3 diffs)
- trunk/libtinymail/tny-send-queue.h (modified) (2 diffs)
- trunk/libtinymail/tny-signals-marshal.list (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r2444 r2445 1 2007-07-09 Javier Fernández García-Boente <jfernandez@igalia.com> 2 * Implements and emits msg-sending and msg-sent signals 3 when a message is just being sent and when is fully sent. 4 1 5 2007-07-10 Philip Van Hoof <pvanhoof@gnome.org> 2 6 trunk/libtinymail-camel/tny-camel-send-queue.c
r2409 r2445 54 54 gint i, total; 55 55 } ErrorInfo; 56 57 typedef struct { 58 TnySendQueue *self; 59 TnyMsg *msg; 60 TnyHeader *header; 61 gint i, total; 62 guint signal_id; 63 } ControlInfo; 56 64 57 65 static gboolean … … 102 110 } 103 111 112 113 static gboolean 114 emit_control_signals_on_mainloop (gpointer data) 115 { 116 ControlInfo *info = data; 117 g_signal_emit (info->self, tny_send_queue_signals [info->signal_id], 118 0, info->header, info->msg, info->i, info->total); 119 return FALSE; 120 } 121 122 static void 123 destroy_control_info (gpointer data) 124 { 125 ControlInfo *info = data; 126 127 if (info->msg) 128 g_object_unref (G_OBJECT (info->msg)); 129 if (info->header) 130 g_object_unref (G_OBJECT (info->header)); 131 if (info->self) 132 g_object_unref (G_OBJECT (info->self)); 133 134 g_slice_free (ControlInfo, info); 135 } 136 137 static void 138 emit_control (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, guint signal_id, int i, int total) 139 { 140 ControlInfo *info = g_slice_new0 (ControlInfo); 141 142 if (self) 143 info->self = TNY_SEND_QUEUE (g_object_ref (G_OBJECT (self))); 144 if (msg) 145 info->msg = TNY_MSG (g_object_ref (G_OBJECT (msg))); 146 if (header) 147 info->header = TNY_HEADER (g_object_ref (G_OBJECT (header))); 148 149 info->signal_id = signal_id; 150 info->i = i; 151 info->total = total; 152 153 g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, 154 emit_control_signals_on_mainloop, info, destroy_control_info); 155 156 return; 157 } 158 159 104 160 static gpointer 105 161 thread_main (gpointer data) … … 152 208 while (length > 0 && priv->do_continue) 153 209 { 154 TnyHeader *header ;210 TnyHeader *header = NULL; 155 211 TnyMsg *msg = NULL; 156 212 … … 230 286 msg = tny_folder_get_msg (outbox, header, &err); 231 287 232 /* hassent is owner now*/233 g_object_unref (G_OBJECT (header));234 288 /* Emits msg-sending signal to inform a new msg is being sent */ 289 emit_control (self, header, msg, TNY_SEND_QUEUE_MSG_SENDING, i, priv->total); 290 235 291 if (err == NULL) 236 292 { … … 268 324 g_error_free (err); 269 325 270 i++; 326 /* Emits msg-sent signal to inform msg has been sent */ 327 emit_control (self, header, msg, TNY_SEND_QUEUE_MSG_SENT, i, priv->total); 328 329 i++; 330 331 /* hassent is owner now */ 332 g_object_unref (G_OBJECT (header)); 271 333 } else 272 334 { trunk/libtinymail/tny-send-queue.c
r2206 r2445 141 141 static gboolean initialized = FALSE; 142 142 143 if (!initialized) 144 { 143 if (!initialized) { 144 /** 145 * TnySendQueue::msg-sending 146 * @self: the object on which the signal is emitted 147 * @arg1: The message that is being 148 * @arg2: The current nth number of the message that is being sending 149 * @arg3: The total amount of messages currently being processed 150 * 151 * API WARNING: This API might change 152 * 153 * Emitted when a message is being proccessed to sending it 154 **/ 155 tny_send_queue_signals[TNY_SEND_QUEUE_MSG_SENDING] = 156 g_signal_new ("msg_sending", 157 TNY_TYPE_SEND_QUEUE, 158 G_SIGNAL_RUN_FIRST, 159 G_STRUCT_OFFSET (TnySendQueueIface, msg_sending), 160 NULL, NULL, 161 tny_marshal_VOID__OBJECT_OBJECT_INT_INT, 162 G_TYPE_NONE, 4, TNY_TYPE_HEADER, TNY_TYPE_MSG, G_TYPE_UINT, G_TYPE_UINT); 163 164 145 165 /** 146 166 * TnySendQueue::msg-sent … … 152 172 **/ 153 173 tny_send_queue_signals[TNY_SEND_QUEUE_MSG_SENT] = 154 g_signal_new ("msg_sent",155 TNY_TYPE_SEND_QUEUE,156 G_SIGNAL_RUN_FIRST,157 G_STRUCT_OFFSET (TnySendQueueIface, msg_sent),158 NULL, NULL,159 g_cclosure_marshal_VOID__POINTER,160 G_TYPE_NONE, 1, TNY_TYPE_MSG);161 174 g_signal_new ("msg_sent", 175 TNY_TYPE_SEND_QUEUE, 176 G_SIGNAL_RUN_FIRST, 177 G_STRUCT_OFFSET (TnySendQueueIface, msg_sent), 178 NULL, NULL, 179 tny_marshal_VOID__OBJECT_OBJECT_INT_INT, 180 G_TYPE_NONE, 4, TNY_TYPE_HEADER, TNY_TYPE_MSG, G_TYPE_UINT, G_TYPE_UINT); 181 162 182 /** 163 183 * TnySendQueue::error-happened … … 172 192 **/ 173 193 tny_send_queue_signals[TNY_SEND_QUEUE_ERROR_HAPPENED] = 174 g_signal_new ("error_happened",175 TNY_TYPE_SEND_QUEUE,176 G_SIGNAL_RUN_FIRST,177 G_STRUCT_OFFSET (TnySendQueueIface, error_happened),178 NULL, NULL,179 tny_marshal_VOID__OBJECT_OBJECT_POINTER,180 G_TYPE_NONE, 3, TNY_TYPE_HEADER, TNY_TYPE_MSG, G_TYPE_POINTER);181 194 g_signal_new ("error_happened", 195 TNY_TYPE_SEND_QUEUE, 196 G_SIGNAL_RUN_FIRST, 197 G_STRUCT_OFFSET (TnySendQueueIface, error_happened), 198 NULL, NULL, 199 tny_marshal_VOID__OBJECT_OBJECT_POINTER, 200 G_TYPE_NONE, 3, TNY_TYPE_HEADER, TNY_TYPE_MSG, G_TYPE_POINTER); 201 182 202 initialized = TRUE; 183 203 } trunk/libtinymail/tny-send-queue.h
r2206 r2445 41 41 enum _TnySendQueueSignal 42 42 { 43 TNY_SEND_QUEUE_MSG_SENDING, 43 44 TNY_SEND_QUEUE_MSG_SENT, 44 45 TNY_SEND_QUEUE_ERROR_HAPPENED, … … 54 55 55 56 /* Signals */ 56 void (*msg_sent) (TnySendQueue *self, TnyMsg *msg, gpointer user_data); 57 void (*msg_sending) (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, guint nth, guint total); 58 void (*msg_sent) (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, guint nth, guint total); 57 59 void (*error_happened) (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, GError *err, gpointer user_data); 58 60 trunk/libtinymail/tny-signals-marshal.list
r2206 r2445 1 1 VOID:OBJECT,OBJECT,POINTER 2 VOID:OBJECT,OBJECT,INT,INT
