[Xfce4-commits] <tumbler:jeromeg/webkit-thumbnailer> Only connect load-finished once.

Jannis Pohlmann noreply at xfce.org
Thu May 26 16:06:06 CEST 2011


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

commit 54e2e051fc3c1f34bb9f32d6836c17407d89bdd6
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Fri Mar 18 17:51:44 2011 +0100

    Only connect load-finished once.

 plugins/webkit-thumbnailer/webkit-thumbnailer.c |   46 +++++++++++-----------
 1 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/plugins/webkit-thumbnailer/webkit-thumbnailer.c b/plugins/webkit-thumbnailer/webkit-thumbnailer.c
index 14d80c5..79633ed 100644
--- a/plugins/webkit-thumbnailer/webkit-thumbnailer.c
+++ b/plugins/webkit-thumbnailer/webkit-thumbnailer.c
@@ -100,6 +100,23 @@ webkit_thumbnailer_class_finalize (WebkitThumbnailerClass *klass)
 
 
 static void
+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));
+
+  gtk_main_quit ();
+}
+
+
+
+static void
 webkit_thumbnailer_init (WebkitThumbnailer *thumbnailer)
 {
   WebKitWebSettings *settings;
@@ -125,6 +142,12 @@ webkit_thumbnailer_init (WebkitThumbnailer *thumbnailer)
   webkit_web_view_set_settings (WEBKIT_WEB_VIEW(thumbnailer->view),
                                 settings);
 
+  /* retrieve thumbnails once the page is loaded */
+  g_signal_connect (thumbnailer->view,
+                    "load-finished",
+                    G_CALLBACK (cb_view_load_finished),
+                    thumbnailer);
+
   gtk_container_add (GTK_CONTAINER (thumbnailer->offscreen),
                      thumbnailer->view);
 
@@ -182,23 +205,6 @@ generate_pixbuf (GdkPixbuf *source,
 
 
 
-static void
-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));
-
-  gtk_main_quit ();
-}
-
-
-
 static gboolean
 cb_load_timeout (gpointer data)
 {
@@ -247,12 +253,6 @@ webkit_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
   /* schedule a timeout to avoid waiting forever */
   g_timeout_add_seconds (LOAD_TIMEOUT, cb_load_timeout, NULL);
 
-  /* 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);



More information about the Xfce4-commits mailing list