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/dbx-import | |
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/dbx-import')
-rw-r--r-- | plugins/dbx-import/dbx-importer.c | 29 |
1 files changed, 11 insertions, 18 deletions
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); } } |