camel_operation_new() now returns a GCancellable pointer.
This commit is contained in:
@ -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 = {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 = {
|
||||
|
||||
@ -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 ();
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
Reference in New Issue
Block a user