[anjal/anjal-0-1] BUGFIX: GNOME Bug #596027: In Anjal, although invalid mail address warning popup, mail's tab closed



commit fb9bcb391cc03fd59ab89f1b99f7a4b629f3b0d9
Author: Yan Li <yanli infradead org>
Date:   Thu Nov 5 14:31:33 2009 +0800

    BUGFIX: GNOME Bug #596027: In Anjal, although invalid mail address warning popup, mail's tab closed automatically
    
    This bug is also reported as Moblin Bug #6108.
    
    This patch depends on an evolution commit (df1f9b3 of evo/master or
    50ffa65 of evo/gnome-2-28), which added a "mail_sent" bit to the
    composer. Now Anjal only close the composer when the mail is sent
    successfully.
    (cherry picked from commit d5624ca231c675c94f75e85a23b3fedd7f111300)

 src/mail-composer-view.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/mail-composer-view.c b/src/mail-composer-view.c
index a083504..29496c2 100644
--- a/src/mail-composer-view.c
+++ b/src/mail-composer-view.c
@@ -1,3 +1,5 @@
+/* -*- 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
@@ -38,8 +40,6 @@ struct  _MailComposerViewPrivate {
 	GtkWidget *box;
 	GtkWidget *composer;
 	GList *children;
-
-	gboolean sending;
 };
 
 enum {
@@ -60,7 +60,6 @@ mail_composer_view_init (MailComposerView  *shell)
 	shell->priv = g_new0(MailComposerViewPrivate, 1);
 	shell->uri = "new-message://";
 	shell->type = MAIL_VIEW_COMPOSER;
-	shell->priv->sending = FALSE;
 }
 
 static void
@@ -130,8 +129,10 @@ composer_send_close_cb (struct _EMsgComposer *composer, MailComposerView *mcv)
 {
 	/*Emit view-close signal.*/
 	//g_object_unref (composer);
-	mcv->priv->sending = TRUE;
-	g_signal_emit (mcv, signals[VIEW_CLOSE], 0);
+
+	/* Only close when the Sending was successful */
+	if (e_msg_composer_get_mail_sent(composer))
+		g_signal_emit (mcv, signals[VIEW_CLOSE], 0);
 }
 
 void
@@ -238,6 +239,14 @@ mail_composer_view_activate (MailComposerView *mfv, GtkWidget *folder_tree, GtkW
 	 gtk_widget_set_sensitive (sort_by, act);
 }
 
+/* Whether we can close the composer or not.
+
+   The composer may be closed in two ways: by clicking the Send button
+   or closing the tab. When the Send button is clicked, this function
+   will only be called when the sending was successful (the
+   e_msg_composer_get_mail_sent() is check in callback function).  When
+   the tab is being closed, alert the user if editor is changed.
+*/
 gboolean
 mail_composer_view_can_quit (MailComposerView *mcv)
 {
@@ -247,7 +256,7 @@ mail_composer_view_can_quit (MailComposerView *mcv)
 
 	editor = GTKHTML_EDITOR(composer);
 	
-	if (mcv->priv->sending)
+	if (e_msg_composer_get_mail_sent(composer))
 		return TRUE;
 
 	if (gtkhtml_editor_get_changed(editor) && !e_msg_composer_is_exiting (composer)) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]