[evolution] Bug #683130 - Folder hangs when reading mail with an attachment



commit 55dc92d4c578a7a842f7c6b2a9a37404e0839dca
Author: Dan VrÃtil <dvratil redhat com>
Date:   Tue Sep 4 10:19:08 2012 +0200

    Bug #683130 - Folder hangs when reading mail with an attachment

 mail/e-mail-display.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 0e1bea5..aee909d 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -625,17 +625,16 @@ find_element_by_id (WebKitDOMDocument *document,
 }
 
 static void
-mail_display_plugin_widget_resize (GObject *object,
+mail_display_plugin_widget_resize (GtkWidget *widget,
                                    gpointer dummy,
                                    EMailDisplay *display)
 {
-	GtkWidget *widget;
 	WebKitDOMElement *parent_element;
 	gchar *dim;
 	gint height, width;
+	gfloat scale;
 
-	widget = GTK_WIDGET (object);
-	parent_element = g_object_get_data (object, "parent_element");
+	parent_element = g_object_get_data (G_OBJECT (widget), "parent_element");
 
 	if (!parent_element || !WEBKIT_DOM_IS_ELEMENT (parent_element)) {
 		d (
@@ -644,9 +643,18 @@ mail_display_plugin_widget_resize (GObject *object,
 		return;
 	}
 
+	scale = webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW (display));
 	width = gtk_widget_get_allocated_width (widget);
 	gtk_widget_get_preferred_height_for_width (widget, width, &height, NULL);
 
+	/* When zooming WebKit does not change dimensions of the elements, but
+	 * only scales them on the canvas. GtkWidget can't be scaled though
+	 * so we need to cope with the dimensions changes to keep the widgets
+	 * still the correct size. Due to inaccuracy in rounding (float -> int)
+	 * it still acts a bit funny, but at least it does not cause widgets in
+	 * WebKit to go crazy when zooming. */
+	height = height * (1 / scale);
+
         /* Int -> Str */
 	dim = g_strdup_printf ("%d", height);
 
@@ -688,7 +696,7 @@ mail_display_plugin_widget_realize_cb (GtkWidget *widget,
 
         /* Initial resize of the <object> element when the widget
          * is displayed for the first time. */
-	mail_display_plugin_widget_resize (G_OBJECT (widget), NULL, user_data);
+	mail_display_plugin_widget_resize (widget, NULL, user_data);
 }
 
 static void



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