aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-06 22:55:27 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-13 01:59:00 +0800
commit4118d671d44b71592f0e91abb63f2468baaa9318 (patch)
treee70f787f68034a16df1c59f75c8869618b02146b /plugins
parenta06e4484b8df804124b5bcf88d94dec5acfba270 (diff)
downloadgsoc2013-evolution-4118d671d44b71592f0e91abb63f2468baaa9318.tar.gz
gsoc2013-evolution-4118d671d44b71592f0e91abb63f2468baaa9318.tar.zst
gsoc2013-evolution-4118d671d44b71592f0e91abb63f2468baaa9318.zip
Composer: Show cancellable operations and errors inline.
'Send' and 'Save Draft' are now asynchronous and run outside of Evolution's MailMsg infrastructure. Add an EActivityBar to the composer window so these asynchronous operations can be tracked and cancelled even in the absense of a main window. Also add an EAlertBar to the composer window so error messages can be shown directly in the window. Instead of calling e_alert_dialog_run_for_args(), call e_alert_submit() and pass the EMsgComposer as the widget argument. The EMsgComposer will decide whether to show an EAlertDialog or use the EAlertBar, depending on the GtkMessageType of the alert.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/email-custom-header/email-custom-header.c2
-rw-r--r--plugins/face/face.c2
-rw-r--r--plugins/templates/templates.c39
3 files changed, 28 insertions, 15 deletions
diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c
index 94cc793d25..f202935c3e 100644
--- a/plugins/email-custom-header/email-custom-header.c
+++ b/plugins/email-custom-header/email-custom-header.c
@@ -471,7 +471,7 @@ epech_append_to_custom_header (CustomHeaderOptionsDialog *dialog, gint state, gp
temp_header_value_ptr = &g_array_index (temp_header_ptr->sub_header_type_value, CustomSubHeader,sub_type_index);
if (sub_type_index == g_array_index (priv->header_index_type, gint, index_subtype)) {
- e_msg_composer_modify_header (composer, (temp_header_ptr->header_type_value)->str,
+ e_msg_composer_set_header (composer, (temp_header_ptr->header_type_value)->str,
(temp_header_value_ptr->sub_header_string_value)->str);
}
}
diff --git a/plugins/face/face.c b/plugins/face/face.c
index 2013f7dac6..57e80832e6 100644
--- a/plugins/face/face.c
+++ b/plugins/face/face.c
@@ -466,7 +466,7 @@ face_handle_send (EPlugin *ep, EMEventTargetComposer *target)
gchar *face = get_face_base64 ();
if (face)
- e_msg_composer_modify_header (target->composer, "Face", face);
+ e_msg_composer_set_header (target->composer, "Face", face);
g_free (face);
}
diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c
index 901f902ae9..a2bac3dec9 100644
--- a/plugins/templates/templates.c
+++ b/plugins/templates/templates.c
@@ -519,7 +519,7 @@ create_new_message (CamelFolder *folder, const gchar *uid, CamelMimeMessage *mes
camel_mime_message_get_recipients (template, CAMEL_RECIPIENT_TYPE_BCC));
/* Create the composer */
- em_utils_edit_message (shell, new, folder);
+ em_utils_edit_message (shell, folder, new);
g_object_unref (new);
}
@@ -549,7 +549,7 @@ build_template_menus_recurse (GtkUIManager *ui_manager,
guint *action_count,
guint merge_id,
CamelFolderInfo *folder_info,
- CamelFolder *message_folder,
+ CamelFolder *message_folder,
const gchar *message_uid)
{
CamelStore *store;
@@ -669,28 +669,26 @@ build_template_menus_recurse (GtkUIManager *ui_manager,
}
static void
-action_template_cb (GtkAction *action,
- EMsgComposer *composer)
+got_message_draft_cb (EMsgComposer *composer,
+ GAsyncResult *result)
{
+ CamelMimeMessage *message;
CamelMessageInfo *info;
- CamelMimeMessage *msg;
CamelFolder *folder;
GError *error = NULL;
- /* 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, NULL, &error);
+ message = e_msg_composer_get_message_draft_finish (
+ composer, result, &error);
/* Ignore cancellations. */
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- g_warn_if_fail (msg == NULL);
+ g_warn_if_fail (message == NULL);
g_error_free (error);
return;
}
if (error != NULL) {
- g_warn_if_fail (msg == NULL);
+ g_warn_if_fail (message == NULL);
e_alert_run_dialog_for_args (
GTK_WINDOW (composer),
"mail-composer:no-build-message",
@@ -699,7 +697,10 @@ action_template_cb (GtkAction *action,
return;
}
- g_return_if_fail (CAMEL_IS_MIME_MESSAGE (msg));
+ g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
+
+ /* Get the templates folder and all UIDs of the messages there. */
+ folder = e_mail_local_get_folder (E_MAIL_FOLDER_TEMPLATES);
info = camel_message_info_new (NULL);
@@ -709,7 +710,19 @@ action_template_cb (GtkAction *action,
camel_message_info_set_flags (
info, CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DRAFT, ~0);
- mail_append_mail (folder, msg, info, NULL, composer);
+ mail_append_mail (folder, message, info, NULL, composer);
+
+ g_object_unref (message);
+}
+
+static void
+action_template_cb (GtkAction *action,
+ EMsgComposer *composer)
+{
+ /* XXX Pass a GCancellable */
+ e_msg_composer_get_message_draft (
+ composer, G_PRIORITY_DEFAULT, NULL,
+ (GAsyncReadyCallback) got_message_draft_cb, NULL);
}
static GtkActionEntry composer_entries[] = {