aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/dbx-import
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-22 04:21:19 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-23 02:21:22 +0800
commitc881b5bc5e61d04b18d4ab46ad70533e7340d15b (patch)
treee70a3ed0d2f93dacfe20d856de4d29578beb2e50 /plugins/dbx-import
parentf0714755e2fa8b06425907c2cf189abd3a1b7119 (diff)
downloadgsoc2013-evolution-c881b5bc5e61d04b18d4ab46ad70533e7340d15b.tar.gz
gsoc2013-evolution-c881b5bc5e61d04b18d4ab46ad70533e7340d15b.tar.zst
gsoc2013-evolution-c881b5bc5e61d04b18d4ab46ad70533e7340d15b.zip
Simplify EActivity.
With unintrusive error dialogs gone, we can cut some unnecessary bits out of EActivity. I'm also adding a new enum property called "state", which is one of: E_ACTIVITY_RUNNING E_ACTIVITY_WAITING E_ACTIVITY_CANCELLED E_ACTIVITY_COMPLETED The state of an activity must be explicitly changed. In particular, when the user cancels an activity the state should be set only after confirming the operation has been cancelled and not when cancellation is requested (e.g. after receiving a G_IO_ERROR_CANCELLED, not when the GCancellable emits "cancelled"). EActivityBar and EActivityProxy widgets have been updated to make this distinction clearer in the UI. E_ACTIVITY_WAITING will be used when activities have to be queued and dispatched in sequence, which I haven't written yet.
Diffstat (limited to 'plugins/dbx-import')
-rw-r--r--plugins/dbx-import/dbx-importer.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c
index 28db6b175f..0105dfe236 100644
--- a/plugins/dbx-import/dbx-importer.c
+++ b/plugins/dbx-import/dbx-importer.c
@@ -546,6 +546,7 @@ dbx_import_file (DbxImporter *m)
EShell *shell;
EShellBackend *shell_backend;
EMailSession *session;
+ GCancellable *cancellable;
gchar *filename;
CamelFolder *folder;
gint tmpfile;
@@ -555,6 +556,8 @@ 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 */
+ cancellable = e_activity_get_cancellable (m->base.activity);
+
/* XXX Dig up the EMailSession from the default EShell.
* Since the EImport framework doesn't allow for user
* data, I don't see how else to get to it. */
@@ -565,7 +568,7 @@ dbx_import_file (DbxImporter *m)
camel_operation_push_message (NULL, _("Importing '%s'"), filename);
folder = e_mail_session_uri_to_folder_sync (
session, m->parent_uri, CAMEL_STORE_FOLDER_CREATE,
- m->base.cancellable, &m->base.error);
+ cancellable, &m->base.error);
if (!folder)
return;
d(printf("importing to %s\n", camel_folder_get_full_name(folder)));
@@ -603,7 +606,7 @@ dbx_import_file (DbxImporter *m)
gboolean success;
camel_operation_progress (NULL, 100 * i / m->index_count);
- camel_operation_progress (m->cancellable, 100 * i / m->index_count);
+ camel_operation_progress (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",
@@ -638,7 +641,7 @@ dbx_import_file (DbxImporter *m)
camel_message_info_set_flags (info, flags, ~0);
success = camel_folder_append_message_sync (
folder, msg, info, NULL,
- m->base.cancellable, &m->base.error);
+ cancellable, &m->base.error);
camel_message_info_free (info);
g_object_unref (msg);
@@ -667,7 +670,9 @@ dbx_import_file (DbxImporter *m)
}
static void
-dbx_import_import (DbxImporter *m)
+dbx_import_import (DbxImporter *m,
+ GCancellable *cancellable,
+ GError **error)
{
dbx_import_file (m);
}