diff options
author | Yan Li <yanli@infradead.org> | 2009-11-05 15:16:41 +0800 |
---|---|---|
committer | Yan Li <yanli@infradead.org> | 2009-11-05 15:16:41 +0800 |
commit | 08150f6b0dc3d820f116613d3b1e461bba309c6c (patch) | |
tree | 858f0688343e6e9d8b035687dcd1f844d6c0bccb | |
parent | 50ffa65a7aee41c5fa319f64dd3bd3ffdd2be0b3 (diff) | |
download | gsoc2013-evolution-08150f6b0dc3d820f116613d3b1e461bba309c6c.tar gsoc2013-evolution-08150f6b0dc3d820f116613d3b1e461bba309c6c.tar.gz gsoc2013-evolution-08150f6b0dc3d820f116613d3b1e461bba309c6c.tar.bz2 gsoc2013-evolution-08150f6b0dc3d820f116613d3b1e461bba309c6c.tar.lz gsoc2013-evolution-08150f6b0dc3d820f116613d3b1e461bba309c6c.tar.xz gsoc2013-evolution-08150f6b0dc3d820f116613d3b1e461bba309c6c.tar.zst gsoc2013-evolution-08150f6b0dc3d820f116613d3b1e461bba309c6c.zip |
Bug #599792 - Anjal composer's Send button doesn't work after pressed Save Drafts button
This is due to an old hack that hiding a composer means we're closing
it so save_draft_done() destroys the composer after saved draft. But
in Anjal, the composer widget is always hidden (since the editor is
reparented to the tab), and will be wrongly destroyed by
save_draft_done() when you clicked "Save Draft" button.
This patch improved the old hack, by adding a new API
e_msg_composer_request_close() that can be used to request closing a
composer (so the old hack is no longer needed). Internally,
composer->priv->application_exiting is used to store this exiting
status.
So by this we no longer use a composer's visibility to check whether
we're to close it. When you no longer need a composer after saved
draft, call e_msg_composer_request_close() before sending the
save-draft signal.
-rw-r--r-- | composer/e-composer-actions.c | 2 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 8 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 1 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 5 |
4 files changed, 12 insertions, 4 deletions
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c index 9ec3399b94..74b0a85499 100644 --- a/composer/e-composer-actions.c +++ b/composer/e-composer-actions.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -91,6 +92,7 @@ action_close_cb (GtkAction *action, switch (response) { case GTK_RESPONSE_YES: gtk_widget_hide (widget); + e_msg_composer_request_close (composer); gtk_action_activate (ACTION (SAVE_DRAFT)); break; diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 828a14ec13..64f565ddea 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -3928,6 +3928,14 @@ e_msg_composer_is_exiting (EMsgComposer *composer) return composer->priv->application_exiting; } +void +e_msg_composer_request_close (EMsgComposer *composer) +{ + g_return_val_if_fail (composer != NULL, FALSE); + + composer->priv->application_exiting = TRUE; +} + gboolean e_msg_composer_request_close_all (void) { diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index e1eeede6da..93db807e23 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -137,6 +137,7 @@ void e_msg_composer_add_message_attachments CamelMimeMessage *message, gboolean just_inlines); +void e_msg_composer_request_close (EMsgComposer *composer); gboolean e_msg_composer_request_close_all(void); EMsgComposer * e_msg_composer_load_from_file (const gchar *filename); void e_msg_composer_check_autosave (GtkWindow *parent); diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 1800d4c515..fe7c34a1a3 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -535,10 +535,7 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i emcs->drafts_uid = g_strdup (appended_uid); } - /* This is kind of a hack, but the composer's CLOSE action - * hides the window before emitting the "save-draft" signal. - * We use that to determine whether to destroy the composer. */ - if (!GTK_WIDGET_VISIBLE (sdi->composer)) + if (e_msg_composer_is_exiting (sdi->composer)) gtk_widget_destroy (GTK_WIDGET (sdi->composer)); done: |