diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-10-22 04:21:19 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-23 02:21:22 +0800 |
commit | c881b5bc5e61d04b18d4ab46ad70533e7340d15b (patch) | |
tree | e70a3ed0d2f93dacfe20d856de4d29578beb2e50 /plugins | |
parent | f0714755e2fa8b06425907c2cf189abd3a1b7119 (diff) | |
download | gsoc2013-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')
-rw-r--r-- | plugins/dbx-import/dbx-importer.c | 13 | ||||
-rw-r--r-- | plugins/groupwise-features/share-folder-common.c | 9 | ||||
-rw-r--r-- | plugins/itip-formatter/itip-formatter.c | 4 | ||||
-rw-r--r-- | plugins/pst-import/pst-importer.c | 18 |
4 files changed, 29 insertions, 15 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); } diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c index 61cace9565..4a4e57aa11 100644 --- a/plugins/groupwise-features/share-folder-common.c +++ b/plugins/groupwise-features/share-folder-common.c @@ -139,18 +139,19 @@ create_folder_desc (struct _EMCreateFolder *m) } static void -create_folder_exec (struct _EMCreateFolder *m) +create_folder_exec (struct _EMCreateFolder *m, + GCancellable *cancellable, + GError **error) { 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_sync ( - m->store, m->parent, m->name, - m->base.cancellable, &m->base.error))) { + m->store, m->parent, m->name, cancellable, error))) { if (camel_store_supports_subscriptions (m->store)) camel_store_subscribe_folder_sync ( m->store, m->full_name, - m->base.cancellable, &m->base.error); + cancellable, error); } } diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index d8ff9b95f6..79d0bd14b4 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -1943,7 +1943,9 @@ open_calendar__desc (struct _opencal_msg *m, gint complete) } static void -open_calendar__exec (struct _opencal_msg *m) +open_calendar__exec (struct _opencal_msg *m, + GCancellable *cancellable, + GError **error) { if (!g_spawn_command_line_async (m->command, NULL)) { g_warning ("Could not launch %s", m->command); diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index 2e994f78e4..d0a69ddece 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -121,7 +121,6 @@ struct _PstImporter { pst_file pst; - GCancellable *cancellable; CamelFolder *folder; gchar *parent_uri; gchar *folder_name; @@ -394,7 +393,9 @@ open_ecal (ECalSourceType type, const gchar *name) } static void -pst_import_import (PstImporter *m) +pst_import_import (PstImporter *m, + GCancellable *cancellable, + GError **error) { if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-addr"))) { /* Hack - grab the first address book we can find @@ -456,11 +457,14 @@ pst_import_file (PstImporter *m) EShell *shell; EShellBackend *shell_backend; EMailSession *session; + GCancellable *cancellable; gint ret; gchar *filename; pst_item *item = NULL; pst_desc_tree *d_ptr; + 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. */ @@ -476,7 +480,7 @@ pst_import_file (PstImporter *m) if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-mail"))) { 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); } ret = pst_init (&m->pst, filename); @@ -710,10 +714,13 @@ pst_create_folder (PstImporter *m) EShell *shell; EShellBackend *shell_backend; EMailSession *session; + GCancellable *cancellable; const gchar *parent; gchar *dest, *dest_end, *pos; gint dest_len; + 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. */ @@ -740,7 +747,7 @@ pst_create_folder (PstImporter *m) folder = e_mail_session_uri_to_folder_sync ( session, dest, CAMEL_STORE_FOLDER_CREATE, - m->base.cancellable, &m->base.error); + cancellable, &m->base.error); g_object_unref (folder); *pos = '/'; } @@ -754,7 +761,7 @@ pst_create_folder (PstImporter *m) m->folder = e_mail_session_uri_to_folder_sync ( session, m->folder_uri, CAMEL_STORE_FOLDER_CREATE, - m->base.cancellable, &m->base.error); + cancellable, &m->base.error); } /** @@ -1659,7 +1666,6 @@ 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->cancellable = camel_operation_new (); g_signal_connect ( m->status, "status", |