Changeset 3291
- Timestamp:
- 01/23/08 23:52:50
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-send-queue.c (modified) (4 diffs)
- trunk/libtinymail/tny-send-queue.c (modified) (1 diff)
- trunk/libtinymail/tny-send-queue.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r3290 r3291 6 6 (tny_send_queue_add_async): added this method that was available in 7 7 the Camel implementation to the interface 8 (create_worker) 9 (thread_main): added the "queue-start" and "queue-stop" signals that 10 are emitted before and after the queue processes the messages 8 11 9 12 2008-01-22 Philip Van Hoof <pvanhoof@gnome.org> trunk/libtinymail-camel/tny-camel-send-queue.c
r3290 r3291 175 175 tny_lockable_lock (apriv->session->priv->ui_lock); 176 176 g_signal_emit (info->self, tny_send_queue_signals [info->signal_id], 177 0, info->header, info->msg, info->i, info->total);177 0, info->header, info->msg, info->i, info->total); 178 178 if (apriv) 179 179 tny_lockable_unlock (apriv->session->priv->ui_lock); … … 282 282 } 283 283 284 285 static gboolean 286 emit_queue_control_signals_on_mainloop (gpointer data) 287 { 288 ControlInfo *info = data; 289 TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE (info->self); 290 TnyCamelAccountPriv *apriv = NULL; 291 292 if (priv && priv->trans_account) 293 apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (priv->trans_account); 294 if (apriv) 295 tny_lockable_lock (apriv->session->priv->ui_lock); 296 g_signal_emit (info->self, tny_send_queue_signals [info->signal_id], 0); 297 if (apriv) 298 tny_lockable_unlock (apriv->session->priv->ui_lock); 299 300 return NULL; 301 } 302 303 static void 304 emit_queue_control_signals (TnySendQueue *self, guint signal_id) 305 { 306 ControlInfo *info = g_slice_new0 (ControlInfo); 307 308 info->self = g_object_ref (self); 309 info->signal_id = signal_id; 310 311 g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, 312 emit_queue_control_signals_on_mainloop, info, 313 destroy_control_info); 314 315 return; 316 } 317 284 318 typedef struct { 285 319 TnySendQueue *self; … … 528 562 g_slice_free (MainThreadInfo, info); 529 563 564 /* Emit the queue-stop signal */ 565 emit_queue_control_signals (self, TNY_SEND_QUEUE_STOP); 566 530 567 return NULL; 531 568 } … … 542 579 543 580 if (spriv->device && TNY_IS_DEVICE (spriv->device)) { 544 MainThreadInfo *info = g_slice_new0 (MainThreadInfo); 581 MainThreadInfo *info; 582 583 info = g_slice_new0 (MainThreadInfo); 545 584 info->self = g_object_ref (self); 546 585 info->device = g_object_ref (spriv->device); 586 587 emit_queue_control_signals (self, TNY_SEND_QUEUE_START); 588 547 589 priv->thread = g_thread_create (thread_main, info, FALSE, NULL); 590 591 if (priv->thread == NULL) 592 emit_queue_control_signals (self, TNY_SEND_QUEUE_STOP); 548 593 } 549 594 } trunk/libtinymail/tny-send-queue.c
r3290 r3291 242 242 tny_marshal_VOID__OBJECT_OBJECT_POINTER, 243 243 G_TYPE_NONE, 3, TNY_TYPE_HEADER, TNY_TYPE_MSG, G_TYPE_POINTER); 244 245 /** 246 * TnySendQueue::queue-start 247 * @self: a #TnySendQueue, the object on which the signal is emitted 248 * 249 * Emitted when the queue starts to process messages 250 **/ 251 tny_send_queue_signals[TNY_SEND_QUEUE_START] = 252 g_signal_new ("queue-start", 253 TNY_TYPE_SEND_QUEUE, 254 G_SIGNAL_RUN_FIRST, 255 G_STRUCT_OFFSET (TnySendQueueIface, queue_start), 256 NULL, NULL, 257 g_cclosure_marshal_VOID__VOID, 258 G_TYPE_NONE, 0); 259 260 /** 261 * TnySendQueue::queue-stop 262 * @self: a #TnySendQueue, the object on which the signal is emitted 263 * 264 * Emitted when the queue stops to process messages 265 **/ 266 tny_send_queue_signals[TNY_SEND_QUEUE_STOP] = 267 g_signal_new ("queue-stop", 268 TNY_TYPE_SEND_QUEUE, 269 G_SIGNAL_RUN_FIRST, 270 G_STRUCT_OFFSET (TnySendQueueIface, queue_stop), 271 NULL, NULL, 272 g_cclosure_marshal_VOID__VOID, 273 G_TYPE_NONE, 0); 274 244 275 245 276 initialized = TRUE; trunk/libtinymail/tny-send-queue.h
r3290 r3291 46 46 TNY_SEND_QUEUE_MSG_SENT, 47 47 TNY_SEND_QUEUE_ERROR_HAPPENED, 48 TNY_SEND_QUEUE_START, 49 TNY_SEND_QUEUE_STOP, 48 50 TNY_SEND_QUEUE_LAST_SIGNAL 49 51 }; … … 66 68 void (*msg_sent) (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, guint nth, guint total); 67 69 void (*error_happened) (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, GError *err, gpointer user_data); 70 void (*queue_start) (TnySendQueue *self, gpointer user_data); 71 void (*queue_stop) (TnySendQueue *self, gpointer user_data); 68 72 69 73 /* methods */
