aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-composer-actions.c
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 /composer/e-composer-actions.c
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 'composer/e-composer-actions.c')
-rw-r--r--composer/e-composer-actions.c76
1 files changed, 44 insertions, 32 deletions
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c
index a49567cea2..13fe48495e 100644
--- a/composer/e-composer-actions.c
+++ b/composer/e-composer-actions.c
@@ -130,8 +130,8 @@ action_save_cb (GtkAction *action,
if (response != GTK_RESPONSE_OK)
return;
} else {
- e_alert_run_dialog_for_args (
- GTK_WINDOW (composer),
+ e_alert_submit (
+ GTK_WIDGET (composer),
E_ALERT_NO_SAVE_FILE, filename,
g_strerror (errno_saved), NULL);
return;
@@ -140,8 +140,8 @@ action_save_cb (GtkAction *action,
close (fd);
if (!gtkhtml_editor_save (editor, filename, TRUE, &error)) {
- e_alert_run_dialog_for_args (
- GTK_WINDOW (composer),
+ e_alert_submit (
+ GTK_WIDGET (composer),
E_ALERT_NO_SAVE_FILE,
filename, error->message, NULL);
g_error_free (error);
@@ -252,20 +252,6 @@ static GtkActionEntry entries[] = {
N_("Close the current file"),
G_CALLBACK (action_close_cb) },
- { "print",
- GTK_STOCK_PRINT,
- N_("_Print..."),
- "<Control>p",
- NULL,
- G_CALLBACK (action_print_cb) },
-
- { "print-preview",
- GTK_STOCK_PRINT_PREVIEW,
- N_("Print Pre_view"),
- "<Shift><Control>p",
- NULL,
- G_CALLBACK (action_print_preview_cb) },
-
{ "save",
GTK_STOCK_SAVE,
N_("_Save"),
@@ -280,20 +266,6 @@ static GtkActionEntry entries[] = {
N_("Save the current file with a different name"),
G_CALLBACK (action_save_as_cb) },
- { "save-draft",
- GTK_STOCK_SAVE,
- N_("Save as _Draft"),
- "<Control>s",
- N_("Save as draft"),
- G_CALLBACK (action_save_draft_cb) },
-
- { "send",
- "mail-send",
- N_("S_end"),
- "<Control>Return",
- N_("Send this message"),
- G_CALLBACK (action_send_cb) },
-
{ "new-message",
"mail-message-new",
N_("New _Message"),
@@ -318,6 +290,37 @@ static GtkActionEntry entries[] = {
NULL }
};
+static GtkActionEntry async_entries[] = {
+
+ { "print",
+ GTK_STOCK_PRINT,
+ N_("_Print..."),
+ "<Control>p",
+ NULL,
+ G_CALLBACK (action_print_cb) },
+
+ { "print-preview",
+ GTK_STOCK_PRINT_PREVIEW,
+ N_("Print Pre_view"),
+ "<Shift><Control>p",
+ NULL,
+ G_CALLBACK (action_print_preview_cb) },
+
+ { "save-draft",
+ GTK_STOCK_SAVE,
+ N_("Save as _Draft"),
+ "<Control>s",
+ N_("Save as draft"),
+ G_CALLBACK (action_save_draft_cb) },
+
+ { "send",
+ "mail-send",
+ N_("S_end"),
+ "<Control>Return",
+ N_("Send this message"),
+ G_CALLBACK (action_send_cb) },
+};
+
static GtkToggleActionEntry toggle_entries[] = {
{ "pgp-encrypt",
@@ -416,6 +419,15 @@ e_composer_actions_init (EMsgComposer *composer)
G_N_ELEMENTS (toggle_entries), composer);
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ /* Asynchronous Actions */
+ action_group = composer->priv->async_actions;
+ gtk_action_group_set_translation_domain (
+ action_group, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (
+ action_group, async_entries,
+ G_N_ELEMENTS (async_entries), composer);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+
/* Character Set Actions */
action_group = composer->priv->charset_actions;
gtk_action_group_set_translation_domain (