[evince/wip/hadess/faster-libarchive: 19/20] comics: Add helper to get the state of the EvArchive
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/hadess/faster-libarchive: 19/20] comics: Add helper to get the state of the EvArchive
- Date: Wed, 2 Mar 2022 15:19:35 +0000 (UTC)
commit b1732c19af3d4adf1fc481e0e72a0cbf34240c18
Author: Bastien Nocera <hadess hadess net>
Date: Sat Feb 26 13:04:32 2022 +0100
comics: Add helper to get the state of the EvArchive
We need to know whether we have a file opened and we're at an entry to
be able to fetch its metadata without throwing errors, so add a function
for that.
backend/comics/ev-archive.c | 9 +++++++++
backend/comics/ev-archive.h | 1 +
2 files changed, 10 insertions(+)
---
diff --git a/backend/comics/ev-archive.c b/backend/comics/ev-archive.c
index d1a693d2b..6586482b6 100644
--- a/backend/comics/ev-archive.c
+++ b/backend/comics/ev-archive.c
@@ -198,6 +198,15 @@ ev_archive_read_next_header (EvArchive *archive,
return FALSE;
}
+gboolean
+ev_archive_at_entry (EvArchive *archive)
+{
+ g_return_val_if_fail (EV_IS_ARCHIVE (archive), FALSE);
+ g_return_val_if_fail (archive->type != EV_ARCHIVE_TYPE_NONE, FALSE);
+
+ return (archive->libar_entry != NULL);
+}
+
const char *
ev_archive_get_entry_pathname (EvArchive *archive)
{
diff --git a/backend/comics/ev-archive.h b/backend/comics/ev-archive.h
index 946234342..b4e1399c7 100644
--- a/backend/comics/ev-archive.h
+++ b/backend/comics/ev-archive.h
@@ -43,6 +43,7 @@ gboolean ev_archive_open_filename (EvArchive *archive,
GError **error);
gboolean ev_archive_read_next_header (EvArchive *archive,
GError **error);
+gboolean ev_archive_at_entry (EvArchive *archive);
const char *ev_archive_get_entry_pathname (EvArchive *archive);
gint64 ev_archive_get_entry_size (EvArchive *archive);
gboolean ev_archive_get_entry_is_encrypted (EvArchive *archive);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]