[anjal] BUGFIX: GNOME Bugzill #600691 - Remember settings for Reply [all] Forward



commit e7d1263a3698ca023153d70dd7b8be0bf148ab0e
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Fri Nov 6 15:08:27 2009 +0000

    BUGFIX: GNOME Bugzill #600691 - Remember settings for Reply [all] Forward

 src/mail-message-view.c |   36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/src/mail-message-view.c b/src/mail-message-view.c
index b30442d..930b48c 100644
--- a/src/mail-message-view.c
+++ b/src/mail-message-view.c
@@ -77,7 +77,9 @@ struct  _MailMessageViewPrivate {
 	GtkWidget *attach_area;
 	GtkWidget *html_headers;
 	GtkWidget *table_headers;
-
+	gboolean composer_changed;
+	char *composer_changed_text;
+	int composer_text_length;
 	char *folder_uri;
 };
 
@@ -114,6 +116,10 @@ mail_message_view_init (MailMessageView  *shell)
 	shell->priv->mode = -2;
 	shell->composer = NULL;
 	shell->priv->show_composer = FALSE;
+	shell->priv->composer_changed = FALSE;
+	shell->priv->composer_changed_text = NULL;
+	shell->priv->composer_text_length = 0;
+
 }
 
 static void
@@ -410,6 +416,15 @@ discard_composer_cb (GtkWidget *w, MailMessageView *mmv)
 {
 	gtk_widget_hide (mmv->frame);
 	gtk_widget_hide (mmv->cbox);
+	if (mmv->composer && (gtkhtml_editor_get_changed (GTKHTML_EDITOR(mmv->composer)) || mmv->priv->composer_changed)) {
+		if (mmv->priv->composer_changed_text) {
+			g_free (mmv->priv->composer_changed_text);
+			mmv->priv->composer_changed_text = NULL;
+			mmv->priv->composer_text_length = 0;
+		}
+		mmv->priv->composer_changed_text = gtkhtml_editor_get_text_html (GTKHTML_EDITOR(mmv->composer), (gsize *)&mmv->priv->composer_text_length);
+		mmv->priv->composer_changed = TRUE;
+	}
 	if (mmv->comp_view)
 		gtk_widget_hide (mmv->comp_view);
 	if (mmv->composer)
@@ -427,6 +442,18 @@ discard_composer_cb (GtkWidget *w, MailMessageView *mmv)
 }
 
 static void
+wrap_discard_composer_cb (GtkWidget *w, MailMessageView *mmv)
+{
+	discard_composer_cb (w, mmv);
+	if (mmv->priv->composer_changed_text) {
+		g_free (mmv->priv->composer_changed_text);
+		mmv->priv->composer_changed_text = NULL;
+		mmv->priv->composer_text_length = 0;
+	}
+	mmv->priv->composer_changed = FALSE;
+}
+
+static void
 mmv_mail_send (struct _EMsgComposer *composer, MailMessageView *mmv)
 {
 	gtk_widget_hide (mmv->frame);
@@ -499,6 +526,11 @@ construct_reply_composer (MailMessageView *mmv, int mode)
 			mmv->composer = (GtkWidget *)em_utils_reply_to_message (mmv->priv->folder, mmv->priv->uid, mmv->priv->msg, mode, mmv->efwd);
 		else 
 			mmv->composer = (GtkWidget *)em_utils_forward_message (mmv->priv->msg, mmv->priv->folder_uri);
+		g_assert (mmv->composer);
+		if (mmv->priv->composer_changed_text && mmv->priv->composer_text_length > 0 && mmv->priv->composer_changed) {
+			gtkhtml_editor_set_text_html (GTKHTML_EDITOR(mmv->composer), mmv->priv->composer_changed_text, mmv->priv->composer_text_length);
+		}
+		gtkhtml_editor_set_changed (GTKHTML_EDITOR(mmv->composer), FALSE);
 		mmv->comp_view = g_object_get_data((GObject *)mmv->composer,"vbox");
 		gtk_widget_reparent (mmv->comp_view, box);
 		gtk_widget_set_size_request (mmv->comp_view, -1, 400);	
@@ -1377,7 +1409,7 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
 	gtk_box_pack_start ((GtkBox *)mmview->footer, forward, FALSE, FALSE, 12);
 
 	mmview->discard = gtk_button_new_with_label (_("Discard"));
-	g_signal_connect (mmview->discard, "clicked", G_CALLBACK (discard_composer_cb), mmview);
+	g_signal_connect (mmview->discard, "clicked", G_CALLBACK (wrap_discard_composer_cb), mmview);
 	gtk_widget_hide (mmview->discard);
 	gtk_box_pack_end ((GtkBox *)mmview->footer, mmview->discard, FALSE, FALSE, 12);
 



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