Updating branch refs/heads/jeromeg/webkit-thumbnailer
         to cd4d9604bdca393cebbd529b6ef7db69bd4adb7e (commit)
       from d1b518fe058c70e4e4bf893be6c080b548a3f2bd (commit)

commit cd4d9604bdca393cebbd529b6ef7db69bd4adb7e
Author: Jérôme Guelfucci <jero...@xfce.org>
Date:   Fri Mar 18 17:45:19 2011 +0100

    Make the thumbnailer actually work.
    
    Set the load-finished callback before starting to load an uri and
    actually show the web view so that we don't get white thumbnails...
    
    Remove the damage callback as it makes everything lag. Instead force a
    window update before retrieving the pixbuf.
    
    Also set a size request for the WebKitView so that it's not 1x1. For
    now default to a classic netbook size, needs further thinking.

 plugins/webkit-thumbnailer/webkit-thumbnailer.c |   32 +++++++---------------
 1 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/plugins/webkit-thumbnailer/webkit-thumbnailer.c 
b/plugins/webkit-thumbnailer/webkit-thumbnailer.c
index cab6fe3..14d80c5 100644
--- a/plugins/webkit-thumbnailer/webkit-thumbnailer.c
+++ b/plugins/webkit-thumbnailer/webkit-thumbnailer.c
@@ -99,18 +99,6 @@ webkit_thumbnailer_class_finalize (WebkitThumbnailerClass 
*klass)
 
 
 
-static gboolean
-cb_offscreen_damage (GtkWidget      *widget,
-                     GdkEventExpose *event,
-                     GtkWidget      *view)
-{
-  gtk_widget_queue_draw (view);
-
-  return TRUE;
-}
-
-
-
 static void
 webkit_thumbnailer_init (WebkitThumbnailer *thumbnailer)
 {
@@ -140,13 +128,9 @@ webkit_thumbnailer_init (WebkitThumbnailer *thumbnailer)
   gtk_container_add (GTK_CONTAINER (thumbnailer->offscreen),
                      thumbnailer->view);
 
-  gtk_widget_show (thumbnailer->offscreen);
-  gtk_widget_queue_draw (thumbnailer->offscreen);
+  gtk_widget_set_size_request (thumbnailer->offscreen, 1024, 600);
 
-  g_signal_connect (thumbnailer->offscreen,
-                    "damage-event",
-                    G_CALLBACK (cb_offscreen_damage),
-                    thumbnailer->view);
+  gtk_widget_show_all (thumbnailer->offscreen);
 }
 
 
@@ -203,6 +187,10 @@ cb_view_load_finished (GtkWidget         *web_view,
                        WebKitWebFrame    *web_frame,
                        WebkitThumbnailer *thumbnailer)
 {
+  gtk_widget_queue_draw (web_view);
+  gdk_window_process_updates (gtk_widget_get_window (thumbnailer->offscreen),
+                              TRUE);
+
   thumbnailer->tmp =
     gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW 
(thumbnailer->offscreen));
 
@@ -259,16 +247,16 @@ webkit_thumbnailer_create (TumblerAbstractThumbnailer 
*thumbnailer,
   /* schedule a timeout to avoid waiting forever */
   g_timeout_add_seconds (LOAD_TIMEOUT, cb_load_timeout, NULL);
 
-  /* load the page in the web view */
-  webkit_web_view_load_uri (WEBKIT_WEB_VIEW (webkit_thumbnailer->view),
-                            uri);
-
   /* retrieve the thumbnail once the page is loaded */
   g_signal_connect (webkit_thumbnailer->view,
                     "load-finished",
                     G_CALLBACK (cb_view_load_finished),
                     webkit_thumbnailer);
 
+  /* load the page in the web view */
+  webkit_web_view_load_uri (WEBKIT_WEB_VIEW (webkit_thumbnailer->view),
+                            uri);
+
   /* wait until the page is loaded */
   gtk_main ();
 
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to