aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-09-29 21:32:50 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-09-29 21:33:36 +0800
commite41b4083a60c2a8c4879ea3a7fc2e1d29a01720b (patch)
tree86234111f2facee6e45c4247b33d0f9050ad706c
parent6ec1118c92dcdf1f8377efde3ea575b5bc94412a (diff)
downloadgsoc2013-evolution-e41b4083a60c2a8c4879ea3a7fc2e1d29a01720b.tar
gsoc2013-evolution-e41b4083a60c2a8c4879ea3a7fc2e1d29a01720b.tar.gz
gsoc2013-evolution-e41b4083a60c2a8c4879ea3a7fc2e1d29a01720b.tar.bz2
gsoc2013-evolution-e41b4083a60c2a8c4879ea3a7fc2e1d29a01720b.tar.lz
gsoc2013-evolution-e41b4083a60c2a8c4879ea3a7fc2e1d29a01720b.tar.xz
gsoc2013-evolution-e41b4083a60c2a8c4879ea3a7fc2e1d29a01720b.tar.zst
gsoc2013-evolution-e41b4083a60c2a8c4879ea3a7fc2e1d29a01720b.zip
camel_operation_new() now returns a GCancellable pointer.
-rw-r--r--mail/importers/elm-importer.c7
-rw-r--r--mail/importers/evolution-mbox-importer.c12
-rw-r--r--mail/importers/mail-importer.c26
-rw-r--r--mail/importers/mail-importer.h6
-rw-r--r--mail/importers/pine-importer.c13
-rw-r--r--mail/mail-mt.c2
-rw-r--r--mail/mail-ops.c22
-rw-r--r--mail/mail-send-recv.c6
-rw-r--r--modules/mail/e-mail-shell-view-private.h2
-rw-r--r--modules/mail/e-mail-shell-view.c14
-rw-r--r--plugins/dbx-import/dbx-importer.c2
-rw-r--r--plugins/pst-import/pst-importer.c2
12 files changed, 61 insertions, 53 deletions
diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c
index e6afc2bbac..0164378942 100644
--- a/mail/importers/elm-importer.c
+++ b/mail/importers/elm-importer.c
@@ -55,7 +55,7 @@ struct _elm_import_msg {
gchar *status_what;
gint status_pc;
gint status_timeout_id;
- CamelOperation *status;
+ GCancellable *status;
};
static GHashTable *
@@ -196,7 +196,8 @@ elm_import_exec (struct _elm_import_msg *m)
else
elmdir = g_strdup (maildir);
- mail_importer_import_folders_sync (elmdir, elm_special_folders, 0, m->status);
+ mail_importer_import_folders_sync (
+ elmdir, elm_special_folders, 0, m->status);
g_free (elmdir);
}
@@ -346,7 +347,7 @@ elm_cancel (EImport *ei, EImportTarget *target, EImportImporter *im)
struct _elm_import_msg *m = g_datalist_get_data(&target->data, "elm-msg");
if (m)
- camel_operation_cancel (m->status);
+ g_cancellable_cancel (m->status);
}
static EImportImporter elm_importer = {
diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c
index a929b6b06d..460777073a 100644
--- a/mail/importers/evolution-mbox-importer.c
+++ b/mail/importers/evolution-mbox-importer.c
@@ -64,7 +64,7 @@ typedef struct {
gchar *status_what;
gint status_pc;
gint status_timeout_id;
- CamelOperation *cancel; /* cancel/status port */
+ GCancellable *cancellable; /* cancel/status port */
gchar *uri;
} MboxImporter;
@@ -206,7 +206,7 @@ mbox_import_done (gpointer data, GError **error)
g_source_remove (importer->status_timeout_id);
g_free (importer->status_what);
g_mutex_free (importer->status_lock);
- g_object_unref (importer->cancel);
+ g_object_unref (importer->cancellable);
e_import_complete (importer->import, importer->target);
g_free (importer);
@@ -226,16 +226,16 @@ mbox_import (EImport *ei, EImportTarget *target, EImportImporter *im)
importer->target = target;
importer->status_lock = g_mutex_new ();
importer->status_timeout_id = g_timeout_add (100, mbox_status_timeout, importer);
- importer->cancel = camel_operation_new ();
+ importer->cancellable = camel_operation_new ();
g_signal_connect (
- importer->cancel, "status",
+ importer->cancellable, "status",
G_CALLBACK (mbox_status), importer);
filename = g_filename_from_uri (((EImportTargetURI *)target)->uri_src, NULL, NULL);
mail_importer_import_mbox (
filename, ((EImportTargetURI *)target)->uri_dest,
- importer->cancel, mbox_import_done, importer);
+ importer->cancellable, mbox_import_done, importer);
g_free (filename);
}
@@ -245,7 +245,7 @@ mbox_cancel (EImport *ei, EImportTarget *target, EImportImporter *im)
MboxImporter *importer = g_datalist_get_data(&target->data, "mbox-data");
if (importer)
- camel_operation_cancel (importer->cancel);
+ g_cancellable_cancel (importer->cancellable);
}
static MboxImporterCreatePreviewFunc create_preview_func = NULL;
diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c
index b70b6b0c0c..08d0141f84 100644
--- a/mail/importers/mail-importer.c
+++ b/mail/importers/mail-importer.c
@@ -52,7 +52,7 @@ struct _import_mbox_msg {
gchar *path;
gchar *uri;
- CamelOperation *cancel;
+ GCancellable *cancellable;
void (*done)(gpointer data, GError **error);
gpointer done_data;
@@ -212,8 +212,8 @@ import_mbox_done (struct _import_mbox_msg *m)
static void
import_mbox_free (struct _import_mbox_msg *m)
{
- if (m->cancel)
- g_object_unref (m->cancel);
+ if (m->cancellable)
+ g_object_unref (m->cancellable);
g_free (m->uri);
g_free (m->path);
}
@@ -227,7 +227,7 @@ static MailMsgInfo import_mbox_info = {
};
gint
-mail_importer_import_mbox (const gchar *path, const gchar *folderuri, CamelOperation *cancel, void (*done)(gpointer data, GError **), gpointer data)
+mail_importer_import_mbox (const gchar *path, const gchar *folderuri, GCancellable *cancellable, void (*done)(gpointer data, GError **), gpointer data)
{
struct _import_mbox_msg *m;
gint id;
@@ -237,8 +237,8 @@ mail_importer_import_mbox (const gchar *path, const gchar *folderuri, CamelOpera
m->uri = g_strdup (folderuri);
m->done = done;
m->done_data = data;
- if (cancel)
- m->cancel = g_object_ref (cancel);
+ if (cancellable)
+ m->cancellable = g_object_ref (cancellable);
id = m->base.seq;
mail_msg_fast_ordered_push (m);
@@ -247,15 +247,15 @@ mail_importer_import_mbox (const gchar *path, const gchar *folderuri, CamelOpera
}
void
-mail_importer_import_mbox_sync (const gchar *path, const gchar *folderuri, CamelOperation *cancel)
+mail_importer_import_mbox_sync (const gchar *path, const gchar *folderuri, GCancellable *cancellable)
{
struct _import_mbox_msg *m;
m = mail_msg_new (&import_mbox_info);
m->path = g_strdup (path);
m->uri = g_strdup (folderuri);
- if (cancel)
- m->cancel = g_object_ref (cancel);
+ if (cancellable)
+ m->cancellable = g_object_ref (cancellable);
import_mbox_exec (m);
import_mbox_done (m);
@@ -264,7 +264,7 @@ mail_importer_import_mbox_sync (const gchar *path, const gchar *folderuri, Camel
struct _import_folders_data {
MailImporterSpecial *special_folders;
- CamelOperation *cancel;
+ GCancellable *cancellable;
guint elmfmt:1;
};
@@ -319,7 +319,7 @@ import_folders_rec (struct _import_folders_data *m, const gchar *filepath, const
}
printf("importing to uri %s\n", uri);
- mail_importer_import_mbox_sync (filefull, uri, m->cancel);
+ mail_importer_import_mbox_sync (filefull, uri, m->cancellable);
g_free (uri);
/* This little gem re-uses the stat buffer and filefull to automagically scan mozilla-format folders */
@@ -363,13 +363,13 @@ import_folders_rec (struct _import_folders_data *m, const gchar *filepath, const
* standard unix directories.
**/
void
-mail_importer_import_folders_sync (const gchar *filepath, MailImporterSpecial special_folders[], gint flags, CamelOperation *cancel)
+mail_importer_import_folders_sync (const gchar *filepath, MailImporterSpecial special_folders[], gint flags, GCancellable *cancellable)
{
struct _import_folders_data m;
m.special_folders = special_folders;
m.elmfmt = (flags & MAIL_IMPORTER_MOZFMT) == 0;
- m.cancel = cancel;
+ m.cancellable = cancellable;
import_folders_rec (&m, filepath, NULL);
}
diff --git a/mail/importers/mail-importer.h b/mail/importers/mail-importer.h
index 9c8c531226..12caadaeac 100644
--- a/mail/importers/mail-importer.h
+++ b/mail/importers/mail-importer.h
@@ -46,8 +46,8 @@ EImportImporter *pine_importer_peek (void);
#define MSG_FLAG_MARKED 0x0004
#define MSG_FLAG_EXPUNGED 0x0008
-gint mail_importer_import_mbox (const gchar *path, const gchar *folderuri, CamelOperation *cancel, void (*done)(gpointer data, GError **), gpointer data);
-void mail_importer_import_mbox_sync (const gchar *path, const gchar *folderuri, CamelOperation *cancel);
+gint mail_importer_import_mbox (const gchar *path, const gchar *folderuri, GCancellable *cancellable, void (*done)(gpointer data, GError **), gpointer data);
+void mail_importer_import_mbox_sync (const gchar *path, const gchar *folderuri, GCancellable *cancellable);
struct _MailImporterSpecial {
const gchar *orig, *new;
@@ -58,6 +58,6 @@ typedef struct _MailImporterSpecial MailImporterSpecial;
#define MAIL_IMPORTER_MOZFMT (1<<0)
/* api in flux */
-void mail_importer_import_folders_sync (const gchar *filepath, MailImporterSpecial special_folders[], gint flags, CamelOperation *cancel);
+void mail_importer_import_folders_sync (const gchar *filepath, MailImporterSpecial special_folders[], gint flags, GCancellable *cancellable);
#endif
diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c
index 4a7397c953..ad9b7d331a 100644
--- a/mail/importers/pine-importer.c
+++ b/mail/importers/pine-importer.c
@@ -58,7 +58,7 @@ struct _pine_import_msg {
gchar *status_what;
gint status_pc;
gint status_timeout_id;
- CamelOperation *status;
+ GCancellable *cancellable;
};
static gboolean
@@ -237,7 +237,8 @@ pine_import_exec (struct _pine_import_msg *m)
gchar *path;
path = g_build_filename(g_get_home_dir(), "mail", NULL);
- mail_importer_import_folders_sync (path, pine_special_folders, 0, m->status);
+ mail_importer_import_folders_sync (
+ path, pine_special_folders, 0, m->cancellable);
g_free (path);
}
}
@@ -264,7 +265,7 @@ pine_import_done (struct _pine_import_msg *m)
static void
pine_import_free (struct _pine_import_msg *m)
{
- g_object_unref (m->status);
+ g_object_unref (m->cancellable);
g_free (m->status_what);
g_mutex_free (m->status_lock);
@@ -334,10 +335,10 @@ mail_importer_pine_import (EImport *ei,
m->status_timeout_id = g_timeout_add (
100, (GSourceFunc) pine_status_timeout, m);
m->status_lock = g_mutex_new ();
- m->status = camel_operation_new ();
+ m->cancellable = camel_operation_new ();
g_signal_connect (
- m->status, "status",
+ m->cancellable, "status",
G_CALLBACK (pine_status), m);
id = m->base.seq;
@@ -427,7 +428,7 @@ pine_cancel (EImport *ei, EImportTarget *target, EImportImporter *im)
struct _pine_import_msg *m = g_datalist_get_data(&target->data, "pine-msg");
if (m)
- camel_operation_cancel (m->status);
+ g_cancellable_cancel (m->cancellable);
}
static EImportImporter pine_importer = {
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 87f6b251bf..d5f1761e35 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -89,7 +89,7 @@ mail_msg_new (MailMsgInfo *info)
msg->info = info;
msg->ref_count = 1;
msg->seq = mail_msg_seq++;
- msg->cancellable = (GCancellable *) camel_operation_new ();
+ msg->cancellable = camel_operation_new ();
msg->priv = g_slice_new0 (MailMsgPrivate);
msg->priv->activity = e_activity_new ();
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 4852d53b87..1146f8d126 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1918,7 +1918,7 @@ struct _get_message_msg {
void (*done) (CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data);
gpointer data;
CamelMimeMessage *message;
- CamelOperation *cancel;
+ GCancellable *cancellable;
};
static gchar *
@@ -1950,7 +1950,7 @@ get_message_free (struct _get_message_msg *m)
{
g_free (m->uid);
g_object_unref (m->folder);
- g_object_unref (m->cancel);
+ g_object_unref (m->cancellable);
if (m->message)
g_object_unref (m->message);
@@ -1978,7 +1978,7 @@ mail_get_message (CamelFolder *folder, const gchar *uid, void (*done) (CamelFold
m->uid = g_strdup (uid);
m->data = data;
m->done = (void (*) (CamelFolder *, const gchar *, CamelMimeMessage *, gpointer )) done;
- m->cancel = camel_operation_new ();
+ m->cancellable = camel_operation_new ();
id = m->base.seq;
dispatch (m);
@@ -1991,10 +1991,16 @@ typedef void (*get_done)(CamelFolder *folder, const gchar *uid, CamelMimeMessage
static void
get_messagex_done (struct _get_message_msg *m)
{
- if (m->done && !camel_operation_cancel_check (m->cancel)) {
- get_done done = (get_done)m->done;
- done (m->folder, m->uid, m->message, m->data, &m->base.error);
- }
+ get_done done;
+
+ if (!m->done)
+ return;
+
+ if (camel_operation_cancel_check (CAMEL_OPERATION (m->cancellable)))
+ return;
+
+ done = (get_done)m->done;
+ done (m->folder, m->uid, m->message, m->data, &m->base.error);
}
static MailMsgInfo get_messagex_info = {
@@ -2027,7 +2033,7 @@ mail_get_messagex (CamelFolder *folder,
m->uid = g_strdup (uid);
m->data = data;
m->done = (void (*) (CamelFolder *, const gchar *, CamelMimeMessage *, gpointer )) done;
- m->cancel = camel_operation_new ();
+ m->cancellable = camel_operation_new ();
id = m->base.seq;
dispatch (m);
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 3dcba97c71..f83c6daea9 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -529,7 +529,7 @@ build_dialog (GtkWindow *parent,
info->uri = g_strdup (source->url);
info->keep_on_server = source->keep_on_server;
- info->cancellable = (GCancellable *) camel_operation_new ();
+ info->cancellable = camel_operation_new ();
info->state = SEND_ACTIVE;
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
@@ -619,7 +619,7 @@ build_dialog (GtkWindow *parent,
info->uri = g_strdup (destination);
info->keep_on_server = FALSE;
- info->cancellable = (GCancellable *) camel_operation_new ();
+ info->cancellable = camel_operation_new ();
info->state = SEND_ACTIVE;
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
@@ -1250,7 +1250,7 @@ mail_receive_uri (const gchar *uri, gboolean keep_on_server)
info->status_label = NULL;
info->uri = g_strdup (uri);
info->keep_on_server = keep_on_server;
- info->cancellable = (GCancellable *) camel_operation_new ();
+ info->cancellable = camel_operation_new ();
info->cancel_button = NULL;
info->data = data;
info->state = SEND_ACTIVE;
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index f023e1b263..9fbfadde31 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -153,7 +153,7 @@ struct _EMailShellViewPrivate {
/* Search folders for interactive search. */
CamelVeeFolder *search_account_all;
CamelVeeFolder *search_account_current;
- CamelOperation *search_account_cancel;
+ GCancellable *search_account_cancel;
guint show_deleted : 1;
};
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 4d0bb6ac91..0e9a66c2ad 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -44,7 +44,7 @@ typedef struct {
MailMsg base;
CamelFolder *folder;
- CamelOperation *cancel;
+ GCancellable *cancellable;
GList *folder_list;
} SearchResultsMsg;
@@ -94,7 +94,7 @@ static MailMsgInfo search_results_setup_info = {
static gint
mail_shell_view_setup_search_results_folder (CamelFolder *folder,
GList *folder_list,
- CamelOperation *cancel)
+ GCancellable *cancellable)
{
SearchResultsMsg *msg;
gint id;
@@ -103,7 +103,7 @@ mail_shell_view_setup_search_results_folder (CamelFolder *folder,
msg = mail_msg_new (&search_results_setup_info);
msg->folder = folder;
- msg->cancel = cancel;
+ msg->cancellable = cancellable;
msg->folder_list = folder_list;
id = msg->base.seq;
@@ -501,7 +501,7 @@ all_accounts:
}
if (priv->search_account_cancel != NULL) {
- camel_operation_cancel (priv->search_account_cancel);
+ g_cancellable_cancel (priv->search_account_cancel);
g_object_unref (priv->search_account_cancel);
priv->search_account_cancel = NULL;
}
@@ -534,7 +534,7 @@ all_accounts:
/* If we already have a search folder, reuse it. */
if (search_folder != NULL) {
if (priv->search_account_cancel != NULL) {
- camel_operation_cancel (priv->search_account_cancel);
+ g_cancellable_cancel (priv->search_account_cancel);
g_object_unref (priv->search_account_cancel);
priv->search_account_cancel = NULL;
}
@@ -620,7 +620,7 @@ current_account:
}
if (priv->search_account_cancel != NULL) {
- camel_operation_cancel (priv->search_account_cancel);
+ g_cancellable_cancel (priv->search_account_cancel);
g_object_unref (priv->search_account_cancel);
priv->search_account_cancel = NULL;
}
@@ -653,7 +653,7 @@ current_account:
/* If we already have a search folder, reuse it. */
if (search_folder != NULL) {
if (priv->search_account_cancel != NULL) {
- camel_operation_cancel (priv->search_account_cancel);
+ g_cancellable_cancel (priv->search_account_cancel);
g_object_unref (priv->search_account_cancel);
priv->search_account_cancel = NULL;
}
diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c
index 72b4e04c99..c4f1d462c1 100644
--- a/plugins/dbx-import/dbx-importer.c
+++ b/plugins/dbx-import/dbx-importer.c
@@ -743,7 +743,7 @@ org_gnome_evolution_readdbx_import (EImport *ei, EImportTarget *target, EImportI
m->status_timeout_id = g_timeout_add (100, dbx_status_timeout, m);
/*m->status_timeout_id = NULL;*/
m->status_lock = g_mutex_new ();
- m->cancellable = (GCancellable *) camel_operation_new ();
+ m->cancellable = camel_operation_new ();
g_signal_connect (
m->cancellable, "status",
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index e320445130..8a42d0d5ef 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -1624,7 +1624,7 @@ pst_import (EImport *ei, EImportTarget *target)
m->status_timeout_id = g_timeout_add (100, pst_status_timeout, m);
/*m->status_timeout_id = NULL;*/
m->status_lock = g_mutex_new ();
- m->status = (GCancellable *) camel_operation_new ();
+ m->cancellable = camel_operation_new ();
g_signal_connect (
m->status, "status",