@@ -92,11 +92,6 @@ enum {
92
92
FIND_LAST_SIGNAL
93
93
};
94
94
95
- #if ENABLE_EPUB
96
- static GtkWidget * webview ;
97
- static GtkWidget * offscreenwindow ;
98
- #endif
99
-
100
95
static guint job_signals [LAST_SIGNAL ] = { 0 };
101
96
static guint job_fonts_signals [FONTS_LAST_SIGNAL ] = { 0 };
102
97
static guint job_find_signals [FIND_LAST_SIGNAL ] = { 0 };
@@ -877,8 +872,12 @@ snapshot_callback(WebKitWebView *webview,
877
872
878
873
ev_document_doc_mutex_unlock ();
879
874
ev_job_succeeded (EV_JOB (job_thumb ));
875
+
876
+ gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (webview )));
880
877
}
881
878
879
+ #endif /* ENABLE_EPUB */
880
+
882
881
static void
883
882
web_thumbnail_get_screenshot_cb (WebKitWebView * webview ,
884
883
WebKitLoadEvent event ,
@@ -906,9 +905,10 @@ webview_load_failed_cb (WebKitWebView *webview,
906
905
GError * e = (GError * ) error ;
907
906
g_warning ("Error loading data from %s: %s" , failing_uri , e -> message );
908
907
ev_job_failed_from_error (EV_JOB (job_thumb ), e );
908
+
909
+ gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (webview )));
909
910
return TRUE;
910
911
}
911
- #endif /* ENABLE_EPUB */
912
912
913
913
static gboolean
914
914
ev_job_thumbnail_run (EvJob * job )
@@ -939,24 +939,23 @@ ev_job_thumbnail_run (EvJob *job)
939
939
940
940
#if ENABLE_EPUB
941
941
if (job -> document -> iswebdocument == TRUE) {
942
- if (!webview ) {
943
- webview = webkit_web_view_new ();
944
- g_signal_connect (WEBKIT_WEB_VIEW (webview ),"load-changed" ,
945
- G_CALLBACK (web_thumbnail_get_screenshot_cb ),
946
- g_object_ref (job_thumb ));
947
- g_signal_connect (WEBKIT_WEB_VIEW (webview ),"load-failed" ,
948
- G_CALLBACK (webview_load_failed_cb ),
949
- g_object_ref (job_thumb ));
950
- }
951
-
952
- if (!offscreenwindow ) {
953
- offscreenwindow = gtk_offscreen_window_new ();
954
- gtk_container_add (GTK_CONTAINER (offscreenwindow ),GTK_WIDGET (webview ));
955
- gtk_window_set_default_size (GTK_WINDOW (offscreenwindow ),800 ,1080 );
956
- gtk_widget_show_all (offscreenwindow );
957
- }
958
-
959
- webkit_web_view_load_uri (WEBKIT_WEB_VIEW (webview ),(gchar * )rc -> page -> backend_page );
942
+ GtkWidget * webview ;
943
+ GtkWidget * offscreenwindow ;
944
+
945
+ webview = webkit_web_view_new ();
946
+ offscreenwindow = gtk_offscreen_window_new ();
947
+
948
+ gtk_container_add (GTK_CONTAINER (offscreenwindow ), GTK_WIDGET (webview ));
949
+ gtk_window_set_default_size (GTK_WINDOW (offscreenwindow ), 800 , 1080 );
950
+ gtk_widget_show_all (offscreenwindow );
951
+
952
+ g_signal_connect (WEBKIT_WEB_VIEW (webview ), "load-changed" ,
953
+ G_CALLBACK (web_thumbnail_get_screenshot_cb ),
954
+ g_object_ref (job_thumb ));
955
+ g_signal_connect (WEBKIT_WEB_VIEW (webview ), "load-failed" ,
956
+ G_CALLBACK (webview_load_failed_cb ),
957
+ g_object_ref (job_thumb ));
958
+ webkit_web_view_load_uri (WEBKIT_WEB_VIEW (webview ), (gchar * ) rc -> page -> backend_page );
960
959
}
961
960
else
962
961
#endif /* ENABLE_EPUB */
0 commit comments