[anjal] 2009-04-28 Bharath <abharath novell com>



commit f5e97ae5dee10fa3c5d6846ad053904ddc6a7fe8
Author: Bharath <abharath novell com>
Date:   Tue Apr 28 12:20:46 2009 +0530

    2009-04-28 Bharath <abharath novell com>
    
    	** Inline composer merge & Evolution patch update.
---
 evo-anjal.patch               |  111 ++++++++++++++++++++++++++++++++++++--
 src/e-composer-header-table.c |    7 ++-
 src/e-msg-composer.c          |   69 ++++++++++++++++++++++++
 src/e-msg-composer.h          |    5 ++
 src/mail-conv-view.c          |   12 ++++
 src/mail-editor.c             |   33 ++++++++++--
 src/mail-message-view.c       |  119 +++++++++++++++++++++++++++++++----------
 src/mail-message-view.h       |    3 +
 8 files changed, 318 insertions(+), 41 deletions(-)

diff --git a/evo-anjal.patch b/evo-anjal.patch
index a35c577..23a9cb1 100755
--- a/evo-anjal.patch
+++ b/evo-anjal.patch
@@ -89,7 +89,7 @@ index 461c11e..618adbf 100644
  	table->priv->headers[E_COMPOSER_HEADER_SUBJECT] = header;
  
 diff --git a/composer/e-composer-header.c b/composer/e-composer-header.c
-index 8cbcf64..f85d455 100644
+index 8cbcf64..1ed21b6 100644
 --- a/composer/e-composer-header.c
 +++ b/composer/e-composer-header.c
 @@ -1,3 +1,7 @@
@@ -170,7 +170,23 @@ index 8cbcf64..f85d455 100644
  		case PROP_LABEL:	/* construct only */
  			priv->label = g_value_dup_string (value);
  			return;
-@@ -139,6 +177,15 @@ composer_header_get_property (GObject *object,
+@@ -124,6 +162,15 @@ composer_header_set_property (GObject *object,
+ 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+ 
++void
++e_composer_header_set_property (GObject *object,
++                              guint property_id,
++                              const GValue *value,
++                              GParamSpec *pspec)
++{
++	composer_header_set_property (object, property_id, value, pspec);
++}
++
+ static void
+ composer_header_get_property (GObject *object,
+                               guint property_id,
+@@ -139,6 +186,15 @@ composer_header_get_property (GObject *object,
  			g_value_set_boolean (value, priv->button);
  			return;
  
@@ -186,7 +202,7 @@ index 8cbcf64..f85d455 100644
  		case PROP_LABEL:	/* construct only */
  			g_value_take_string (
  				value, e_composer_header_get_label (
-@@ -207,6 +254,28 @@ composer_header_class_init (EComposerHeaderClass *class)
+@@ -207,6 +263,28 @@ composer_header_class_init (EComposerHeaderClass *class)
  
  	g_object_class_install_property (
  		object_class,
@@ -216,7 +232,7 @@ index 8cbcf64..f85d455 100644
  		g_param_spec_string (
  			"label",
 diff --git a/composer/e-composer-header.h b/composer/e-composer-header.h
-index d1edd11..3a2e45e 100644
+index d1edd11..8542d01 100644
 --- a/composer/e-composer-header.h
 +++ b/composer/e-composer-header.h
 @@ -49,6 +49,7 @@ struct _EComposerHeader {
@@ -227,6 +243,15 @@ index d1edd11..3a2e45e 100644
  	EComposerHeaderPrivate *priv;
  };
  
+@@ -62,6 +63,8 @@ gboolean	e_composer_header_get_sensitive	(EComposerHeader *header);
+ void		e_composer_header_set_sensitive (EComposerHeader *header,
+ 						 gboolean sensitive);
+ gboolean	e_composer_header_get_visible	(EComposerHeader *header);
++void		e_composer_header_set_property 	(GObject *object, guint property_id, 
++						const GValue *value, GParamSpec *pspec);
+ void		e_composer_header_set_visible	(EComposerHeader *header,
+ 						 gboolean visible);
+ void		e_composer_header_set_title_tooltip
 diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c
 index 70a126b..ed96312 100644
 --- a/composer/e-composer-name-header.c
@@ -696,8 +721,84 @@ index e286a47..1b78525 100644
  
  server_in_files = GNOME_Evolution_Mail.server.in.in
  server_DATA = $(server_in_files:.server.in.in=.server)
+diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
+index 8822566..59bfea1 100644
+--- a/mail/em-composer-utils.c
++++ b/mail/em-composer-utils.c
+@@ -1913,6 +1913,12 @@ get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTP
+ 	}
+ }
+ 
++void
++em_utils_get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAddress *postto)
++{
++	get_reply_sender (message, to, postto);
++}
++
+ static gboolean
+ get_reply_list (CamelMimeMessage *message, CamelInternetAddress *to)
+ {
+@@ -2026,6 +2032,13 @@ get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInterne
+ 	g_hash_table_destroy (rcpt_hash);
+ }
+ 
++void
++em_utils_get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInternetAddress *cc, CamelNNTPAddress *postto)
++{
++	get_reply_all (message, to, cc, postto);
++}
++
++
+ enum {
+ 	ATTRIB_UNKNOWN,
+ 	ATTRIB_CUSTOM,
+@@ -2283,6 +2296,20 @@ struct _reply_data {
+ 	int mode;
+ };
+ 
++char *
++em_utils_construct_composer_text (CamelMimeMessage *message, EMFormat *source)
++{
++	char *text, *credits;
++	ssize_t len = 0;
++	gboolean start_bottom = 0;
++	
++	credits = attribution_format (ATTRIBUTION, message);
++	text = em_utils_message_to_html (message, credits, EM_FORMAT_QUOTE_CITE, &len, source, start_bottom ? "<BR>" : NULL);
++
++	g_free (credits);
++	return text;
++}
++
+ static void
+ reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message, void *user_data)
+ {
+diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
+index d17a98c..6b75c1a 100644
+--- a/mail/em-composer-utils.h
++++ b/mail/em-composer-utils.h
+@@ -34,6 +34,8 @@ extern "C" {
+ struct _CamelFolder;
+ struct _CamelMimeMessage;
+ struct _CamelException;
++struct _CamelInternetAddress;
++struct _CamelNNTPAddress;
+ struct _EMsgComposer;
+ struct _EMFormat;
+ struct _EAccount;
+@@ -77,6 +79,10 @@ enum {
+ 	REPLY_MODE_LIST
+ };
+ 
++char *em_utils_construct_composer_text (struct _CamelMimeMessage *message, struct _EMFormat *source);
++void em_utils_get_reply_sender (struct _CamelMimeMessage *message, struct _CamelInternetAddress *to, struct _CamelNNTPAddress *postto);
++void em_utils_get_reply_all (struct _CamelMimeMessage *message, struct _CamelInternetAddress *to, struct _CamelInternetAddress *cc, struct _CamelNNTPAddress *postto);
++
+ void em_utils_reply_to_message (struct _CamelFolder *, const char *uid, struct _CamelMimeMessage *message, int mode, struct _EMFormat *source);
+ 
+ void em_utils_post_reply_to_message_by_uid (struct _CamelFolder *folder, const char *uid);
 diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
-index 54173a5..c871578 100644
+index 6b3e792..e96c016 100644
 --- a/mail/em-folder-tree.c
 +++ b/mail/em-folder-tree.c
 @@ -110,6 +110,7 @@ struct _EMFolderTreePrivate {
diff --git a/src/e-composer-header-table.c b/src/e-composer-header-table.c
index b3769dc..f0ac312 100644
--- a/src/e-composer-header-table.c
+++ b/src/e-composer-header-table.c
@@ -244,7 +244,8 @@ composer_header_table_constructor (GType type,
 					  1, 4, ii, ii + 1, GTK_FILL | GTK_EXPAND, 0, 0, 3);
 
 			if (priv->headers [ii]->action_widget) {
-				gtk_box_pack_start (priv->actions_container, priv->headers[ii]->action_widget,
+				/* Pack the widgets to the end. Helps formatting when hiding the From field */
+				gtk_box_pack_end (priv->actions_container, priv->headers[ii]->action_widget,
 						    FALSE, FALSE, 6);
 			}
 		}
@@ -540,12 +541,12 @@ composer_header_table_init (EComposerHeaderTable *table)
 	composer_header_table_bind_header ("destinations-to", "changed", header);
 	table->priv->headers[E_COMPOSER_HEADER_TO] = header;
 
-	header = e_composer_name_header_new_with_action (_("_Cc:"), _("Add CC"), name_selector);
+	header = e_composer_name_header_new_with_action (_("_Cc:"), _("Show CC"), name_selector);
 	e_composer_header_set_input_tooltip (header, HEADER_TOOLTIP_CC);
 	composer_header_table_bind_header ("destinations-cc", "changed", header);
 	table->priv->headers[E_COMPOSER_HEADER_CC] = header;
 
-	header = e_composer_name_header_new_with_action (_("_Bcc:"), _("Add BCC"), name_selector);
+	header = e_composer_name_header_new_with_action (_("_Bcc:"), _("Show BCC"), name_selector);
 	e_composer_header_set_input_tooltip (header, HEADER_TOOLTIP_BCC);
 	composer_header_table_bind_header ("destinations-bcc", "changed", header);
 	table->priv->headers[E_COMPOSER_HEADER_BCC] = header;
diff --git a/src/e-msg-composer.c b/src/e-msg-composer.c
index a2fb7d6..a21bffa 100644
--- a/src/e-msg-composer.c
+++ b/src/e-msg-composer.c
@@ -95,6 +95,7 @@
 #include "mail/mail-session.h"
 #include "mail/em-popup.h"
 #include "mail/em-menu.h"
+#include "mail/em-format-quote.h"
 
 #include "e-msg-composer.h"
 #include "e-composer-header-table.h"
@@ -480,6 +481,20 @@ msg_composer_subject_changed_cb (EMsgComposer *composer)
 	gtk_window_set_title (GTK_WINDOW (composer), subject);
 }
 
+
+gpointer
+e_msg_composer_get_mail_editor (EMsgComposer *composer)
+{
+	EMsgComposerPrivate *p;
+
+	if (!composer)
+		return NULL;
+
+	p = E_MSG_COMPOSER_GET_PRIVATE (composer);
+
+	return p->html_editor;
+}
+
 enum {
 	UPDATE_AUTO_CC,
 	UPDATE_AUTO_BCC,
@@ -1120,10 +1135,64 @@ em_composer_prefs_new_signature (GtkWindow *parent,
 {
 }
 
+gpointer
+e_msg_composer_reply (struct _CamelFolder *f, const char *uid, struct _CamelMimeMessage *message, int mode, struct _EMFormat *source)
+{
+	EMsgComposer *composer;
+	EComposerHeaderTable *table;
+	EComposerHeader *header;
+	MailEditor *editor;
+	char *text;
+	CamelInternetAddress *to, *cc;
+	EDestination **tov, **ccv;
+	char *subject;
+	
+	composer = e_msg_composer_new ();
+	editor = e_msg_composer_get_mail_editor(composer);
+
+	to = camel_internet_address_new();
+	cc = camel_internet_address_new();
+	
+	text = em_utils_construct_composer_text (message, source);
+	mail_editor_set_text_html (editor, text, strlen (text));
+	
+	table = e_msg_composer_get_header_table (composer);
+
+	switch (mode) {
+	case REPLY_MODE_SENDER:
+		em_utils_get_reply_sender (message, to, NULL);
+		break;
+	case REPLY_MODE_ALL:
+		em_utils_get_reply_all (message, to, cc, NULL);
+		ccv = em_utils_camel_address_to_destination (cc);
+		e_composer_header_table_set_destinations_cc (table, ccv);
+		break;
+	}
+	tov = em_utils_camel_address_to_destination (to);
+	e_composer_header_table_set_destinations_to (table, tov);
+	
+	if ((subject = (char *) camel_mime_message_get_subject (message))) {
+		if (g_ascii_strncasecmp (subject, "Re: ", 4) != 0)
+			subject = g_strdup_printf ("Re: %s", subject);
+		else
+			subject = g_strdup (subject);
+	} else {
+		subject = g_strdup ("");
+	}
+	e_composer_header_table_set_subject (table, subject);
+	g_free (subject);
+	header = e_composer_header_table_get_header (table, E_COMPOSER_HEADER_CC);
+	
+	g_free (text);
+	return composer;
+}
+
+/*
 void 
 em_utils_reply_to_message (struct _CamelFolder *f, const char *uid, struct _CamelMimeMessage *message, int mode, struct _EMFormat *source)
 {
 }
+*/
 void 
 em_utils_compose_new_message_with_mailto (const char *url, const char *fromuri)
 {
diff --git a/src/e-msg-composer.h b/src/e-msg-composer.h
index 67b2214..8f0bd4e 100644
--- a/src/e-msg-composer.h
+++ b/src/e-msg-composer.h
@@ -98,6 +98,11 @@ EMsgComposer *	e_msg_composer_new_from_url	(const gchar *url);
 EMsgComposer *	e_msg_composer_new_redirect	(CamelMimeMessage *message,
 						 const gchar *resent_from);
 
+gpointer 	e_msg_composer_get_mail_editor 	(EMsgComposer *composer);
+gpointer 	e_msg_composer_reply		(struct _CamelFolder *f, 
+						const char *uid, struct _CamelMimeMessage *message, 
+						int mode, struct _EMFormat *source);
+
 void		e_msg_composer_send		(EMsgComposer *composer);
 void		e_msg_composer_save_draft	(EMsgComposer *composer);
 
diff --git a/src/mail-conv-view.c b/src/mail-conv-view.c
index 844aa7f..bfcd5db 100644
--- a/src/mail-conv-view.c
+++ b/src/mail-conv-view.c
@@ -309,6 +309,17 @@ mcv_message_removed (MailMessageView *mmv, MailConvView *mcv)
 		g_warning ("Unable to find the deleted  mail in conversation\n");
 }
 
+static void
+mcv_message_reply (MailMessageView *mmv, MailConvView *mcv)
+{
+	int x, y, height, ret;
+	GtkAdjustment *adj = gtk_viewport_get_vadjustment(mcv->priv->viewport);
+
+	ret = gtk_widget_translate_coordinates (mmv->footer, mmv->comp_view, 0, 0, &x, &y);
+//	height = ((GtkContainer *)mmv->comp_view)->focus_child->allocation.height;
+	gtk_adjustment_clamp_page (adj, y, y+600);
+}
+
 void
 mail_conv_view_set_thread (MailConvView *mcv, CamelFolder *folder, GPtrArray *array)
 {
@@ -343,6 +354,7 @@ mail_conv_view_set_thread (MailConvView *mcv, CamelFolder *folder, GPtrArray *ar
 		mail_message_view_set_message (child, folder, array->pdata[i]);
 		g_signal_connect (child, "message-selected", G_CALLBACK(mcv_message_selected), mcv);
 		g_signal_connect (child, "message-removed", G_CALLBACK(mcv_message_removed), mcv);
+		g_signal_connect (child, "message-reply", G_CALLBACK(mcv_message_reply), mcv);
 		focus = g_list_prepend (focus, mail_message_view_get_focus_widget(child));
 		if (!unread) {
 			if (mail_message_view_get_unread (child))
diff --git a/src/mail-editor.c b/src/mail-editor.c
index edb41e2..76aa5dc 100644
--- a/src/mail-editor.c
+++ b/src/mail-editor.c
@@ -26,7 +26,7 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <webkit/webkit.h>
-
+#include <gdk/gdkkeysyms.h>
 
 #define MAIL_EDITOR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MAIL_EDITOR_TYPE, MailEditorPrivate))
 
@@ -296,10 +296,16 @@ mail_editor_init(MailEditor *editor)
 {
 	MailEditorPrivate *priv;
 	gchar *index_html;
+	GtkWidget *scroller, *vbox;
 
 	priv = MAIL_EDITOR_GET_PRIVATE (editor);
 
 	priv->editor = webkit_web_view_new ();
+	scroller = gtk_scrolled_window_new (NULL, NULL);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroller), GTK_SHADOW_IN);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller),
+				GTK_POLICY_NEVER,
+				GTK_POLICY_AUTOMATIC);
 
 	/*Dummy html doc*/
 	index_html = "<html><body></body></html>";
@@ -314,9 +320,13 @@ mail_editor_init(MailEditor *editor)
 	priv->toolbar = mail_editor_construct_html_toolbar (editor);
 	gtk_widget_show_all (priv->toolbar);
 
-	gtk_box_pack_start (GTK_CONTAINER (editor), priv->toolbar, FALSE, TRUE, 6);
-	gtk_box_pack_start (GTK_CONTAINER (editor), priv->editor, TRUE, TRUE, 2);
-
+	vbox = gtk_vbox_new (FALSE, 0);
+	gtk_box_pack_start (vbox, priv->toolbar, FALSE, TRUE, 6);
+	gtk_box_pack_start (vbox, scroller, TRUE, TRUE, 2);
+	gtk_container_add (scroller, priv->editor);
+	gtk_widget_show (scroller);
+	gtk_container_add (GTK_CONTAINER (editor), vbox);
+	gtk_widget_show (vbox);
 }
 
 gchar *
@@ -357,17 +367,30 @@ mail_editor_run_command (MailEditor *editor, gchar *command)
 	
 }
 
+WebKitWebView *
+mail_editor_get_webview (MailEditor *editor)
+{
+	MailEditorPrivate *priv;
+
+	g_return_val_if_fail (IS_MAIL_EDITOR (editor), NULL);
+	
+	priv = MAIL_EDITOR_GET_PRIVATE (editor);
+	return priv->editor;
+}
+
 void
 mail_editor_set_text_html (MailEditor *editor, gchar *text, gint length)
 {
 	MailEditorPrivate *priv;
+	WebKitWebFrame* frame;
 
 	g_return_val_if_fail (IS_MAIL_EDITOR (editor), NULL);
 
 	priv = MAIL_EDITOR_GET_PRIVATE (editor);
+	frame = webkit_web_view_get_main_frame (priv->editor);
+	webkit_web_frame_load_string (frame, text, NULL, NULL, "");
 }
 
-
 gchar*
 mail_editor_get_html (MailEditor *editor, gsize *length)
 {
diff --git a/src/mail-message-view.c b/src/mail-message-view.c
index e0a7e06..09dca74 100644
--- a/src/mail-message-view.c
+++ b/src/mail-message-view.c
@@ -39,6 +39,7 @@
 #include "misc/e-spinner.h"
 #include <gdk/gdkkeysyms.h>
 #include "e-util/e-icon-factory.h"
+#include "mail/em-composer-utils.h"
 
 extern char *scolor_norm;
 extern char *scolor_sel;
@@ -51,10 +52,12 @@ struct  _MailMessageViewPrivate {
 	const char *uid;
 	GtkWidget *arrow;
 	GtkWidget *focus;
+//	GtkWidget *focus_composer;
 	CamelMimeMessage *msg;
 	CamelMessageInfoBase *info;
 	GtkWidget *header_row;
 	const char *active_color;
+	int mode;
 	GtkWidget *spinner;
 	GtkWidget *spinner_label;
 	GtkWidget *unread_image;
@@ -68,6 +71,7 @@ enum {
 	MESSAGE_SELECTED,
 	MESSAGE_REMOVED,
 	MESSAGE_LOADED,
+	MESSAGE_REPLY,
 	LAST_SIGNAL
 };
 
@@ -142,7 +146,14 @@ mail_message_view_class_init (MailMessageViewClass *klass)
 			      NULL, NULL,
 			      g_cclosure_marshal_VOID__VOID,
 			     G_TYPE_NONE, 0);
-
+	signals[MESSAGE_REPLY] =
+		g_signal_new ("message-reply",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_FIRST,
+			      G_STRUCT_OFFSET (MailMessageViewClass , message_reply),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
 }
 
 static void
@@ -199,6 +210,7 @@ mmv_show (MailMessageView *mmv)
 	}
 	gtk_widget_show (mmv->body);
 	gtk_widget_show_all (mmv->footer);
+	gtk_widget_hide (mmv->discard);
 	gtk_arrow_set (mmv->priv->arrow, GTK_ARROW_DOWN, GTK_SHADOW_NONE);				
 }
 
@@ -328,23 +340,75 @@ discard_composer_cb (GtkWidget *w, MailMessageView *mmv)
 {
 	gtk_widget_hide (mmv->frame);
 	gtk_widget_hide (mmv->comp_view);
+	gtk_widget_hide (mmv->discard);
 	/* FIXME: Destroy the composer in here */
 }
 
-static void
-invoke_composer_cb (GtkWidget *w, MailMessageView *mmv)
+static gboolean
+key_press_cb (GtkWidget *w, GdkEventKey *event, gpointer web)
 {
-	/* All this should be moved to the composer code, if we intend to hide the headers 
-	for making the inline composer more sleek */
-//	EComposerHeaderTable *table = e_msg_composer_get_header_table (E_MSG_COMPOSER(mmv->comp_view));
-//	e_composer_header_table_set_header_visible (table, E_COMPOSER_HEADER_FROM, FALSE);
-//	e_composer_header_table_set_header_visible (table, E_COMPOSER_HEADER_TO, FALSE);
-//	e_composer_header_table_set_header_visible (table, E_COMPOSER_HEADER_SUBJECT, FALSE);
+	gpointer frame = webkit_web_view_get_main_frame (web);
+	
+	switch (event->keyval) {
+	case GDK_Return:	
+	case GDK_KP_Enter:
+		if (!webkit_web_frame_is_cursor_at_blockquote (frame))
+			return FALSE;
+		webkit_web_frame_break_quote (frame);
+		return TRUE;
+	}
+	return FALSE;	
+}
 
+static void
+construct_reply_composer (MailMessageView *mmv, int mode)
+{
+	MailEditor *editor;
+	EComposerHeaderTable *table;
+	WebKitWebView *web_view;
+	
+	if (!E_IS_MSG_COMPOSER (mmv->comp_view)) {
+		mmv->comp_view = (EMsgComposer *)e_msg_composer_reply (NULL, NULL, mmv->priv->msg, mode, NULL);
+		gtk_widget_set_size_request (mmv->comp_view, -1, 480);	
+		
+		/* Trying to focus on the editor */
+		editor = e_msg_composer_get_mail_editor (mmv->comp_view);
+		web_view = mail_editor_get_webview (editor);
+		g_signal_connect (web_view, "key-press-event", key_press_cb, web_view);
+
+		/* Hide most of the basic headers. We'll add an option for enabling them later.
+		   Our objective is to make the inline composer as sleek as it can get. 
+		*/
+		table = e_msg_composer_get_header_table (mmv->comp_view);
+		e_composer_header_table_set_header_visible (table, E_COMPOSER_HEADER_FROM, FALSE);
+//		e_composer_header_table_set_header_visible (table, E_COMPOSER_HEADER_TO, FALSE);
+		e_composer_header_table_set_header_visible (table, E_COMPOSER_HEADER_SUBJECT, FALSE);
+		gtk_container_add (mmv->frame, mmv->comp_view);
+		gtk_box_pack_start (mmv, mmv->frame, FALSE, FALSE, 18);
+	}
+	gtk_widget_show (mmv->discard);
 	gtk_widget_show (mmv->frame);
 	gtk_widget_show (mmv->comp_view);
 
-	/* Need to handle individual cases for Reply, Reply All and Forward */
+	g_signal_emit (mmv, signals[MESSAGE_REPLY], 0);
+}
+
+static void
+invoke_reply_name_composer_cb (GtkWidget *w, MailMessageView *mmv)
+{
+	construct_reply_composer (mmv, REPLY_MODE_SENDER);
+}
+
+static void
+invoke_reply_all_composer_cb (GtkWidget *w, MailMessageView *mmv)
+{
+	construct_reply_composer (mmv, REPLY_MODE_ALL);
+}
+
+static void
+invoke_forward_composer_cb (GtkWidget *w, MailMessageView *mmv)
+{
+
 }
 
 static void
@@ -891,7 +955,6 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
 	gtk_label_set_ellipsize (tmp, PANGO_ELLIPSIZE_END);
 	gtk_label_set_max_width_chars (tmp, 75);
 	mmview->sub_details = tmp;
-	g_strfreev(strv);
 	gtk_widget_show(tmp);
 	if (camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN)
 		gtk_label_set_markup (mmview->sub_details, mmview->priv->normal[0]);
@@ -962,9 +1025,7 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
 	gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
 	gtk_table_attach (table, widget , 0, 1, row,  row + 1, GTK_FILL, 0, 0, 0);
 	str = camel_message_info_from(info);
-	strv = g_strsplit (str, "<", 2);
 	widget = gtk_label_new (*strv);
-	g_strfreev(strv);
 	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
 	gtk_table_attach (table, widget , 1, 2, row,  row + 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
 	row++;
@@ -1059,34 +1120,36 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
 	mmview->footer = gtk_hbox_new (FALSE, 0);
 	gtk_box_pack_start (mmview, mmview->footer, FALSE, FALSE, 0);
 	
-	reply = gtk_link_button_new_with_label ("Reply to name", "Reply to name");
-	g_signal_connect (reply, "clicked", G_CALLBACK (invoke_composer_cb), mmview);
+	/* To translators: Reply to the sender. The format is replaced by the 
+	   name of the sender.
+	*/
+	str = g_strdup_printf (_("Reply to %s"), *strv);
+	reply = gtk_button_new_with_label (str);
+	g_free (str);
+	g_strfreev(strv);
+	g_signal_connect (reply, "clicked", G_CALLBACK (invoke_reply_name_composer_cb), mmview);
 //	EXPOSE(reply, bgcolor);
 	gtk_box_pack_start (mmview->footer, reply, FALSE, FALSE, 12);
 
-	reply_all = gtk_link_button_new_with_label ("Reply All", "Reply All");
-	g_signal_connect (reply_all, "clicked", G_CALLBACK (invoke_composer_cb), mmview);
+	reply_all = gtk_button_new_with_label (_("Reply All"));
+	g_signal_connect (reply_all, "clicked", G_CALLBACK (invoke_reply_all_composer_cb), mmview);
 //	EXPOSE(reply_all, bgcolor);
 	gtk_box_pack_start (mmview->footer, reply_all, FALSE, FALSE, 12);
 
-	forward = gtk_link_button_new_with_label ("Forward", "Forward");
-	g_signal_connect (forward, "clicked", G_CALLBACK (invoke_composer_cb), mmview);	
+	forward = gtk_button_new_with_label (_("Forward"));
+	g_signal_connect (forward, "clicked", G_CALLBACK (invoke_forward_composer_cb), mmview);	
 //	EXPOSE(forward, bgcolor);
 	gtk_box_pack_start (mmview->footer, forward, FALSE, FALSE, 12);
 
-	discard = gtk_link_button_new_with_label ("Discard", "Discard");
-	g_signal_connect (discard, "clicked", G_CALLBACK (discard_composer_cb), mmview);
+	mmview->discard = gtk_button_new_with_label (_("Discard"));
+	g_signal_connect (mmview->discard, "clicked", G_CALLBACK (discard_composer_cb), mmview);
 //	EXPOSE(discard, bgcolor);
-	gtk_box_pack_end (mmview->footer, discard, FALSE, FALSE, 12);
+	/* Hide this one be default */
+	gtk_widget_hide (mmview->discard);
+	gtk_box_pack_end (mmview->footer, mmview->discard, FALSE, FALSE, 12);
 
 	mmview->frame = gtk_frame_new (NULL);
 	gtk_frame_set_shadow_type (mmview->frame, GTK_SHADOW_IN);
-	
-	mmview->comp_view = e_msg_composer_new ();
-	gtk_widget_set_size_request (mmview->comp_view, -1, 480);
-	gtk_container_add (mmview->frame, mmview->comp_view);
-	gtk_box_pack_start (mmview, mmview->frame, FALSE, FALSE, 18);
-	gtk_widget_hide (mmview->comp_view);
 
 	if (!(info->flags & CAMEL_MESSAGE_SEEN))
 		 mmv_show(mmview);
diff --git a/src/mail-message-view.h b/src/mail-message-view.h
index 6e6785c..c9e930b 100644
--- a/src/mail-message-view.h
+++ b/src/mail-message-view.h
@@ -25,6 +25,7 @@
 
 #include <gtk/gtk.h>
 #include "em-format-webkit-display.h"
+#include "e-msg-composer.h"
 #include "mail-view.h"
 #include <camel/camel-stream.h>
 
@@ -53,6 +54,7 @@ typedef struct _MailMessageView {
 	GtkWidget *footer;
 	GtkWidget *frame;
 	GtkWidget *comp_view;
+	GtkWidget *discard;
 	
 	MailMessageViewPrivate *priv;
 	EMFormatWebKitDisplay *efwd;
@@ -64,6 +66,7 @@ typedef struct _MailMessageViewClass {
 	void (*message_selected) (MailMessageView *);
 	void (*message_removed) (MailMessageView *);
 	void (*message_loaded) (MailMessageView *);
+	void (*message_reply) (MailMessageView *);
 
 } MailMessageViewClass;
 



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