[anjal] BUGFIX: Moblin Bugzilla #5314 - Lots of empty space around emails.



commit 82f5847df49b095f7b23734c59a30ff982f627a8
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Tue Jan 19 10:18:52 2010 +0530

    BUGFIX: Moblin Bugzilla #5314 - Lots of empty space around emails.

 src/em-format-mail-display.c |   29 +++++++++++++++++++++--------
 src/em-format-mail.c         |    5 +++--
 src/mail-message-view.c      |   12 +++++++++---
 3 files changed, 33 insertions(+), 13 deletions(-)
---
diff --git a/src/em-format-mail-display.c b/src/em-format-mail-display.c
index b2574d1..c07e19f 100644
--- a/src/em-format-mail-display.c
+++ b/src/em-format-mail-display.c
@@ -61,6 +61,7 @@
 #include <libedataserver/e-msgport.h>
 #include <e-util/e-dialog-utils.h>
 #include <e-util/e-icon-factory.h>
+#include <e-util/e-binding.h>
 
 #ifdef HAVE_NSS
 #include "certificate-viewer.h"
@@ -104,7 +105,7 @@ static void efhd_html_on_url (GtkHTML *html, const gchar *url, EMFormatMailDispl
 static void efhd_attachment_frame(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri);
 static GtkWidget * efhd_attachment_image(EMFormatMail *efh, GtkWidget *eb, EMFormatMailPObject *pobject);
 static void efhd_message_add_bar(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info);
-static void efwd_draw_in_main_thread (EMFormatMailDisplay *efwd, EMFormatMailPObject *pobject);
+static void efwd_draw_in_main_thread (EMFormatMailDisplay *efwd, EMFormatMailPObject *pobject, gboolean hideweb, gboolean allhidden);
 
 struct _attach_puri {
 	EMFormatPURI puri;
@@ -883,7 +884,7 @@ efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Came
 		pobj->valid = camel_cipher_validity_clone(valid);
 		pobj->object.free = efhd_xpkcs7mime_free;
 		pobj->object.body = mail_message_view_get_body(stream);
-		efwd_draw_in_main_thread ((EMFormatMailDisplay *)emf, (EMFormatMailPObject *)pobj);
+		efwd_draw_in_main_thread ((EMFormatMailDisplay *)emf, (EMFormatMailPObject *)pobj, FALSE, FALSE);
 		
 		g_free(classid);
 	}
@@ -917,7 +918,7 @@ efhd_image(EMFormatMail *efh, CamelStream *stream, CamelMimePart *part, EMFormat
 
 	info->pobject = pobject;
 	pobject->body = mail_message_view_get_body(stream);
-	efwd_draw_in_main_thread ((EMFormatMailDisplay *)efh, pobject);
+	efwd_draw_in_main_thread ((EMFormatMailDisplay *)efh, pobject, FALSE, FALSE);
 	g_free(classid);
 }
 #endif
@@ -1825,7 +1826,7 @@ efhd_message_add_bar (EMFormat *efh,
 	ainfo->rendered = TRUE;	
 	ainfo->pobject = pobject;
 	pobject->body = mail_message_view_get_body(stream);
-	efwd_draw_in_main_thread ((EMFormatMailDisplay *)efh, pobject);	
+	efwd_draw_in_main_thread ((EMFormatMailDisplay *)efh, pobject, TRUE, FALSE);	
 }
 
 static void
@@ -1871,7 +1872,7 @@ efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part,
 #endif
 	info->pobject = pobj;
 	pobj->body = mail_message_view_get_body (stream);
-	efwd_draw_in_main_thread ((EMFormatMailDisplay *)emf, pobj);
+	efwd_draw_in_main_thread ((EMFormatMailDisplay *)emf, pobj, FALSE, !info->shown);
 #if 0
 	/* output some info about it */
 	/* FIXME: should we look up mime_type from object again? */
@@ -1903,8 +1904,10 @@ efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part,
 			camel_stream_close (pobj->stream);
 			camel_object_unref(pobj->stream);
 			pobj->stream = NULL;			
-		} else
+		} else {
 			info->rendered = 0;
+
+		}
 	}
 
 	g_free(classid);
@@ -2085,6 +2088,8 @@ struct _preview_message_msg {
 	unsigned int allow_cancel:1;
 	unsigned int result:1;
 	unsigned int ismain:1;
+	unsigned int hideweb:1;
+	unsigned int allhidden:1;
 };
 static void preview_message_exec (struct _preview_message_msg *m);
 
@@ -2094,8 +2099,14 @@ preview_message_exec (struct _preview_message_msg *m)
 	EMFormatMailPObject *pobj = m->pobject;
 	pobj->view = (gpointer) pobj->func(pobj->format, (gpointer)pobj->body, pobj);
 	if (pobj->view) {
-		pobj->stream = mail_message_view_create_webstream (mail_message_view_create_webview((MailMessageView *)((EMFormatMail *)pobj->format)->msg_view, pobj->view), pobj->view);
+		GtkWidget *web =  mail_message_view_create_webview((MailMessageView *)((EMFormatMail *)pobj->format)->msg_view, pobj->view);
+		e_binding_new (pobj->view, "visible", web, "visible");
+		pobj->stream = mail_message_view_create_webstream (web, pobj->view);
 		gtk_widget_show (pobj->view);
+		if (m->allhidden)
+			gtk_widget_hide (pobj->view);
+		else if (m->hideweb)
+			gtk_widget_hide (web);
 	}
 	e_flag_set (m->done);
 }
@@ -2115,7 +2126,7 @@ static MailMsgInfo preview_message_info = {
 };
 
 static void
-efwd_draw_in_main_thread (EMFormatMailDisplay *efwd, EMFormatMailPObject *pobject)
+efwd_draw_in_main_thread (EMFormatMailDisplay *efwd, EMFormatMailPObject *pobject, gboolean hideweb, gboolean allhidden)
 {
 	struct _preview_message_msg *m;
 
@@ -2124,6 +2135,8 @@ efwd_draw_in_main_thread (EMFormatMailDisplay *efwd, EMFormatMailPObject *pobjec
 	m->done = e_flag_new ();
 	m->allow_cancel = TRUE;
 	m->pobject = pobject;
+	m->hideweb = hideweb;
+	m->allhidden = allhidden;
 	mail_msg_ref (m);
 	if (m->ismain)
 		preview_message_exec (m);
diff --git a/src/em-format-mail.c b/src/em-format-mail.c
index 047d426..2215638 100644
--- a/src/em-format-mail.c
+++ b/src/em-format-mail.c
@@ -1448,10 +1448,11 @@ efh_format_timeout(struct _format_msg *m)
 		mail_msg_unref(m);
 		p->last_part = NULL;
 	} else {
+		GtkWidget *web = mail_message_view_create_webview ((MailMessageView *)efh->msg_view, efh->body);
 		efh->state = EM_FORMAT_MAIL_STATE_RENDERING;
-		m->estream = (CamelStream *)mail_message_view_create_webstream((gpointer)mail_message_view_create_webview ((MailMessageView *)efh->msg_view, efh->body), efh->body);
+		m->estream = (CamelStream *)mail_message_view_create_webstream((gpointer)web, efh->body);
 		efh->header_stream = mail_message_view_create_webstream((gpointer)mail_message_view_create_webview ((MailMessageView *)efh->msg_view, efh->wheaders), efh->wheaders);
-
+		gtk_widget_show(web);
 #if 0
 		if (p->last_part != m->message) {
 			hstream = gtk_html_begin (efh->html);
diff --git a/src/mail-message-view.c b/src/mail-message-view.c
index 3d3ccdf..10bade4 100644
--- a/src/mail-message-view.c
+++ b/src/mail-message-view.c
@@ -42,6 +42,7 @@
 #include "mail-shell.h"
 #include <math.h>
 #include <e-util/e-util.h>
+#include <e-util/e-binding.h>
 #include <composer/e-composer-header-table.h>
 #include "mail-utils.h"
 #include "em-format-mail-display.h"
@@ -579,7 +580,7 @@ construct_reply_composer (MailMessageView *mmv, int mode)
 		tmp = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
 		gtk_alignment_set_padding ((GtkAlignment *)tmp, 0, 0, 0, 20);
 		gtk_widget_show (tmp);
-		gtk_box_pack_start ((GtkBox *)mmv->cbox, tmp, FALSE, FALSE, 18);
+		gtk_box_pack_start ((GtkBox *)mmv->cbox, tmp, FALSE, FALSE, 6);
 		gtk_box_pack_start ((GtkBox *)mmv->cbox, mmv->frame, TRUE, TRUE, 6);
 		gtk_box_pack_start ((GtkBox *)mmv, mmv->cbox, FALSE, FALSE, 6);
 		g_signal_connect (mmv->composer, "send", G_CALLBACK(mmv_mail_send), mmv);
@@ -998,7 +999,7 @@ mmv_create_webview (MailMessageView *mmv, GtkWidget *box)
 	GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
 
 	gtk_scrolled_window_set_policy ((GtkScrolledWindow *)scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
-	gtk_widget_show(scroll);
+	gtk_widget_show (scroll);
 	gtk_container_add ((GtkContainer *)scroll, (GtkWidget*)web);
 
 	g_signal_connect (web, "load-started", G_CALLBACK(mmv_finished_webkit), mmv);
@@ -1006,10 +1007,14 @@ mmv_create_webview (MailMessageView *mmv, GtkWidget *box)
 	g_signal_connect (web, "button-press-event", G_CALLBACK (mmv_button_press), mmv);
 	g_signal_connect (web, "navigation-requested", G_CALLBACK (mmv_nav), mmv);
 
-	gtk_box_pack_start ((GtkBox *)box, scroll, TRUE, TRUE, 0);
+	gtk_box_pack_start ((GtkBox *)box, scroll, TRUE, TRUE, 6);
 	webkit_web_view_set_editable (web, FALSE);
 	gtk_widget_show ((GtkWidget *)web);
 
+	e_binding_new (web, "visible", scroll, "visible");
+
+	gtk_widget_hide ((GtkWidget *)web);
+
 	return (GtkWidget *)web;
 }
 #endif
@@ -1239,6 +1244,7 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
 	box = gtk_vbox_new (FALSE, 0);
 	gtk_widget_show (box);
 	mmview->priv->total_box = box;
+	gtk_box_set_spacing ((GtkBox *)mmview, 0);
 
 #if !HAVE_CLUTTER	
 	gtk_box_pack_start ((GtkBox *)mmview, mmview->priv->total_box, TRUE, FALSE, 0);



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