summaryrefslogtreecommitdiff
path: root/libview
diff options
context:
space:
mode:
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-document-model.c2
-rw-r--r--libview/ev-jobs.c122
-rw-r--r--libview/meson.build122
3 files changed, 130 insertions, 116 deletions
diff --git a/libview/ev-document-model.c b/libview/ev-document-model.c
index c19f6544..2e3acfd1 100644
--- a/libview/ev-document-model.c
+++ b/libview/ev-document-model.c
@@ -175,7 +175,7 @@ ev_document_model_get_property (GObject *object,
g_value_set_enum (value, model->page_layout);
break;
case PROP_DUAL_PAGE:
- g_value_set_boolean (value, ev_document_model_get_dual_page (model));
+ g_value_set_boolean (value, ev_document_model_get_page_layout (model));
break;
case PROP_DUAL_PAGE_ODD_LEFT:
g_value_set_boolean (value, ev_document_model_get_dual_page_odd_pages_left (model));
diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c
index 5db40cab..8e33ee5d 100644
--- a/libview/ev-jobs.c
+++ b/libview/ev-jobs.c
@@ -41,9 +41,6 @@
#include "ev-debug.h"
#include <gtk/gtk.h>
-#if ENABLE_EPUB
-#include <webkit2/webkit2.h>
-#endif
#include <errno.h>
#include <glib/gstdio.h>
#include <glib/gi18n-lib.h>
@@ -823,77 +820,6 @@ ev_job_thumbnail_dispose (GObject *object)
(* G_OBJECT_CLASS (ev_job_thumbnail_parent_class)->dispose) (object);
}
-#if ENABLE_EPUB
-static void
-snapshot_callback(WebKitWebView *webview,
- GAsyncResult *results,
- EvJobThumbnail *job_thumb)
-{
- GError *error = NULL;
-
- ev_document_doc_mutex_lock ();
-
- EvPage *page = ev_document_get_page (EV_JOB(job_thumb)->document, job_thumb->page);
- job_thumb->surface = webkit_web_view_get_snapshot_finish (webview,
- results,
- &error);
-
- if (error) {
- g_warning ("Error retrieving a snapshot: %s", error->message);
- }
-
- EvRenderContext *rc = ev_render_context_new (page, job_thumb->rotation, job_thumb->scale);
- EvPage *screenshotpage;
- screenshotpage = ev_page_new(job_thumb->page);
- screenshotpage->backend_page = (EvBackendPage)job_thumb->surface;
- screenshotpage->backend_destroy_func = (EvBackendPageDestroyFunc)cairo_surface_destroy;
- ev_render_context_set_page(rc,screenshotpage);
-
- job_thumb->thumbnail = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (EV_JOB(job_thumb)->document),
- rc, TRUE);
- g_object_unref(screenshotpage);
- g_object_unref(rc);
-
- ev_document_doc_mutex_unlock ();
- ev_job_succeeded (EV_JOB(job_thumb));
-
- gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (webview)));
-}
-
-static void
-web_thumbnail_get_screenshot_cb (WebKitWebView *webview,
- WebKitLoadEvent event,
- EvJobThumbnail *job_thumb)
-{
- if (event != WEBKIT_LOAD_FINISHED || ev_job_is_failed (EV_JOB(job_thumb))) {
- return;
- }
-
- webkit_web_view_get_snapshot (webview,
- WEBKIT_SNAPSHOT_REGION_VISIBLE,
- WEBKIT_SNAPSHOT_OPTIONS_NONE,
- NULL,
- (GAsyncReadyCallback)snapshot_callback,
- g_object_ref (job_thumb));
-}
-
-static gboolean
-webview_load_failed_cb (WebKitWebView *webview,
- WebKitLoadEvent event,
- gchar *failing_uri,
- gpointer error,
- EvJobThumbnail *job_thumb)
-{
- GError *e = (GError *) error;
- g_warning ("Error loading data from %s: %s", failing_uri, e->message);
- ev_job_failed_from_error (EV_JOB(job_thumb), e);
-
- gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (webview)));
- return TRUE;
-}
-
-#endif /* ENABLE_EPUB */
-
static gboolean
ev_job_thumbnail_run (EvJob *job)
{
@@ -903,53 +829,19 @@ ev_job_thumbnail_run (EvJob *job)
ev_debug_message (DEBUG_JOBS, "%d (%p)", job_thumb->page, job);
ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job);
- if (job->document->iswebdocument) {
- /* Do not block the main loop */
- if (!ev_document_doc_mutex_trylock ())
- return TRUE;
- } else {
- ev_document_doc_mutex_lock ();
- }
+ ev_document_doc_mutex_lock ();
page = ev_document_get_page (job->document, job_thumb->page);
ev_document_doc_mutex_unlock ();
- if (job->document->iswebdocument == TRUE ) {
- rc = ev_render_context_new (page, 0, job_thumb->scale);
- } else {
- rc = ev_render_context_new (page, job_thumb->rotation, job_thumb->scale);
- }
+ rc = ev_render_context_new (page, job_thumb->rotation, job_thumb->scale);
g_object_unref (page);
-#if ENABLE_EPUB
- if (job->document->iswebdocument == TRUE) {
- GtkWidget *webview;
- GtkWidget *offscreenwindow;
-
- webview = webkit_web_view_new ();
- offscreenwindow = gtk_offscreen_window_new ();
-
- gtk_container_add (GTK_CONTAINER(offscreenwindow), GTK_WIDGET (webview));
- gtk_window_set_default_size (GTK_WINDOW(offscreenwindow), 800, 1080);
- gtk_widget_show_all (offscreenwindow);
-
- g_signal_connect (WEBKIT_WEB_VIEW (webview), "load-changed",
- G_CALLBACK (web_thumbnail_get_screenshot_cb),
- g_object_ref (job_thumb));
- g_signal_connect (WEBKIT_WEB_VIEW(webview), "load-failed",
- G_CALLBACK(webview_load_failed_cb),
- g_object_ref (job_thumb));
- webkit_web_view_load_uri (WEBKIT_WEB_VIEW (webview), (gchar*) rc->page->backend_page);
- }
- else
-#endif /* ENABLE_EPUB */
- {
- ev_document_doc_mutex_lock ();
- job_thumb->thumbnail = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (job->document),
- rc, TRUE);
- ev_document_doc_mutex_unlock ();
- ev_job_succeeded (job);
- }
+ ev_document_doc_mutex_lock ();
+ job_thumb->thumbnail = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (job->document),
+ rc, TRUE);
+ ev_document_doc_mutex_unlock ();
+ ev_job_succeeded (job);
g_object_unref (rc);
return FALSE;
diff --git a/libview/meson.build b/libview/meson.build
new file mode 100644
index 00000000..f345a608
--- /dev/null
+++ b/libview/meson.build
@@ -0,0 +1,122 @@
+libview_private_headers = [
+ 'ev-annotation-window.h',
+ 'ev-link-accessible.h',
+ 'ev-page-accessible.h',
+ 'ev-image-accessible.h',
+ 'ev-form-field-accessible.h',
+ 'ev-page-cache.h',
+ 'ev-pixbuf-cache.h',
+ 'ev-timeline.h',
+ 'ev-transition-animation.h',
+ 'ev-view-accessible.h',
+ 'ev-view-cursor.h',
+ 'ev-view-private.h',
+]
+
+libview_headers = [
+ 'ev-document-model.h',
+ 'ev-jobs.h',
+ 'ev-job-scheduler.h',
+ 'ev-print-operation.h',
+ 'ev-stock-icons.h',
+ 'ev-view.h',
+ 'ev-web-view.h',
+ 'ev-view-presentation.h',
+]
+
+libview_sources = [
+ 'ev-annotation-window.c',
+ 'ev-document-model.c',
+ 'ev-jobs.c',
+ 'ev-job-scheduler.c',
+ 'ev-link-accessible.c',
+ 'ev-page-accessible.c',
+ 'ev-image-accessible.c',
+ 'ev-form-field-accessible.c',
+ 'ev-page-cache.c',
+ 'ev-pixbuf-cache.c',
+ 'ev-print-operation.c',
+ 'ev-stock-icons.c',
+ 'ev-timeline.c',
+ 'ev-transition-animation.c',
+ 'ev-view.c',
+ 'ev-web-view.c',
+ 'ev-view-accessible.c',
+ 'ev-view-cursor.c',
+ 'ev-view-presentation.c',
+ libview_headers,
+]
+
+libview_header_dir = join_paths(header_dir, 'libview')
+
+libview_include = include_directories('.')
+
+libview_enums = gnome.mkenums(
+ 'ev-view-type-builtins',
+ sources : libview_headers,
+ c_template : 'ev-view-type-builtins.c.template',
+ h_template : 'ev-view-type-builtins.h.template',
+ identifier_prefix : 'Ev',
+ symbol_prefix : 'ev',
+ install_header: true,
+ install_dir: join_paths(includedir, libview_header_dir),
+)
+
+libview_sources += libview_enums
+
+libview_marshal = gnome.genmarshal(
+ 'ev-view-marshal',
+ sources: 'ev-view-marshal.list',
+ prefix: 'ev_view_marshal'
+)
+
+libview_deps = [
+ libdocument_dep,
+ config_h,
+ gail,
+ glib,
+ gtk,
+ gtk_unix_print,
+ math,
+]
+
+if get_option('epub')
+ libview_deps += webkit
+endif
+
+libview = library(
+ 'view',
+ libview_sources + libview_private_headers + libdoc_enums + libview_marshal,
+ include_directories: include_dirs,
+ dependencies: libview_deps,
+ soversion: binary_major_version,
+ version: binary_version,
+ install: true,
+)
+
+libview_dep = declare_dependency(
+ link_with: libview,
+ include_directories: include_dirs,
+ dependencies: libview_deps,
+)
+
+install_headers(
+ libview_headers,
+ subdir: libview_header_dir,
+)
+
+if get_option('introspection')
+ libview_gir = gnome.generate_gir(
+ libview,
+ namespace: 'AtrilView',
+ nsversion: api_version,
+ sources: libview_sources,
+ identifier_prefix: 'Ev',
+ symbol_prefix: 'ev',
+ includes: [introspection_includes, libdocument_gir[0]],
+ install: true,
+ install_dir_typelib: join_paths(libdir, 'girepository-1.0'),
+ install_dir_gir: join_paths(datadir, 'gir-1.0'),
+ export_packages: ['libview-' + api_version, 'libdocument-' + api_version],
+ )
+endif