[Xfce4-commits] <tumbler:jeromeg/webkit-thumbnailer-rebased> Only connect load-finished once.
Jérôme Guelfucci
noreply at xfce.org
Sun Feb 24 14:42:03 CET 2013
Updating branch refs/heads/jeromeg/webkit-thumbnailer-rebased
to 21c1b6adb67b629967c3e8b536075e3e3e40b8c3 (commit)
from 70b5106cc7a32316c70c7c6498fe833d01385cfe (commit)
commit 21c1b6adb67b629967c3e8b536075e3e3e40b8c3
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