[evolution/email-factory-3-4: 24/38] Adjust the MultiOp thing a GObject affair.
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/email-factory-3-4: 24/38] Adjust the MultiOp thing a GObject affair.
- Date: Fri, 16 Dec 2011 11:56:28 +0000 (UTC)
commit f977945af4edf15e45e813f9bab8d33f76879938
Author: Srinivasa Ragavan <sragavan gnome org>
Date: Tue Nov 29 09:37:54 2011 +0200
Adjust the MultiOp thing a GObject affair.
libemail-engine/mail-ops.c | 49 ++++++++++++++++++++++++-------------------
libemail-engine/mail-ops.h | 4 +-
2 files changed, 29 insertions(+), 24 deletions(-)
---
diff --git a/libemail-engine/mail-ops.c b/libemail-engine/mail-ops.c
index 63ae92f..68e97cf 100644
--- a/libemail-engine/mail-ops.c
+++ b/libemail-engine/mail-ops.c
@@ -1705,64 +1705,69 @@ mail_disconnect_store (CamelStore *store)
/* Multi Operation holder */
-struct _multi_op_folder_msg {
+struct _multi_op_object_msg {
MailMsg base;
- CamelFolder *folder;
+ GObject *object;
gboolean ret;
- gboolean (*do_op) (CamelFolder *folder, gpointer data, GError **error);
+ gboolean (*do_op) (GObject *object, gpointer data, GError **error);
void (*done) (gboolean success, gpointer data, GError *error);
gpointer data;
};
static gchar *
-multi_op_folder_desc (struct _multi_op_folder_msg *m)
+multi_op_object_desc (struct _multi_op_object_msg *m)
{
gchar *res;
- res = g_strdup_printf(_("Operating on Folder '%s'"), camel_folder_get_full_name (m->folder));
+ if (CAMEL_IS_SERVICE(m->object))
+ res = g_strdup_printf(_("Operating on store '%p'"), camel_service_get_name ((CamelService *)m->object, TRUE));
+ else if (CAMEL_IS_FOLDER (m->object))
+ res = g_strdup_printf(_("Operating on folder '%p'"), camel_folder_get_full_name((CamelFolder *)m->object));
+ else
+ res = g_strdup_printf(_("Operating on object '%p'"), m->object);
return res;
}
static void
-multi_op_folder_exec (struct _multi_op_folder_msg *m)
+multi_op_object_exec (struct _multi_op_object_msg *m)
{
- m->ret = m->do_op (m->folder, m->data, &m->base.error);
+ m->ret = m->do_op (m->object, m->data, &m->base.error);
}
static void
-multi_op_folder_done (struct _multi_op_folder_msg *m)
+multi_op_object_done (struct _multi_op_object_msg *m)
{
if (m->done)
m->done(m->ret, m->data, m->base.error);
}
static void
-multi_op_folder_free (struct _multi_op_folder_msg *m)
+multi_op_object_free (struct _multi_op_object_msg *m)
{
- g_object_unref (m->folder);
+ g_object_unref (m->object);
}
-static MailMsgInfo multi_op_folder = {
- sizeof (struct _multi_op_folder_msg),
- (MailMsgDescFunc) multi_op_folder_desc,
- (MailMsgExecFunc) multi_op_folder_exec,
- (MailMsgDoneFunc) multi_op_folder_done,
- (MailMsgFreeFunc) multi_op_folder_free
+static MailMsgInfo multi_op_object = {
+ sizeof (struct _multi_op_object_msg),
+ (MailMsgDescFunc) multi_op_object_desc,
+ (MailMsgExecFunc) multi_op_object_exec,
+ (MailMsgDoneFunc) multi_op_object_done,
+ (MailMsgFreeFunc) multi_op_object_free
};
void
-mail_operate_on_folder(CamelFolder *folder,
- gboolean (*do_op) (CamelFolder *folder, gpointer data, GError **error),
+mail_operate_on_object(GObject *object,
+ gboolean (*do_op) (GObject *object, gpointer data, GError **error),
void (*done) (gboolean ret, gpointer data, GError *error),
gpointer data)
{
- struct _multi_op_folder_msg *m;
+ struct _multi_op_object_msg *m;
- m = mail_msg_new(&multi_op_folder);
- m->folder= folder;
- g_object_ref (folder);
+ m = mail_msg_new(&multi_op_object);
+ m->object= object;
+ g_object_ref (object);
m->data = data;
m->do_op = do_op;
m->done = done;
diff --git a/libemail-engine/mail-ops.h b/libemail-engine/mail-ops.h
index 958b110..e21214f 100644
--- a/libemail-engine/mail-ops.h
+++ b/libemail-engine/mail-ops.h
@@ -97,8 +97,8 @@ void mail_execute_shell_command (CamelFilterDriver *driver, gint argc, gchar **a
gint mail_disconnect_store (CamelStore *store);
-void mail_operate_on_folder (CamelFolder *folder,
- gboolean (*do_op) (CamelFolder *folder, gpointer data, GError **error),
+void mail_operate_on_object (GObject *object,
+ gboolean (*do_op) (GObject *object, gpointer data, GError **error),
void (*done) (gboolean ret, gpointer data, GError *error),
gpointer data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]