aboutsummaryrefslogtreecommitdiffstats
path: root/mail/importers
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 /mail/importers
parent6ec1118c92dcdf1f8377efde3ea575b5bc94412a (diff)
downloadgsoc2013-evolution-e41b4083a60c2a8c4879ea3a7fc2e1d29a01720b.tar.gz
gsoc2013-evolution-e41b4083a60c2a8c4879ea3a7fc2e1d29a01720b.tar.zst
gsoc2013-evolution-e41b4083a60c2a8c4879ea3a7fc2e1d29a01720b.zip
camel_operation_new() now returns a GCancellable pointer.
Diffstat (limited to 'mail/importers')
-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
5 files changed, 33 insertions, 31 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 = {