Adapt to CamelOperation API changes.

This commit is contained in:
Matthew Barnes
2010-09-14 23:16:38 -04:00
parent 47d25995c5
commit 5310e4a0b1
13 changed files with 99 additions and 122 deletions

View File

@ -461,7 +461,7 @@ sub_folderinfo_exec (struct _emse_folderinfo_msg *m)
CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST |
CAMEL_STORE_FOLDER_INFO_RECURSIVE,
&m->base.error);
camel_operation_unregister (m->base.cancel);
camel_operation_unregister ();
}
}

View File

@ -219,7 +219,7 @@ elm_import_done (struct _elm_import_msg *m)
static void
elm_import_free (struct _elm_import_msg *m)
{
camel_operation_unref (m->status);
g_object_unref (m->status);
g_free (m->status_what);
g_mutex_free (m->status_lock);
@ -235,11 +235,6 @@ elm_status (CamelOperation *op, const gchar *what, gint pc, gpointer data)
{
struct _elm_import_msg *importer = data;
if (pc == CAMEL_OPERATION_START)
pc = 0;
else if (pc == CAMEL_OPERATION_END)
pc = 100;
g_mutex_lock (importer->status_lock);
g_free (importer->status_what);
importer->status_what = g_strdup (what);
@ -288,7 +283,11 @@ mail_importer_elm_import (EImport *ei, EImportTarget *target)
m->target = (EImportTargetHome *)target;
m->status_timeout_id = g_timeout_add (100, elm_status_timeout, m);
m->status_lock = g_mutex_new ();
m->status = camel_operation_new (elm_status, m);
m->status = camel_operation_new ();
g_signal_connect (
m->status, "status",
G_CALLBACK (elm_status), m);
id = m->base.seq;

View File

@ -171,11 +171,6 @@ mbox_status (CamelOperation *op, const gchar *what, gint pc, gpointer data)
{
MboxImporter *importer = data;
if (pc == CAMEL_OPERATION_START)
pc = 0;
else if (pc == CAMEL_OPERATION_END)
pc = 100;
g_mutex_lock (importer->status_lock);
g_free (importer->status_what);
importer->status_what = g_strdup (what);
@ -211,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);
camel_operation_unref (importer->cancel);
g_object_unref (importer->cancel);
e_import_complete (importer->import, importer->target);
g_free (importer);
@ -231,7 +226,11 @@ 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 (mbox_status, importer);
importer->cancel = camel_operation_new ();
g_signal_connect (
importer->cancel, "status",
G_CALLBACK (mbox_status), importer);
filename = g_filename_from_uri (((EImportTargetURI *)target)->uri_src, NULL, NULL);
mail_importer_import_mbox (

View File

@ -215,7 +215,7 @@ static void
import_mbox_free (struct _import_mbox_msg *m)
{
if (m->cancel)
camel_operation_unref (m->cancel);
g_object_unref (m->cancel);
g_free (m->uri);
g_free (m->path);
}
@ -239,10 +239,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 = cancel;
camel_operation_ref (cancel);
}
if (cancel)
m->cancel = g_object_ref (cancel);
id = m->base.seq;
mail_msg_fast_ordered_push (m);
@ -258,10 +256,8 @@ mail_importer_import_mbox_sync (const gchar *path, const gchar *folderuri, Camel
m = mail_msg_new (&import_mbox_info);
m->path = g_strdup (path);
m->uri = g_strdup (folderuri);
if (cancel) {
m->cancel = cancel;
camel_operation_ref (cancel);
}
if (cancel)
m->cancel = g_object_ref (cancel);
import_mbox_exec (m);
import_mbox_done (m);

View File

@ -264,7 +264,7 @@ pine_import_done (struct _pine_import_msg *m)
static void
pine_import_free (struct _pine_import_msg *m)
{
camel_operation_unref (m->status);
g_object_unref (m->status);
g_free (m->status_what);
g_mutex_free (m->status_lock);
@ -283,11 +283,6 @@ pine_status (CamelOperation *op,
{
struct _pine_import_msg *importer = data;
if (pc == CAMEL_OPERATION_START)
pc = 0;
else if (pc == CAMEL_OPERATION_END)
pc = 100;
g_mutex_lock (importer->status_lock);
g_free (importer->status_what);
importer->status_what = g_strdup (what);
@ -339,7 +334,11 @@ 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 (pine_status, m);
m->status = camel_operation_new ();
g_signal_connect (
m->status, "status",
G_CALLBACK (pine_status), m);
id = m->base.seq;

View File

@ -75,10 +75,16 @@ mail_msg_new (MailMsgInfo *info)
msg->info = info;
msg->ref_count = 1;
msg->seq = mail_msg_seq++;
msg->cancel = camel_operation_new (mail_operation_status, GINT_TO_POINTER (msg->seq));
msg->cancel = camel_operation_new ();
msg->priv = g_slice_new0 (MailMsgPrivate);
msg->priv->cancelable = TRUE;
g_signal_connect (
msg->cancel, "status",
G_CALLBACK (mail_operation_status),
GINT_TO_POINTER (msg->seq));
g_hash_table_insert (mail_msg_active_table, GINT_TO_POINTER (msg->seq), msg);
d(printf("New message %p\n", msg));
@ -140,10 +146,8 @@ mail_msg_free (MailMsg *mail_msg)
if (mail_msg->priv->activity != NULL)
g_object_unref (mail_msg->priv->activity);
if (mail_msg->cancel != NULL) {
camel_operation_mute (mail_msg->cancel);
camel_operation_unref (mail_msg->cancel);
}
if (mail_msg->cancel != NULL)
g_object_unref (mail_msg->cancel);
if (mail_msg->error != NULL)
g_error_free (mail_msg->error);
@ -470,7 +474,7 @@ mail_msg_proxy (MailMsg *msg)
if (msg->info->desc != NULL && msg->cancel) {
camel_operation_end (msg->cancel);
camel_operation_unregister (msg->cancel);
camel_operation_unregister ();
}
g_async_queue_push (msg_reply_queue, msg);
@ -979,14 +983,6 @@ mail_operation_status (CamelOperation *op,
m = mail_msg_new (&op_status_info);
m->op = op;
m->what = g_strdup (what);
switch (pc) {
case CAMEL_OPERATION_START:
pc = 0;
break;
case CAMEL_OPERATION_END:
pc = 100;
break;
}
m->pc = pc;
m->data = data;
mail_msg_main_loop_push (m);

View File

@ -99,7 +99,7 @@ em_filter_folder_element_exec (struct _filter_mail_msg *m)
if (folder == NULL || camel_folder_get_message_count (folder) == 0) {
if (m->cancel)
camel_operation_unregister (m->cancel);
camel_operation_unregister ();
return;
}
@ -137,7 +137,7 @@ em_filter_folder_element_exec (struct _filter_mail_msg *m)
m->driver = NULL;
if (m->cancel)
camel_operation_unregister (m->cancel);
camel_operation_unregister ();
}
static void
@ -155,7 +155,7 @@ em_filter_folder_element_free (struct _filter_mail_msg *m)
em_utils_uids_free (m->source_uids);
if (m->cancel)
camel_operation_unref (m->cancel);
g_object_unref (m->cancel);
if (m->destination)
g_object_unref (m->destination);
@ -187,10 +187,8 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids,
m->source_uids = uids;
m->cache = NULL;
m->delete = FALSE;
if (cancel) {
m->cancel = cancel;
camel_operation_ref (cancel);
}
if (cancel)
m->cancel = g_object_ref (cancel);
m->driver = camel_session_get_filter_driver (session, type, NULL);
@ -347,7 +345,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
}
fail:
if (m->cancel)
camel_operation_unregister (m->cancel);
camel_operation_unregister ();
/* we unref this here as it may have more work to do (syncing
folders and whatnot) before we are really done */
@ -370,7 +368,7 @@ fetch_mail_free (struct _fetch_mail_msg *m)
{
g_free (m->source_uri);
if (m->cancel)
camel_operation_unref (m->cancel);
g_object_unref (m->cancel);
em_filter_folder_element_free ((struct _filter_mail_msg *) m);
}
@ -398,10 +396,8 @@ mail_fetch_mail (const gchar *source, gint keep, const gchar *type, CamelOperati
m->source_uri = g_strdup (source);
fm->delete = !keep;
fm->cache = NULL;
if (cancel) {
m->cancel = cancel;
camel_operation_ref (cancel);
}
if (cancel)
m->cancel = g_object_ref (cancel);
m->done = done;
m->data = data;
@ -846,10 +842,7 @@ send_queue_exec (struct _send_queue_msg *m)
if (!m->cancel)
camel_operation_end (NULL);
if (m->cancel)
camel_operation_unregister (m->cancel);
else
camel_operation_unregister (m->base.cancel);
camel_operation_unregister ();
}
@ -874,7 +867,7 @@ send_queue_free (struct _send_queue_msg *m)
g_object_unref (m->queue);
g_free (m->destination);
if (m->cancel)
camel_operation_unref (m->cancel);
g_object_unref (m->cancel);
}
static MailMsgInfo send_queue_info = {
@ -900,9 +893,8 @@ mail_send_queue (CamelFolder *queue, const gchar *destination,
g_object_ref (queue);
m->destination = g_strdup (destination);
if (cancel) {
m->cancel = cancel;
camel_operation_ref (cancel);
camel_operation_unref (m->base.cancel);
m->cancel = g_object_ref (cancel);
g_object_unref (m->base.cancel);
mail_msg_set_cancelable (m, FALSE);
m->base.cancel = NULL;
@ -1179,9 +1171,8 @@ mail_get_folderinfo (CamelStore *store, CamelOperation *op, gboolean (*done)(Cam
m = mail_msg_new (&get_folderinfo_info);
if (op) {
camel_operation_unref (m->base.cancel);
m->base.cancel = op;
camel_operation_ref (op);
g_object_unref (m->base.cancel);
m->base.cancel = g_object_ref (op);
}
m->store = store;
g_object_ref (store);
@ -1455,9 +1446,8 @@ mail_get_store (const gchar *uri, CamelOperation *op, void (*done) (gchar *uri,
m = mail_msg_new (&get_store_info);
if (op) {
camel_operation_unref (m->base.cancel);
m->base.cancel = op;
camel_operation_ref (op);
g_object_unref (m->base.cancel);
m->base.cancel = g_object_ref (op);
}
m->uri = g_strdup (uri);
m->data = data;
@ -1912,7 +1902,7 @@ get_message_free (struct _get_message_msg *m)
{
g_free (m->uid);
g_object_unref (m->folder);
camel_operation_unref (m->cancel);
g_object_unref (m->cancel);
if (m->message)
g_object_unref (m->message);
@ -1940,7 +1930,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 (NULL, NULL);
m->cancel = camel_operation_new ();
id = m->base.seq;
dispatch (m);
@ -1989,7 +1979,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 (NULL, NULL);
m->cancel = camel_operation_new ();
id = m->base.seq;
dispatch (m);
@ -2389,7 +2379,7 @@ prep_offline_exec (struct _prep_offline_msg *m)
}
if (m->cancel)
camel_operation_unregister (m->cancel);
camel_operation_unregister ();
}
static void
@ -2403,7 +2393,7 @@ static void
prep_offline_free (struct _prep_offline_msg *m)
{
if (m->cancel)
camel_operation_unref (m->cancel);
g_object_unref (m->cancel);
g_free (m->uri);
}
@ -2426,7 +2416,7 @@ mail_prep_offline (const gchar *uri,
m = mail_msg_new (&prep_offline_info);
m->cancel = cancel;
if (cancel)
camel_operation_ref (cancel);
g_object_ref (cancel);
m->uri = g_strdup (uri);
m->data = data;
m->done = done;
@ -2643,7 +2633,7 @@ check_service_exec (struct _check_msg *m)
service = camel_session_get_service (session, m->url, m->type, &m->base.error);
if (!service) {
camel_operation_unregister (m->base.cancel);
camel_operation_unregister ();
return;
}

View File

@ -146,7 +146,7 @@ free_send_info (struct _send_info *info)
{
g_free (info->uri);
if (info->cancel)
camel_operation_unref (info->cancel);
g_object_unref (info->cancel);
if (info->timeout_id != 0)
g_source_remove (info->timeout_id);
g_free (info->what);
@ -325,20 +325,11 @@ set_send_account (struct _send_info *info, const gchar *account_url)
/* for camel operation status */
static void
operation_status (CamelOperation *op, const gchar *what, gint pc, gpointer data)
operation_status (CamelOperation *op,
const gchar *what,
gint pc,
struct _send_info *info)
{
struct _send_info *info = data;
/*printf("Operation '%s', percent %d\n");*/
switch (pc) {
case CAMEL_OPERATION_START:
pc = 0;
break;
case CAMEL_OPERATION_END:
pc = 100;
break;
}
set_send_status (info, what, pc);
}
@ -538,10 +529,14 @@ build_dialog (GtkWindow *parent,
info->uri = g_strdup (source->url);
info->keep_on_server = source->keep_on_server;
info->cancel = camel_operation_new (operation_status, info);
info->cancel = camel_operation_new ();
info->state = SEND_ACTIVE;
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
g_signal_connect (
info->cancel, "status",
G_CALLBACK (operation_status), info);
g_hash_table_insert (data->active, info->uri, info);
list = g_list_prepend (list, info);
} else if (info->progress_bar != NULL) {
@ -624,10 +619,14 @@ build_dialog (GtkWindow *parent,
info->uri = g_strdup (destination);
info->keep_on_server = FALSE;
info->cancel = camel_operation_new (operation_status, info);
info->cancel = camel_operation_new ();
info->state = SEND_ACTIVE;
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
g_signal_connect (
info->cancel, "status",
G_CALLBACK (operation_status), info);
g_hash_table_insert (data->active, (gpointer) SEND_URI_KEY, info);
list = g_list_prepend (list, info);
} else if (info->timeout_id == 0)
@ -1240,12 +1239,16 @@ 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->cancel = camel_operation_new (operation_status, info);
info->cancel = camel_operation_new ();
info->cancel_button = NULL;
info->data = data;
info->state = SEND_ACTIVE;
info->timeout_id = 0;
g_signal_connect (
info->cancel, "status",
G_CALLBACK (operation_status), info);
d(printf("Adding new info %p\n", info));
g_hash_table_insert (data->active, info->uri, info);

View File

@ -635,9 +635,8 @@ static gpointer ms_thread_msg_new (CamelSession *session, CamelSessionThreadOps
MailMsg *m = mail_msg_new (&ms_thread_info_dummy);
msg->data = m;
camel_operation_unref (msg->op);
msg->op = m->cancel;
camel_operation_ref (msg->op);
g_object_unref (msg->op);
msg->op = g_object_ref (m->cancel);
}
return msg;

View File

@ -730,7 +730,7 @@ e_mail_shell_view_private_dispose (EMailShellView *mail_shell_view)
}
if (priv->search_account_cancel != NULL) {
camel_operation_unref (priv->search_account_cancel);
g_object_unref (priv->search_account_cancel);
priv->search_account_cancel = NULL;
}
}

View File

@ -504,7 +504,7 @@ all_accounts:
if (priv->search_account_cancel != NULL) {
camel_operation_cancel (priv->search_account_cancel);
camel_operation_unref (priv->search_account_cancel);
g_object_unref (priv->search_account_cancel);
priv->search_account_cancel = NULL;
}
@ -537,7 +537,7 @@ all_accounts:
if (search_folder != NULL) {
if (priv->search_account_cancel != NULL) {
camel_operation_cancel (priv->search_account_cancel);
camel_operation_unref (priv->search_account_cancel);
g_object_unref (priv->search_account_cancel);
priv->search_account_cancel = NULL;
}
@ -589,7 +589,7 @@ all_accounts:
camel_vee_folder_set_expression (search_folder, query);
priv->search_account_cancel = camel_operation_new (NULL, NULL);
priv->search_account_cancel = camel_operation_new ();
/* This takes ownership of the folder list. */
mail_shell_view_setup_search_results_folder (
@ -621,7 +621,7 @@ current_account:
if (priv->search_account_cancel != NULL) {
camel_operation_cancel (priv->search_account_cancel);
camel_operation_unref (priv->search_account_cancel);
g_object_unref (priv->search_account_cancel);
priv->search_account_cancel = NULL;
}
@ -654,7 +654,7 @@ current_account:
if (search_folder != NULL) {
if (priv->search_account_cancel != NULL) {
camel_operation_cancel (priv->search_account_cancel);
camel_operation_unref (priv->search_account_cancel);
g_object_unref (priv->search_account_cancel);
priv->search_account_cancel = NULL;
}
@ -688,7 +688,7 @@ current_account:
camel_vee_folder_set_expression (search_folder, query);
priv->search_account_cancel = camel_operation_new (NULL, NULL);
priv->search_account_cancel = camel_operation_new ();
/* This takes ownership of the folder list. */
mail_shell_view_setup_search_results_folder (

View File

@ -671,7 +671,7 @@ dbx_import_imported (DbxImporter *m)
static void
dbx_import_free (DbxImporter *m)
{
camel_operation_unref (m->status);
g_object_unref (m->status);
g_free (m->status_what);
g_mutex_free (m->status_lock);
@ -719,12 +719,6 @@ dbx_status (CamelOperation *op, const gchar *what, gint pc, gpointer data)
{
DbxImporter *importer = data;
if (pc == CAMEL_OPERATION_START) {
pc = 0;
} else if (pc == CAMEL_OPERATION_END) {
pc = 100;
}
g_mutex_lock (importer->status_lock);
g_free (importer->status_what);
importer->status_what = g_strdup (what);
@ -752,7 +746,11 @@ 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->status = camel_operation_new (dbx_status, m);
m->status = camel_operation_new ();
g_signal_connect (
m->status, "status",
G_CALLBACK (dbx_status), m);
id = m->base.seq;

View File

@ -1540,7 +1540,7 @@ static void
pst_import_free (PstImporter *m)
{
// pst_close (&m->pst);
camel_operation_unref (m->status);
g_object_unref (m->status);
g_free (m->status_what);
g_mutex_free (m->status_lock);
@ -1588,12 +1588,6 @@ pst_status (CamelOperation *op, const gchar *what, gint pc, gpointer data)
{
PstImporter *importer = data;
if (pc == CAMEL_OPERATION_START) {
pc = 0;
} else if (pc == CAMEL_OPERATION_END) {
pc = 100;
}
g_mutex_lock (importer->status_lock);
g_free (importer->status_what);
importer->status_what = g_strdup (what);
@ -1625,7 +1619,11 @@ 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 = camel_operation_new (pst_status, m);
m->status = camel_operation_new ();
g_signal_connect (
m->status, "status",
G_CALLBACK (pst_status), m);
id = m->base.seq;