diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-09-21 11:13:43 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-09-28 23:35:55 +0800 |
commit | 31b57ed0383b2ea225195d4b72a872f7f2d93163 (patch) | |
tree | 2d70adcce04ed1ed5111c06cd7ad93266419b0e0 /plugins | |
parent | a91eeb647138ee035444cdc3c265fa4e95898f29 (diff) | |
download | gsoc2013-evolution-31b57ed0383b2ea225195d4b72a872f7f2d93163.tar gsoc2013-evolution-31b57ed0383b2ea225195d4b72a872f7f2d93163.tar.gz gsoc2013-evolution-31b57ed0383b2ea225195d4b72a872f7f2d93163.tar.bz2 gsoc2013-evolution-31b57ed0383b2ea225195d4b72a872f7f2d93163.tar.lz gsoc2013-evolution-31b57ed0383b2ea225195d4b72a872f7f2d93163.tar.xz gsoc2013-evolution-31b57ed0383b2ea225195d4b72a872f7f2d93163.tar.zst gsoc2013-evolution-31b57ed0383b2ea225195d4b72a872f7f2d93163.zip |
Adapt to Camel API changes.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/audio-inline/audio-inline.c | 5 | ||||
-rw-r--r-- | plugins/bogo-junk-plugin/bf-junk-filter.c | 31 | ||||
-rw-r--r-- | plugins/dbx-import/dbx-importer.c | 29 | ||||
-rw-r--r-- | plugins/groupwise-features/install-shared.c | 7 | ||||
-rw-r--r-- | plugins/groupwise-features/proxy.c | 2 | ||||
-rw-r--r-- | plugins/groupwise-features/share-folder-common.c | 4 | ||||
-rw-r--r-- | plugins/groupwise-features/status-track.c | 2 | ||||
-rw-r--r-- | plugins/image-inline/image-inline.c | 3 | ||||
-rw-r--r-- | plugins/itip-formatter/itip-formatter.c | 4 | ||||
-rw-r--r-- | plugins/mail-to-task/mail-to-task.c | 4 | ||||
-rw-r--r-- | plugins/mark-all-read/mark-all-read.c | 4 | ||||
-rw-r--r-- | plugins/prefer-plain/prefer-plain.c | 2 | ||||
-rw-r--r-- | plugins/pst-import/pst-importer.c | 34 | ||||
-rw-r--r-- | plugins/sa-junk-plugin/em-junk-filter.c | 59 | ||||
-rw-r--r-- | plugins/templates/templates.c | 15 | ||||
-rw-r--r-- | plugins/tnef-attachments/tnef-plugin.c | 7 | ||||
-rw-r--r-- | plugins/vcard-inline/vcard-inline.c | 3 |
17 files changed, 116 insertions, 99 deletions
diff --git a/plugins/audio-inline/audio-inline.c b/plugins/audio-inline/audio-inline.c index 994e25b267..3aebff938e 100644 --- a/plugins/audio-inline/audio-inline.c +++ b/plugins/audio-inline/audio-inline.c @@ -210,8 +210,9 @@ org_gnome_audio_inline_play_clicked (GtkWidget *button, EMFormatHTMLPObject *pob stream = camel_stream_fs_new_with_name (po->filename, O_RDWR | O_CREAT | O_TRUNC, 0600, NULL); data = camel_medium_get_content (CAMEL_MEDIUM (po->part)); - camel_data_wrapper_decode_to_stream (data, stream, NULL); - camel_stream_flush (stream, NULL); + camel_data_wrapper_decode_to_stream_sync ( + data, stream, NULL, NULL); + camel_stream_flush (stream, NULL, NULL); g_object_unref (stream); d(printf ("audio inline formatter: init gst playbin\n")); diff --git a/plugins/bogo-junk-plugin/bf-junk-filter.c b/plugins/bogo-junk-plugin/bf-junk-filter.c index c335f6d46f..ddaf200af2 100644 --- a/plugins/bogo-junk-plugin/bf-junk-filter.c +++ b/plugins/bogo-junk-plugin/bf-junk-filter.c @@ -71,7 +71,12 @@ gpointer em_junk_bf_validate_binary (EPlugin *ep, EMJunkTarget *target); void em_junk_bf_report_junk (EPlugin *ep, EMJunkTarget *target); void em_junk_bf_report_non_junk (EPlugin *ep, EMJunkTarget *target); void em_junk_bf_commit_reports (EPlugin *ep, EMJunkTarget *target); -static gint pipe_to_bogofilter (CamelMimeMessage *msg, const gchar **argv, GError **error); + +static gint +pipe_to_bogofilter (CamelMimeMessage *msg, + const gchar **argv, + GCancellable *cancellable, + GError **error); /* eplugin stuff */ gint e_plugin_lib_enable (EPlugin *ep, gint enable); @@ -97,7 +102,8 @@ init_db (void) camel_mime_parser_scan_from (parser, FALSE); g_object_unref (stream); - camel_mime_part_construct_from_parser ((CamelMimePart *) msg, parser, NULL); + camel_mime_part_construct_from_parser_sync ( + (CamelMimePart *) msg, parser, NULL, NULL); g_object_unref (parser); d(fprintf (stderr, "Initing the bogofilter DB with Welcome message\n")); @@ -106,13 +112,16 @@ init_db (void) argv[2] = "--unicode=yes"; } - pipe_to_bogofilter (msg, argv, NULL); + pipe_to_bogofilter (msg, argv, NULL, NULL); g_object_unref (msg); } static gint -pipe_to_bogofilter (CamelMimeMessage *msg, const gchar **argv, GError **error) +pipe_to_bogofilter (CamelMimeMessage *msg, + const gchar **argv, + GCancellable *cancellable, + GError **error) { GPid child_pid; gint bf_in; @@ -164,10 +173,10 @@ retry: } stream = camel_stream_fs_new_with_fd (bf_in); - camel_data_wrapper_write_to_stream ( - CAMEL_DATA_WRAPPER (msg), stream, NULL); - camel_stream_flush (stream, NULL); - camel_stream_close (stream, NULL); + camel_data_wrapper_write_to_stream_sync ( + CAMEL_DATA_WRAPPER (msg), stream, cancellable, NULL); + camel_stream_flush (stream, cancellable, NULL); + camel_stream_close (stream, cancellable, NULL); g_object_unref (stream); #ifndef G_OS_WIN32 @@ -265,7 +274,7 @@ em_junk_bf_check_junk (EPlugin *ep, EMJunkTarget *target) argv[1] = "--unicode=yes"; } - rv = pipe_to_bogofilter (msg, argv, &target->error); + rv = pipe_to_bogofilter (msg, argv, NULL, &target->error); d(fprintf (stderr, "em_junk_bf_check_junk rv = %d\n", rv)); @@ -293,7 +302,7 @@ em_junk_bf_report_junk (EPlugin *ep, EMJunkTarget *target) argv[2] = "--unicode=yes"; } - pipe_to_bogofilter (msg, argv, &target->error); + pipe_to_bogofilter (msg, argv, NULL, &target->error); } void @@ -317,7 +326,7 @@ em_junk_bf_report_non_junk (EPlugin *ep, EMJunkTarget *target) argv[2] = "--unicode=yes"; } - pipe_to_bogofilter (msg, argv, &target->error); + pipe_to_bogofilter (msg, argv, NULL, &target->error); } void diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c index fd3825762c..72b4e04c99 100644 --- a/plugins/dbx-import/dbx-importer.c +++ b/plugins/dbx-import/dbx-importer.c @@ -104,7 +104,7 @@ typedef struct { gchar *status_what; gint status_pc; gint status_timeout_id; - CamelOperation *status; + GCancellable *cancellable; guint32 *indices; guint32 index_count; @@ -551,7 +551,7 @@ dbx_import_file (DbxImporter *m) filename = g_filename_from_uri (((EImportTargetURI *)m->target)->uri_src, NULL, NULL); m->parent_uri = g_strdup (((EImportTargetURI *)m->target)->uri_dest); /* Destination folder, was set in our widget */ - camel_operation_start (NULL, _("Importing '%s'"), filename); + camel_operation_push_message (NULL, _("Importing '%s'"), filename); folder = mail_tool_uri_to_folder ( m->parent_uri, CAMEL_STORE_FOLDER_CREATE, m->base.cancellable, &m->base.error); @@ -592,7 +592,7 @@ dbx_import_file (DbxImporter *m) gboolean success; camel_operation_progress (NULL, 100 * i / m->index_count); - camel_operation_progress (m->status, 100 * i / m->index_count); + camel_operation_progress (m->cancellable, 100 * i / m->index_count); if (!dbx_read_email (m, m->indices[i], tmpfile, &dbx_flags)) { d(printf("Cannot read email index %d at %x\n", @@ -615,7 +615,8 @@ dbx_import_file (DbxImporter *m) camel_mime_parser_init_with_fd (mp, tmpfile); msg = camel_mime_message_new (); - if (camel_mime_part_construct_from_parser ((CamelMimePart *)msg, mp, NULL) == -1) { + if (!camel_mime_part_construct_from_parser_sync ( + (CamelMimePart *)msg, mp, NULL, NULL)) { /* set exception? */ g_object_unref (msg); g_object_unref (mp); @@ -624,7 +625,7 @@ dbx_import_file (DbxImporter *m) info = camel_message_info_new (NULL); camel_message_info_set_flags (info, flags, ~0); - success = camel_folder_append_message ( + success = camel_folder_append_message_sync ( folder, msg, info, NULL, m->base.cancellable, &m->base.error); camel_message_info_free (info); @@ -641,7 +642,7 @@ dbx_import_file (DbxImporter *m) if (m->indices) g_free (m->indices); /* FIXME Not passing GCancellable or GError here. */ - camel_folder_sync (folder, FALSE, NULL, NULL); + camel_folder_synchronize_sync (folder, FALSE, NULL, NULL); camel_folder_thaw (folder); g_object_unref (folder); if (missing && m->base.error == NULL) { @@ -651,19 +652,13 @@ dbx_import_file (DbxImporter *m) "bodies were not present in the DBX file", m->index_count - missing, missing); } - camel_operation_end (NULL); + camel_operation_pop_message (NULL); } static void dbx_import_import (DbxImporter *m) { - CamelOperation *oldcancel = NULL; - - oldcancel = camel_operation_register (m->status); - dbx_import_file (m); - - camel_operation_register (oldcancel); } static void @@ -675,8 +670,6 @@ dbx_import_imported (DbxImporter *m) static void dbx_import_free (DbxImporter *m) { - g_object_unref (m->status); - g_free (m->status_what); g_mutex_free (m->status_lock); @@ -750,10 +743,10 @@ 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 (); + m->cancellable = (GCancellable *) camel_operation_new (); g_signal_connect ( - m->status, "status", + m->cancellable, "status", G_CALLBACK (dbx_status), m); id = m->base.seq; @@ -767,7 +760,7 @@ org_gnome_evolution_readdbx_cancel (EImport *ei, EImportTarget *target, EImportI DbxImporter *m = g_datalist_get_data (&target->data, "dbx-msg"); if (m) { - camel_operation_cancel (m->status); + g_cancellable_cancel (m->cancellable); } } diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c index b753653229..92d5ae6aab 100644 --- a/plugins/groupwise-features/install-shared.c +++ b/plugins/groupwise-features/install-shared.c @@ -104,7 +104,8 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) if (e_gw_connection_accept_shared_folder (cnc, folder_name, container_id, (gchar *)item_id, NULL) == E_GW_CONNECTION_STATUS_OK) { /* FIXME Not passing a GCancellable or GError here. */ - folder = camel_store_get_folder (store, "Mailbox", 0, NULL, NULL); + folder = camel_store_get_folder_sync ( + store, "Mailbox", 0, NULL, NULL); /*changes = camel_folder_change_info_new (); camel_folder_change_info_remove_uid (changes, (gchar *) item_id); camel_folder_summary_remove_uid (folder->summary, item_id);*/ @@ -210,8 +211,8 @@ org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target) byte_array = g_byte_array_new (); stream = camel_stream_mem_new_with_byte_array (byte_array); - camel_data_wrapper_write_to_stream (dw, stream, NULL); - camel_stream_write (stream, "", 1, NULL); + camel_data_wrapper_write_to_stream_sync (dw, stream, NULL, NULL); + camel_stream_write (stream, "", 1, NULL, NULL); from_addr = camel_mime_message_get_from ((CamelMimeMessage *)target->message); if (from_addr && camel_internet_address_get (from_addr, 0, &name, &email)) { diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c index 5a01a6c281..beb1c94b30 100644 --- a/plugins/groupwise-features/proxy.c +++ b/plugins/groupwise-features/proxy.c @@ -664,7 +664,7 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data) priv->builder_tab = gtk_builder_new (); e_load_ui_builder_definition (priv->builder_tab, "proxy-listing.ui"); - if (account->enabled && (store->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL)) { + if (account->enabled && camel_offline_store_get_online (store)) { priv->tab_dialog = GTK_WIDGET (e_builder_get_widget (priv->builder_tab, "proxy_vbox")); priv->tree = GTK_TREE_VIEW (e_builder_get_widget (priv->builder_tab, "proxy_access_list")); priv->store = gtk_tree_store_new (2, diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c index 9a345f1ba6..e4d8dc30c7 100644 --- a/plugins/groupwise-features/share-folder-common.c +++ b/plugins/groupwise-features/share-folder-common.c @@ -142,12 +142,12 @@ create_folder_exec (struct _EMCreateFolder *m) { d(printf ("creating folder parent='%s' name='%s' full_name='%s'\n", m->parent, m->name, m->full_name)); - if ((m->fi = camel_store_create_folder ( + if ((m->fi = camel_store_create_folder_sync ( m->store, m->parent, m->name, m->base.cancellable, &m->base.error))) { if (camel_store_supports_subscriptions (m->store)) - camel_store_subscribe_folder ( + camel_store_subscribe_folder_sync ( m->store, m->full_name, m->base.cancellable, &m->base.error); } diff --git a/plugins/groupwise-features/status-track.c b/plugins/groupwise-features/status-track.c index 61c1ac25f0..f964c643ee 100644 --- a/plugins/groupwise-features/status-track.c +++ b/plugins/groupwise-features/status-track.c @@ -74,7 +74,7 @@ get_selected_message (EShellView *shell_view, *selected_uid = g_strdup (g_ptr_array_index (uids, 0)); /* FIXME Not passing a GCancellable or GError here. */ - msg = camel_folder_get_message ( + msg = camel_folder_get_message_sync ( *folder, *selected_uid, NULL, NULL); } diff --git a/plugins/image-inline/image-inline.c b/plugins/image-inline/image-inline.c index 41b4a898dd..994726d47b 100644 --- a/plugins/image-inline/image-inline.c +++ b/plugins/image-inline/image-inline.c @@ -361,7 +361,8 @@ org_gnome_image_inline_decode (ImageInlinePObject *image_object) /* Stream takes ownership of the byte array. */ stream = camel_stream_mem_new_with_byte_array (array); data_wrapper = camel_medium_get_content (medium); - camel_data_wrapper_decode_to_stream (data_wrapper, stream, NULL); + camel_data_wrapper_decode_to_stream_sync ( + data_wrapper, stream, NULL, NULL); /* Don't trust the content type in the MIME part. It could * be lying or it could be "application/octet-stream". Let diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 15fdf6f9e1..db2b5d0c85 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -2574,7 +2574,7 @@ format_itip (EPlugin *ep, EMFormatHookTarget *target) byte_array = g_byte_array_new (); stream = camel_stream_mem_new_with_byte_array (byte_array); - camel_data_wrapper_decode_to_stream (content, stream, NULL); + camel_data_wrapper_decode_to_stream_sync (content, stream, NULL, NULL); if (byte_array->len == 0) puri->vcalendar = NULL; @@ -2761,6 +2761,6 @@ itip_attachment_frame (EMFormat *emf, emf, stream, info->puri.part, info->handle, cancellable, FALSE); - camel_stream_close (stream, NULL); + camel_stream_close (stream, cancellable, NULL); } diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c index 88d9d09e3a..38c49c895d 100644 --- a/plugins/mail-to-task/mail-to-task.c +++ b/plugins/mail-to-task/mail-to-task.c @@ -203,7 +203,7 @@ set_description (ECalComponent *comp, CamelMimeMessage *message) byte_array = g_byte_array_new (); stream = camel_stream_mem_new_with_byte_array (byte_array); - camel_data_wrapper_decode_to_stream (content, stream, NULL); + camel_data_wrapper_decode_to_stream_sync (content, stream, NULL, NULL); str = g_strndup ((gchar *) byte_array->data, byte_array->len); g_object_unref (stream); @@ -781,7 +781,7 @@ do_mail_to_event (AsyncData *data) /* retrieve the message from the CamelFolder */ /* FIXME Not passing a GCancellable or GError. */ - message = camel_folder_get_message ( + message = camel_folder_get_message_sync ( folder, g_ptr_array_index (uids, i), NULL, NULL); if (!message) { diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c index 10d0eae5e9..ffbbbccb2e 100644 --- a/plugins/mark-all-read/mark-all-read.c +++ b/plugins/mark-all-read/mark-all-read.c @@ -360,7 +360,7 @@ mar_all_sub_folders (CamelStore *store, return FALSE; } - folder = camel_store_get_folder ( + folder = camel_store_get_folder_sync ( store, fi->full_name, 0, cancellable, error); if (folder == NULL) return FALSE; @@ -392,7 +392,7 @@ mar_got_folder (gchar *folder_uri, parent_store = camel_folder_get_parent_store (folder); /* FIXME Not passing a GCancellable or GError here. */ - folder_info = camel_store_get_folder_info ( + folder_info = camel_store_get_folder_info_sync ( parent_store, full_name, CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL); diff --git a/plugins/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c index f82a217f9a..9fce56d65c 100644 --- a/plugins/prefer-plain/prefer-plain.c +++ b/plugins/prefer-plain/prefer-plain.c @@ -175,7 +175,7 @@ org_gnome_prefer_plain_multipart_alternative (gpointer ep, EMFormatHookTarget *t } return; } else if (!CAMEL_IS_MULTIPART (mp)) { - em_format_format_source (t->format, t->stream, t->part); + em_format_format_source (t->format, t->stream, t->part, NULL); return; } diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index 7bd0138618..e320445130 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -115,11 +115,11 @@ struct _PstImporter { gchar *status_what; gint status_pc; gint status_timeout_id; - CamelOperation *status; + GCancellable *status; pst_file pst; - CamelOperation *cancel; + GCancellable *cancellable; CamelFolder *folder; gchar *parent_uri; gchar *folder_name; @@ -381,10 +381,6 @@ open_ecal (ECalSourceType type, const gchar *name) static void pst_import_import (PstImporter *m) { - CamelOperation *oldcancel = NULL; - - oldcancel = camel_operation_register (m->status); - if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-addr"))) { /* Hack - grab the first address book we can find TODO - add a selection mechanism in get_widget */ @@ -437,7 +433,6 @@ pst_import_import (PstImporter *m) g_object_unref (m->journal); } */ - camel_operation_register (oldcancel); } static void @@ -451,7 +446,7 @@ pst_import_file (PstImporter *m) filename = g_filename_from_uri (((EImportTargetURI *)m->target)->uri_src, NULL, NULL); m->parent_uri = g_strdup (((EImportTargetURI *)m->target)->uri_dest); /* Destination folder, was set in our widget */ - camel_operation_start (NULL, _("Importing '%s'"), filename); + camel_operation_push_message (NULL, _("Importing '%s'"), filename); if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-mail"))) { mail_tool_uri_to_folder ( @@ -463,7 +458,7 @@ pst_import_file (PstImporter *m) if (ret < 0) { g_free (filename); - camel_operation_end (NULL); + camel_operation_pop_message (NULL); return; } @@ -488,7 +483,7 @@ pst_import_file (PstImporter *m) camel_operation_progress (NULL, 4); - camel_operation_end (NULL); + camel_operation_pop_message (NULL); pst_freeItem (item); @@ -559,7 +554,8 @@ pst_process_item (PstImporter *m, pst_desc_tree *d_ptr) if (item->folder != NULL) { pst_process_folder (m, item); - camel_operation_start (NULL, _("Importing '%s'"), item->file_as.str); + camel_operation_push_message ( + NULL, _("Importing '%s'"), item->file_as.str); } else { if (m->folder_count && (m->current_item < m->folder_count)) { camel_operation_progress (NULL, (m->current_item * 100) / m->folder_count); @@ -605,7 +601,7 @@ pst_process_item (PstImporter *m, pst_desc_tree *d_ptr) pst_freeItem (item); if (d_ptr->next == NULL) { - camel_operation_end (NULL); + camel_operation_pop_message (NULL); } } @@ -829,7 +825,7 @@ pst_process_email (PstImporter *m, pst_item *item) /*g_message (" Email headers... %s...", item->email->header);*/ stream = camel_stream_mem_new_with_buffer (item->email->header.str, strlen (item->email->header.str)); - if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)msg, stream, NULL) == -1) + if (!camel_data_wrapper_construct_from_stream_sync ((CamelDataWrapper *)msg, stream, NULL, NULL)) g_warning ("Error reading headers, skipped"); } else { @@ -924,13 +920,13 @@ pst_process_email (PstImporter *m, pst_item *item) camel_message_info_set_flags (info, CAMEL_MESSAGE_DRAFT, ~0); /* FIXME Not passing a GCancellable or GError here. */ - success = camel_folder_append_message ( + success = camel_folder_append_message_sync ( m->folder, msg, info, NULL, NULL, NULL); camel_message_info_free (info); g_object_unref (msg); /* FIXME Not passing a GCancellable or GError here. */ - camel_folder_sync (m->folder, FALSE, NULL, NULL); + camel_folder_synchronize_sync (m->folder, FALSE, NULL, NULL); camel_folder_thaw (m->folder); if (!success) { @@ -1249,8 +1245,8 @@ set_cal_attachments (ECal *cal, ECalComponent *ec, PstImporter *m, pst_item_atta content = camel_medium_get_content (CAMEL_MEDIUM (part)); - if (camel_data_wrapper_decode_to_stream (content, stream, NULL) == -1 - || camel_stream_flush (stream, NULL) == -1) + if (camel_data_wrapper_decode_to_stream_sync (content, stream, NULL, NULL) == -1 + || camel_stream_flush (stream, NULL, NULL) == -1) { g_warning ("Could not write attachment to %s: %s", path, g_strerror (errno)); g_object_unref (stream); @@ -1628,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 = camel_operation_new (); + m->status = (GCancellable *) camel_operation_new (); g_signal_connect ( m->status, "status", @@ -1662,7 +1658,7 @@ org_credativ_evolution_readpst_cancel (EImport *ei, EImportTarget *target, EImpo PstImporter *m = g_datalist_get_data (&target->data, "pst-msg"); if (m) { - camel_operation_cancel (m->status); + g_cancellable_cancel (m->status); } } diff --git a/plugins/sa-junk-plugin/em-junk-filter.c b/plugins/sa-junk-plugin/em-junk-filter.c index 277350e5de..260fe935a6 100644 --- a/plugins/sa-junk-plugin/em-junk-filter.c +++ b/plugins/sa-junk-plugin/em-junk-filter.c @@ -98,7 +98,14 @@ gchar *em_junk_sa_spamc_gconf_binary = NULL; gchar *em_junk_sa_spamd_gconf_binary = NULL; static gint -pipe_to_sa_full (CamelMimeMessage *msg, const gchar *in, const gchar **argv, gint rv_err, gint wait_for_termination, GByteArray *output_buffer, GError **error) +pipe_to_sa_full (CamelMimeMessage *msg, + const gchar *in, + const gchar **argv, + gint rv_err, + gint wait_for_termination, + GByteArray *output_buffer, + GCancellable *cancellable, + GError **error) { gint result, status, errnosav, fds[2], out_fds[2]; CamelStream *stream; @@ -186,25 +193,27 @@ pipe_to_sa_full (CamelMimeMessage *msg, const gchar *in, const gchar **argv, gin if (msg) { stream = camel_stream_fs_new_with_fd (fds[1]); - camel_data_wrapper_write_to_stream ( - CAMEL_DATA_WRAPPER (msg), stream, NULL); - camel_stream_flush (stream, NULL); - camel_stream_close (stream, NULL); + camel_data_wrapper_write_to_stream_sync ( + CAMEL_DATA_WRAPPER (msg), stream, cancellable, NULL); + camel_stream_flush (stream, cancellable, NULL); + camel_stream_close (stream, cancellable, NULL); g_object_unref (stream); } else if (in) { - camel_write (fds[1], in, strlen (in), NULL); + camel_write (fds[1], in, strlen (in), cancellable, NULL); close (fds[1]); } if (output_buffer) { - CamelStreamMem *memstream; + CamelStream *memstream; stream = camel_stream_fs_new_with_fd (out_fds[0]); - memstream = (CamelStreamMem *) camel_stream_mem_new (); - camel_stream_mem_set_byte_array (memstream, output_buffer); + memstream = camel_stream_mem_new (); + camel_stream_mem_set_byte_array ( + CAMEL_STREAM_MEM (memstream), output_buffer); - camel_stream_write_to_stream (stream, (CamelStream *) memstream, NULL); + camel_stream_write_to_stream ( + stream, memstream, cancellable, NULL); g_object_unref (stream); g_byte_array_append (output_buffer, (guchar *)"", 1); @@ -248,9 +257,13 @@ pipe_to_sa_full (CamelMimeMessage *msg, const gchar *in, const gchar **argv, gin } static gint -pipe_to_sa (CamelMimeMessage *msg, const gchar *in, const gchar **argv, GError **error) +pipe_to_sa (CamelMimeMessage *msg, + const gchar *in, + const gchar **argv, + GCancellable *cancellable, + GError **error) { - return pipe_to_sa_full (msg, in, argv, -1, 1, NULL, error); + return pipe_to_sa_full (msg, in, argv, -1, 1, NULL, cancellable, error); } static gchar * @@ -283,7 +296,7 @@ em_junk_sa_test_spamd_running (const gchar *binary, gboolean system) argv[i] = NULL; - rv = pipe_to_sa (NULL, "From test@127.0.0.1", argv, NULL) == 0; + rv = pipe_to_sa (NULL, "From test@127.0.0.1", argv, NULL, NULL) == 0; d(fprintf (stderr, "result: %d (%s)\n", rv, rv ? "success" : "failed")); @@ -307,7 +320,7 @@ em_junk_sa_test_allow_tell (void) NULL }; - no_allow_tell = pipe_to_sa (NULL, "\n" , argv, NULL); + no_allow_tell = pipe_to_sa (NULL, "\n" , argv, NULL, NULL); em_junk_sa_allow_tell_tested = TRUE; } @@ -320,7 +333,7 @@ em_junk_sa_test_spamassassin (void) NULL, }; - if (pipe_to_sa (NULL, NULL, argv, NULL) != 0) + if (pipe_to_sa (NULL, NULL, argv, NULL, NULL) != 0) em_junk_sa_available = FALSE; else em_junk_sa_available = TRUE; @@ -358,7 +371,7 @@ em_junk_sa_run_spamd (const gchar *binary) d(fprintf (stderr, "trying to run %s with socket path %s\n", binary, em_junk_sa_get_socket_path ())); - if (!pipe_to_sa_full (NULL, NULL, argv, -1, 0, NULL, NULL)) { + if (!pipe_to_sa_full (NULL, NULL, argv, -1, 0, NULL, NULL, NULL)) { struct timespec time_req; struct stat stat_buf; @@ -448,7 +461,7 @@ em_junk_sa_test_spamd (void) argv [i++] = "ps ax|grep -v grep|grep -E 'spamd.*(\\-L|\\-\\-local)'|grep -E -v '\\ \\-p\\ |\\ \\-\\-port\\ '"; argv[i] = NULL; - if (pipe_to_sa (NULL, NULL, argv, NULL) != 0) { + if (pipe_to_sa (NULL, NULL, argv, NULL, NULL) != 0) { try_system_spamd = FALSE; d(fprintf (stderr, "there's no system spamd with -L/--local parameter running\n")); } @@ -612,7 +625,7 @@ em_junk_sa_check_junk (EPlugin *ep, EMJunkTarget *target) argv[i] = NULL; - rv = pipe_to_sa_full (msg, NULL, argv, 0, 1, out, &target->error) != 0; + rv = pipe_to_sa_full (msg, NULL, argv, 0, 1, out, NULL, &target->error) != 0; if (!rv && out && out->data && !strcmp ((const gchar *)out->data, "0/0\n")) { /* an error occurred */ @@ -624,7 +637,7 @@ em_junk_sa_check_junk (EPlugin *ep, EMJunkTarget *target) argv[socket_i] = to_free = g_strdup (em_junk_sa_get_socket_path ()); G_UNLOCK (socket_path); - rv = pipe_to_sa_full (msg, NULL, argv, 0, 1, out, &target->error) != 0; + rv = pipe_to_sa_full (msg, NULL, argv, 0, 1, out, NULL, &target->error) != 0; } else if (!em_junk_sa_use_spamc) /* in case respawning were too fast we fallback to spamassassin */ rv = em_junk_sa_check_junk (ep, target); @@ -655,7 +668,7 @@ get_spamassassin_version () if (!em_junk_sa_checked_spamassassin_version) { out = g_byte_array_new (); - if (pipe_to_sa_full (NULL, NULL, argv, -1, 1, out, NULL) != 0) { + if (pipe_to_sa_full (NULL, NULL, argv, -1, 1, out, NULL, NULL) != 0) { if (out) g_byte_array_free (out, TRUE); return em_junk_sa_spamassassin_version; @@ -716,7 +729,7 @@ em_junk_sa_report_junk (EPlugin *ep, EMJunkTarget *target) G_LOCK (report); pipe_to_sa (msg, NULL, (no_allow_tell ? argv : argv2), - &target->error); + NULL, &target->error); G_UNLOCK (report); } } @@ -756,7 +769,7 @@ em_junk_sa_report_non_junk (EPlugin *ep, EMJunkTarget *target) G_LOCK (report); pipe_to_sa (msg, NULL, (no_allow_tell ? argv : argv2), - &target->error); + NULL, &target->error); G_UNLOCK (report); } } @@ -784,7 +797,7 @@ em_junk_sa_commit_reports (EPlugin *ep) argv[2] = "--local"; G_LOCK (report); - pipe_to_sa (NULL, NULL, argv, NULL); + pipe_to_sa (NULL, NULL, argv, NULL, NULL); G_UNLOCK (report); } } diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c index 83dd985402..7f62240370 100644 --- a/plugins/templates/templates.c +++ b/plugins/templates/templates.c @@ -488,10 +488,11 @@ create_new_message (CamelFolder *folder, const gchar *uid, CamelMimeMessage *mes /* make the exact copy of the template message, with all its attachments and message structure */ mem = camel_stream_mem_new (); - camel_data_wrapper_write_to_stream ( - CAMEL_DATA_WRAPPER (template), mem, NULL); + camel_data_wrapper_write_to_stream_sync ( + CAMEL_DATA_WRAPPER (template), mem, NULL, NULL); camel_stream_reset (mem, NULL); - camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (new), mem, NULL); + camel_data_wrapper_construct_from_stream_sync ( + CAMEL_DATA_WRAPPER (new), mem, NULL, NULL); g_object_unref (mem); /* Add the headers from the message we are replying to, so CC and that @@ -566,7 +567,7 @@ build_template_menus_recurse (GtkUIManager *ui_manager, guint ii; /* FIXME Not passing a GCancellable or GError here. */ - folder = camel_store_get_folder ( + folder = camel_store_get_folder_sync ( store, folder_info->full_name, 0, NULL, NULL); folder_name = camel_folder_get_name (folder); @@ -614,7 +615,7 @@ build_template_menus_recurse (GtkUIManager *ui_manager, continue; /* FIXME Not passing a GCancellable or GError here. */ - template = camel_folder_get_message ( + template = camel_folder_get_message_sync ( folder, uid, NULL, NULL); g_object_ref (template); @@ -679,7 +680,7 @@ action_template_cb (GtkAction *action, /* Get the templates folder and all UIDs of the messages there. */ folder = e_mail_local_get_folder (E_MAIL_FOLDER_TEMPLATES); - msg = e_msg_composer_get_message_draft (composer, &error); + msg = e_msg_composer_get_message_draft (composer, NULL, &error); /* Ignore cancellations. */ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { @@ -768,7 +769,7 @@ update_actions_cb (EShellView *shell_view) full_name = camel_folder_get_full_name (templates_folder); /* FIXME Not passing a GCancellable or GError here. */ - folder_info = camel_store_get_folder_info ( + folder_info = camel_store_get_folder_info_sync ( store, full_name, CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL); diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c index 648c48a856..9828b60e7d 100644 --- a/plugins/tnef-attachments/tnef-plugin.c +++ b/plugins/tnef-attachments/tnef-plugin.c @@ -92,8 +92,8 @@ org_gnome_format_tnef (gpointer ep, EMFormatHookTarget *t) content = camel_medium_get_content ((CamelMedium *)t->part); if (content == NULL) goto fail; - if (camel_data_wrapper_decode_to_stream (content, out, NULL) == -1 - || camel_stream_close (out, NULL) == -1) { + if (camel_data_wrapper_decode_to_stream_sync (content, out, NULL, NULL) == -1 + || camel_stream_close (out, NULL, NULL) == -1) { g_object_unref (out); goto fail; } @@ -138,7 +138,8 @@ org_gnome_format_tnef (gpointer ep, EMFormatHookTarget *t) stream = camel_stream_fs_new_with_name (path, O_RDONLY, 0, NULL); content = camel_data_wrapper_new (); - camel_data_wrapper_construct_from_stream (content, stream, NULL); + camel_data_wrapper_construct_from_stream_sync ( + content, stream, NULL, NULL); g_object_unref (stream); part = camel_mime_part_new (); diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c index bf27e641c7..5891344d22 100644 --- a/plugins/vcard-inline/vcard-inline.c +++ b/plugins/vcard-inline/vcard-inline.c @@ -105,7 +105,8 @@ org_gnome_vcard_inline_decode (VCardInlinePObject *vcard_object, /* Stream takes ownership of the byte array. */ stream = camel_stream_mem_new_with_byte_array (array); data_wrapper = camel_medium_get_content (medium); - camel_data_wrapper_decode_to_stream (data_wrapper, stream, NULL); + camel_data_wrapper_decode_to_stream_sync ( + data_wrapper, stream, NULL, NULL); /* because the result is not NULL-terminated */ g_byte_array_append (array, padding, 2); |