#define MODEST_IS_MAIL_OPERATION_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_MAIL_OPERATION_QUEUE))
#define MODEST_MAIL_OPERATION_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_MAIL_OPERATION_QUEUE,ModestMailOperationQueueClass))
+typedef enum _ModestMailOperationQueueNotification {
+ MODEST_MAIL_OPERATION_QUEUE_OPERATION_ADDED,
+ MODEST_MAIL_OPERATION_QUEUE_OPERATION_REMOVED
+} ModestMailOperationQueueNotification;
+
typedef struct _ModestMailOperationQueue ModestMailOperationQueue;
typedef struct _ModestMailOperationQueueClass ModestMailOperationQueueClass;
struct _ModestMailOperationQueueClass {
GObjectClass parent_class;
+
+ /* Signals */
+ void (*queue_changed) (ModestMailOperationQueue *self,
+ ModestMailOperation *mail_op,
+ ModestMailOperationQueueNotification type);
};
/* member functions */
GType modest_mail_operation_queue_get_type (void) G_GNUC_CONST;
-ModestMailOperationQueue * modest_mail_operation_queue_get_instance (void);
+ModestMailOperationQueue * modest_mail_operation_queue_new (void);
+/**
+ * modest_mail_operation_queue_add:
+ * @op_queue: a #ModestMailOperationQueue
+ * @mail_op: the #ModestMailOperation that will be added to the queue
+ *
+ * Adds a mail operation at the end of the queue. It also adds a
+ * reference to the mail operation so the caller could free it
+ **/
void modest_mail_operation_queue_add (ModestMailOperationQueue *op_queue,
ModestMailOperation *mail_op);
+/**
+ * modest_mail_operation_queue_remove:
+ * @op_queue: a #ModestMailOperationQueue
+ * @mail_op: the #ModestMailOperation that will be removed from the queue
+ *
+ * Removes a mail operation from the queue. This method does not free
+ * the mail operation
+ **/
void modest_mail_operation_queue_remove (ModestMailOperationQueue *op_queue,
ModestMailOperation *mail_op);
-
+/**
+ * modest_mail_operation_queue_num_elements:
+ * @op_queue: a #ModestMailOperationQueue
+ *
+ * Gets the numeber of elements stored in #ModestMailOperationQueue.
+ **/
+guint
+modest_mail_operation_queue_num_elements (ModestMailOperationQueue *self);
+
+/**
+ * modest_mail_operation_queue_cancel:
+ * @op_queue: a #ModestMailOperationQueue
+ * @mail_op: the #ModestMailOperation that will be canceled
+ *
+ * Cancels a #ModestMailOperation if it's not finished and removes it
+ * from the queue
+ **/
void modest_mail_operation_queue_cancel (ModestMailOperationQueue *op_queue,
ModestMailOperation *mail_op);
-
+/**
+ * modest_mail_operation_queue_cancel_all:
+ * @op_queue: a #ModestMailOperationQueue
+ *
+ * Cancels all the unfinished #ModestMailOperation of the queue
+ **/
void modest_mail_operation_queue_cancel_all (ModestMailOperationQueue *op_queue);
G_END_DECLS