summaryrefslogtreecommitdiff
path: root/libdocument
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2026-05-14 14:49:59 -0400
committerLuke from DC <[email protected]>2026-07-12 20:34:07 +0000
commitc429210e1cdbd648caa46b0621029992eb777f7a (patch)
treeeb5c52bb760f852e9807406e93cb138aa0808508 /libdocument
parent789af2fb86aa6fbb5ec42370bc672afb6a84478e (diff)
downloadatril-c429210e1cdbd648caa46b0621029992eb777f7a.tar.bz2
atril-c429210e1cdbd648caa46b0621029992eb777f7a.tar.xz
epub: Replace backend internals with libgepub
Replace the hand-rolled EPUB parsing with libgepub. This removes the bundled minizip library, custom XML utilities, and temporary directory extraction in favor of GepubDoc which handles archive access, metadata, spine navigation, and table of contents. An epub:// URI scheme handler serves resources directly from the archive without extracting to disk. Search and night mode are stubbed as no-ops pending follow-up commits. Assisted-by: OpenCode:claude-opus-4-6
Diffstat (limited to 'libdocument')
-rw-r--r--libdocument/ev-document.c24
-rw-r--r--libdocument/ev-document.h11
2 files changed, 34 insertions, 1 deletions
diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c
index 96b80946..74efc1d4 100644
--- a/libdocument/ev-document.c
+++ b/libdocument/ev-document.c
@@ -942,6 +942,30 @@ ev_rect_cmp (EvRectangle *a,
(ABS (a->y2 - b->y2) < EPSILON));
}
+GBytes *
+ev_document_get_resource (EvDocument *document,
+ const gchar *path)
+{
+ EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
+
+ if (klass->get_resource)
+ return klass->get_resource (document, path);
+
+ return NULL;
+}
+
+gchar *
+ev_document_get_resource_mime (EvDocument *document,
+ const gchar *path)
+{
+ EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document);
+
+ if (klass->get_resource_mime)
+ return klass->get_resource_mime (document, path);
+
+ return NULL;
+}
+
void
ev_document_toggle_night_mode(EvDocument *document,gboolean night)
{
diff --git a/libdocument/ev-document.h b/libdocument/ev-document.h
index ea0016c0..6a73d0f1 100644
--- a/libdocument/ev-document.h
+++ b/libdocument/ev-document.h
@@ -118,6 +118,11 @@ struct _EvDocumentClass
void (* toggle_night_mode) (EvDocument *document,gboolean night);
void (*check_add_night_sheet)(EvDocument *document);
+
+ GBytes * (* get_resource) (EvDocument *document,
+ const gchar *path);
+ gchar * (* get_resource_mime) (EvDocument *document,
+ const gchar *path);
};
GType ev_document_get_type (void) G_GNUC_CONST;
@@ -185,7 +190,11 @@ 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);
+void ev_document_check_add_night_sheet (EvDocument *document);
+GBytes *ev_document_get_resource (EvDocument *document,
+ const gchar *path);
+gchar *ev_document_get_resource_mime (EvDocument *document,
+ const gchar *path);
#define EV_TYPE_RECTANGLE (ev_rectangle_get_type ())
struct _EvRectangle