[Xfce4-commits] <tumbler:webkit-thumbnailer> Make the thumbnailer actually work.

Jérôme Guelfucci noreply at xfce.org
Fri Mar 18 18:06:01 CET 2011


Updating branch refs/heads/webkit-thumbnailer
         to e6461a9ee6813448b7d7e5651fff0a1cb749af06 (commit)
       from 818e9886237538c70cb455d84e013ff9589a1469 (commit)

commit e6461a9ee6813448b7d7e5651fff0a1cb749af06
Author: Jérôme Guelfucci <jeromeg at 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 ();
 



More information about the Xfce4-commits mailing list