From d209b896747b519c42c6326fd1d6550ae7f176e5 Mon Sep 17 00:00:00 2001 From: Yan Li Date: Fri, 6 Nov 2009 16:43:58 +0800 Subject: 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. The e_msg_composer_is_exiting() (removed by 983bea9) has to be bring back, which is needed by other programs that use the composer (Anjal here). (forward ported from 08150f6 of gnome-2-28) --- composer/e-msg-composer.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'composer/e-msg-composer.c') diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 9a28a68f3a..c10ef997d4 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.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 @@ -3955,6 +3956,22 @@ e_msg_composer_set_enable_autosave (EMsgComposer *composer, e_composer_autosave_set_enabled (composer, enabled); } +gboolean +e_msg_composer_is_exiting (EMsgComposer *composer) +{ + g_return_val_if_fail (composer != NULL, FALSE); + + 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; +} + EMsgComposer * e_msg_composer_load_from_file (const gchar *filename) { -- cgit v1.2.3