summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libview/ev-jobs.c40
-rw-r--r--shell/ev-sidebar-thumbnails.c3
-rw-r--r--shell/ev-window.c6
3 files changed, 24 insertions, 25 deletions
diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c
index 8a9f6727..89807474 100644
--- a/libview/ev-jobs.c
+++ b/libview/ev-jobs.c
@@ -98,10 +98,8 @@ enum {
FIND_LAST_SIGNAL
};
-typedef struct _WebKitScreenShot {
- cairo_surface_t *surface;
- gboolean completed;
-}WebKitScreenShot;
+static GtkWidget* webview;
+static GtkWidget* offscreenwindow;
static guint job_signals[LAST_SIGNAL] = { 0 };
static guint job_fonts_signals[FONTS_LAST_SIGNAL] = { 0 };
@@ -924,18 +922,17 @@ ev_job_web_thumbnail_dispose (GObject *object)
}
static void
-web_thumbnail_get_screenshot_cb(WebKitWebView *webview,
- GParamSpec *spec,
+web_thumbnail_get_screenshot_cb(WebKitWebView *webview,
+ WebKitWebFrame *webframe,
EvJobWebThumbnail *web_thumb_job)
{
WebKitLoadStatus status = webkit_web_view_get_load_status(webview);
if (status == WEBKIT_LOAD_FINISHED) {
- g_rw_lock_writer_unlock (&web_thumb_job->screenlock);
- g_rw_lock_reader_trylock (&web_thumb_job->screenlock);
web_thumb_job->surface = webkit_web_view_get_snapshot (WEBKIT_WEB_VIEW(webview));
- g_rw_lock_reader_unlock (&web_thumb_job->screenlock);
- *(web_thumb_job->completed) = TRUE;
+ if (web_thumb_job->surface) {
+ *(web_thumb_job->completed) = TRUE;
+ }
}
}
@@ -943,12 +940,17 @@ static gboolean
ev_job_web_thumbnail_run (EvJob *job)
{
EvJobWebThumbnail *web_thumb_job = EV_JOB_WEB_THUMBNAIL(job);
+ if (!webview) {
+ webview = webkit_web_view_new();
+ }
+
+ if (!offscreenwindow) {
+ offscreenwindow = gtk_offscreen_window_new();
+
+ gtk_container_add(GTK_CONTAINER(offscreenwindow),GTK_WIDGET(webview));
- web_thumb_job->webview = webkit_web_view_new();
- web_thumb_job->offscreenwindow = gtk_offscreen_window_new();
- gtk_container_add(GTK_CONTAINER(web_thumb_job->offscreenwindow),GTK_WIDGET(web_thumb_job->webview));
-
- gtk_window_set_default_size (GTK_WINDOW(web_thumb_job->offscreenwindow),800,1080);
+ gtk_window_set_default_size (GTK_WINDOW(offscreenwindow),800,1080);
+ }
ev_debug_message (DEBUG_JOBS, "%s (%p)", web_thumb_job->page, job);
@@ -958,11 +960,9 @@ ev_job_web_thumbnail_run (EvJob *job)
ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job);
#endif
-
- g_rw_lock_writer_trylock (&web_thumb_job->screenlock);
- webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_thumb_job->webview),web_thumb_job->page);
- g_signal_connect(WEBKIT_WEB_VIEW(web_thumb_job->webview),"notify::load-status",G_CALLBACK(web_thumbnail_get_screenshot_cb),web_thumb_job);
- gtk_widget_show_all(web_thumb_job->offscreenwindow);
+ webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),web_thumb_job->page);
+ g_signal_connect(WEBKIT_WEB_VIEW(webview),"document-load-finished",G_CALLBACK(web_thumbnail_get_screenshot_cb),web_thumb_job);
+ gtk_widget_show_all(offscreenwindow);
ev_job_succeeded (EV_JOB(job));
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
index 92f24c2a..5c4cb4be 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -374,9 +374,6 @@ clear_range (EvSidebarThumbnails *sidebar_thumbnails,
result = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->list_store), &iter), start_page ++) {
EvJobThumbnail *job;
- if (priv->document->iswebdocument == TRUE) {
- EV_JOB(job)->run_mode = EV_JOB_RUN_MAIN_LOOP ;
- }
GdkPixbuf *loading_icon = NULL;
gint width, height;
diff --git a/shell/ev-window.c b/shell/ev-window.c
index d73cfba6..277488c6 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -682,8 +682,10 @@ update_sizing_buttons (EvWindow *window)
ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action),
EPHY_ZOOM_BEST_FIT);
} else if (page_width) {
- ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action),
- EPHY_ZOOM_FIT_WIDTH);
+ if (!window->priv->document || (window->priv->document && !window->priv->document->iswebdocument)) {
+ ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action),
+ EPHY_ZOOM_FIT_WIDTH);
+ }
}
}