From 70a278d95023d368570b6285ae8e2c2e559220f0 Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Tue, 29 Jan 2019 17:50:46 +0800 Subject: drop current epub support --- libdocument/ev-document-find.c | 9 ---- libdocument/ev-document-find.h | 9 ---- libdocument/ev-document-thumbnails.c | 3 +- libdocument/ev-document-thumbnails.h | 2 +- libdocument/ev-document.c | 84 +++++++----------------------------- libdocument/ev-document.h | 10 ----- 6 files changed, 18 insertions(+), 99 deletions(-) (limited to 'libdocument') diff --git a/libdocument/ev-document-find.c b/libdocument/ev-document-find.c index 4be1b201..f4f09cce 100644 --- a/libdocument/ev-document-find.c +++ b/libdocument/ev-document-find.c @@ -49,12 +49,3 @@ ev_document_find_find_text (EvDocumentFind *document_find, return iface->find_text (document_find, page, text, case_sensitive); } -guint -ev_document_find_check_for_hits(EvDocumentFind *document_find, - EvPage *page, - const gchar *text, - gboolean case_sensitive) -{ - EvDocumentFindInterface *iface = EV_DOCUMENT_FIND_GET_IFACE (document_find); - return iface->check_for_hits (document_find, page, text, case_sensitive); -} \ No newline at end of file diff --git a/libdocument/ev-document-find.h b/libdocument/ev-document-find.h index 2b6ba68b..7fcf49c7 100644 --- a/libdocument/ev-document-find.h +++ b/libdocument/ev-document-find.h @@ -52,11 +52,6 @@ struct _EvDocumentFindInterface EvPage *page, const gchar *text, gboolean case_sensitive); - - guint (* check_for_hits) (EvDocumentFind *document_find, - EvPage *page, - const gchar *text, - gboolean case_sensitive); }; GType ev_document_find_get_type (void) G_GNUC_CONST; @@ -65,10 +60,6 @@ GList *ev_document_find_find_text (EvDocumentFind *document_find, const gchar *text, gboolean case_sensitive); -guint ev_document_find_check_for_hits (EvDocumentFind *document_find, - EvPage *page, - const gchar *text, - gboolean case_sensitive); G_END_DECLS #endif /* EV_DOCUMENT_FIND_H */ diff --git a/libdocument/ev-document-thumbnails.c b/libdocument/ev-document-thumbnails.c index 65248683..9482e09e 100644 --- a/libdocument/ev-document-thumbnails.c +++ b/libdocument/ev-document-thumbnails.c @@ -59,4 +59,5 @@ ev_document_thumbnails_get_dimensions (EvDocumentThumbnails *document, iface = EV_DOCUMENT_THUMBNAILS_GET_IFACE (document); iface->get_dimensions (document, rc, width, height); -} \ No newline at end of file +} + diff --git a/libdocument/ev-document-thumbnails.h b/libdocument/ev-document-thumbnails.h index bebf2348..4820b353 100644 --- a/libdocument/ev-document-thumbnails.h +++ b/libdocument/ev-document-thumbnails.h @@ -51,7 +51,6 @@ struct _EvDocumentThumbnailsInterface { EvRenderContext *rc, gint *width, gint *height); - }; GType ev_document_thumbnails_get_type (void) G_GNUC_CONST; @@ -63,6 +62,7 @@ void ev_document_thumbnails_get_dimensions (EvDocumentThumbnails *document EvRenderContext *rc, gint *width, gint *height); + G_END_DECLS #endif /* EV_DOCUMENT_THUMBNAILS_H */ diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c index e7f59ded..95131b9d 100644 --- a/libdocument/ev-document.c +++ b/libdocument/ev-document.c @@ -26,7 +26,6 @@ #include "ev-document.h" #include "synctex_parser.h" -#include "ev-file-helpers.h" #define EV_DOCUMENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EV_TYPE_DOCUMENT, EvDocumentPrivate)) @@ -142,8 +141,6 @@ ev_document_init (EvDocument *document) /* Assume all pages are the same size until proven otherwise */ document->priv->uniform = TRUE; - /* Assume that the document is not a web document*/ - document->iswebdocument = FALSE ; } static void @@ -222,14 +219,6 @@ ev_document_load (EvDocument *document, gboolean retval; GError *err = NULL; - /* - * Hardcoding a check for ePub documents, cause it needs a web document DOM - * and webkit, support for any other web document types can be added similarly. - */ - - if ( !g_strcmp0 (ev_file_get_mime_type(uri,TRUE,&err),"application/epub+zip") ) - document->iswebdocument=TRUE ; - retval = klass->load (document, uri, &err); if (!retval) { if (err) { @@ -251,34 +240,18 @@ ev_document_load (EvDocument *document, /* Cache some info about the document to avoid * going to the backends since it requires locks */ - priv->uri = g_strdup (uri); - priv->n_pages = _ev_document_get_n_pages (document); - - for (i = 0; i < priv->n_pages; i++) { - /* - * Since there is no sense of paging in an ePub,it makes no sense to have pages sizes. - * We are however geeneralising the scenario by considering epub as a type of web document. - * FIXME: Labels, or bookmarks though, can be done. - */ - + for (i = 0; i < priv->n_pages; i++) { EvPage *page = ev_document_get_page (document, i); gdouble page_width = 0; gdouble page_height = 0; EvPageSize *page_size; gchar *page_label; - - if ( document->iswebdocument == FALSE ) { - _ev_document_get_page_size (document, page, &page_width, &page_height); - } - else { - //Fixed page sized to resolve the X-windowing system error. - page_width = 800; - page_height= 600; - } - + + _ev_document_get_page_size (document, page, &page_width, &page_height); + if (i == 0) { priv->uniform_width = page_width; priv->uniform_height = page_height; @@ -286,21 +259,14 @@ ev_document_load (EvDocument *document, priv->max_height = priv->uniform_height; priv->min_width = priv->uniform_width; priv->min_height = priv->uniform_height; - if (document->iswebdocument == TRUE ) { - priv->page_sizes = g_new0 (EvPageSize, 1); - priv->page_sizes->width = priv->uniform_width; - priv->page_sizes->height = priv->uniform_height; - priv->uniform = TRUE ; - break; - } } else if (priv->uniform && (priv->uniform_width != page_width || priv->uniform_height != page_height)) { /* It's a different page size. Backfill the array. */ int j; - + priv->page_sizes = g_new0 (EvPageSize, priv->n_pages); - + for (j = 0; j < i; j++) { page_size = &(priv->page_sizes[j]); page_size->width = priv->uniform_width; @@ -531,21 +497,15 @@ ev_document_get_page_size (EvDocument *document, { g_return_if_fail (EV_IS_DOCUMENT (document)); g_return_if_fail (page_index >= 0 || page_index < document->priv->n_pages); - if (document->iswebdocument == TRUE ) { - if (width) - *width = document->priv->uniform_width; - if (height) - *height = document->priv->uniform_height; - } else { - if (width) - *width = document->priv->uniform ? - document->priv->uniform_width : - document->priv->page_sizes[page_index].width; - if (height) - *height = document->priv->uniform ? - document->priv->uniform_height : - document->priv->page_sizes[page_index].height; - } + + if (width) + *width = document->priv->uniform ? + document->priv->uniform_width : + document->priv->page_sizes[page_index].width; + if (height) + *height = document->priv->uniform ? + document->priv->uniform_height : + document->priv->page_sizes[page_index].height; } static gchar * @@ -934,17 +894,3 @@ ev_rect_cmp (EvRectangle *a, (ABS (a->x2 - b->x2) < EPSILON) && (ABS (a->y2 - b->y2) < EPSILON)); } - -void -ev_document_toggle_night_mode(EvDocument *document,gboolean night) -{ - EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS(document); - return klass->toggle_night_mode(document,night) ; -} - -void -ev_document_check_add_night_sheet(EvDocument *document) -{ - EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS(document); - return klass->check_add_night_sheet(document) ; -} diff --git a/libdocument/ev-document.h b/libdocument/ev-document.h index 6c492da8..cff3a00c 100644 --- a/libdocument/ev-document.h +++ b/libdocument/ev-document.h @@ -80,11 +80,6 @@ struct _EvDocument GObject base; EvDocumentPrivate *priv; - /* - * Since we can only access the members of this structure from the window frontend, - * we need a flag to detemine whether to replace the atril-view with a web-view. - */ - gboolean iswebdocument; }; struct _EvDocumentClass @@ -113,9 +108,6 @@ struct _EvDocumentClass gboolean (* get_backend_info)(EvDocument *document, EvDocumentBackendInfo *info); gboolean (* support_synctex) (EvDocument *document); - - void (* toggle_night_mode) (EvDocument *document,gboolean night); - void (*check_add_night_sheet)(EvDocument *document); }; GType ev_document_get_type (void) G_GNUC_CONST; @@ -182,8 +174,6 @@ EvMapping *ev_document_synctex_forward_search gint ev_rect_cmp (EvRectangle *a, EvRectangle *b); -void ev_document_toggle_night_mode (EvDocument *document,gboolean night); -void ev_document_check_add_night_sheet (EvDocument *document); #define EV_TYPE_RECTANGLE (ev_rectangle_get_type ()) struct _EvRectangle -- cgit v1.2.1