diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-09-15 11:16:38 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-09-15 11:48:02 +0800 |
commit | 5310e4a0b10ded4c77ce9dfaff49d3e99e327462 (patch) | |
tree | b29d85e7bb2e7b3e772859fa7e0e2ff9ab33846e /mail | |
parent | 47d25995c5ca78ff530ce6a23faebf6547898e8e (diff) | |
download | gsoc2013-evolution-5310e4a0b10ded4c77ce9dfaff49d3e99e327462.tar gsoc2013-evolution-5310e4a0b10ded4c77ce9dfaff49d3e99e327462.tar.gz gsoc2013-evolution-5310e4a0b10ded4c77ce9dfaff49d3e99e327462.tar.bz2 gsoc2013-evolution-5310e4a0b10ded4c77ce9dfaff49d3e99e327462.tar.lz gsoc2013-evolution-5310e4a0b10ded4c77ce9dfaff49d3e99e327462.tar.xz gsoc2013-evolution-5310e4a0b10ded4c77ce9dfaff49d3e99e327462.tar.zst gsoc2013-evolution-5310e4a0b10ded4c77ce9dfaff49d3e99e327462.zip |
Adapt to CamelOperation API changes.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/em-subscribe-editor.c | 2 | ||||
-rw-r--r-- | mail/importers/elm-importer.c | 13 | ||||
-rw-r--r-- | mail/importers/evolution-mbox-importer.c | 13 | ||||
-rw-r--r-- | mail/importers/mail-importer.c | 14 | ||||
-rw-r--r-- | mail/importers/pine-importer.c | 13 | ||||
-rw-r--r-- | mail/mail-mt.c | 24 | ||||
-rw-r--r-- | mail/mail-ops.c | 58 | ||||
-rw-r--r-- | mail/mail-send-recv.c | 37 | ||||
-rw-r--r-- | mail/mail-session.c | 5 |
9 files changed, 80 insertions, 99 deletions
diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c index 57b5e3dcb9..39ec661013 100644 --- a/mail/em-subscribe-editor.c +++ b/mail/em-subscribe-editor.c @@ -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 (); } } diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c index 80d4c474bc..e6afc2bbac 100644 --- a/mail/importers/elm-importer.c +++ b/mail/importers/elm-importer.c @@ -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; diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c index affebd74b6..51d8796648 100644 --- a/mail/importers/evolution-mbox-importer.c +++ b/mail/importers/evolution-mbox-importer.c @@ -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 ( diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c index d00725533a..ddc9f66300 100644 --- a/mail/importers/mail-importer.c +++ b/mail/importers/mail-importer.c @@ -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); diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c index c2c0ec22d7..4a7397c953 100644 --- a/mail/importers/pine-importer.c +++ b/mail/importers/pine-importer.c @@ -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; diff --git a/mail/mail-mt.c b/mail/mail-mt.c index b8bfba3d29..ce26572756 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -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); diff --git a/mail/mail-ops.c b/mail/mail-ops.c index defa166a42..1303daee81 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -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; } diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 4d84fd0284..c7d1b3c0b4 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -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); diff --git a/mail/mail-session.c b/mail/mail-session.c index 4725a2eea8..c3ba26cb10 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -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; |