...
 
Commits (1404)
stages:
- build
- deploy
variables:
BUNDLE: "org.gnome.Evince.flatpak"
master:
image: registry.gitlab.gnome.org/gnome/evince/master-amd64:latest
stage: build
script:
- ./autogen.sh --enable-debug --enable-nautilus
- make
artifacts:
when: on_failure
paths:
- config.log
expire_in: 2 days
meson:
image: registry.gitlab.gnome.org/gnome/evince/master-amd64:latest
stage: build
when: manual
script:
- meson _build
- ninja -C _build all
artifacts:
when: on_failure
paths:
- _build/meson-logs/meson-log.txt
expire_in: 2 days
meson-gtk-doc:
image: registry.gitlab.gnome.org/gnome/evince/master-amd64:latest
stage: build
when: manual
script:
- meson -Dgtk_doc=true _build
- ninja -C _build all libevdocument-doc libevview-doc evince-doc
artifacts:
when: on_failure
paths:
- _build/meson-logs/meson-log.txt
expire_in: 2 days
gtk-doc:
image: registry.gitlab.gnome.org/gnome/evince/master-amd64:latest
stage: build
when: manual
script:
- ./autogen.sh --enable-nautilus --enable-gtk-doc
- make
artifacts:
when: on_failure
paths:
- config.log
expire_in: 2 days
flatpak:
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
stage: build
variables:
MANIFEST_PATH: "build-aux/flatpak/org.gnome.Evince.json"
RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo"
FLATPAK_MODULE: "evince"
MESON_ARGS: "-Dnautilus=false"
APP_ID: "org.gnome.Evince"
script:
- flatpak-builder --stop-at=evince app ${MANIFEST_PATH}
- flatpak build app meson --prefix=/app ${MESON_ARGS} _build
- flatpak build app ninja -C _build install
- flatpak-builder --finish-only --repo=_repo app ${MANIFEST_PATH}
# Run automatic tests inside the Flatpak env
- xvfb-run -a -s "-screen 0 1024x768x24" flatpak build app ninja -C _build test
- flatpak build-bundle _repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID}
artifacts:
paths:
- ${BUNDLE}
- _build/meson-logs/meson-log.txt
expire_in: 2 days
cache:
paths:
- .flatpak-builder/downloads
- .flatpak-builder/git
deploy:
stage: deploy
dependencies:
- flatpak
script:
- echo "Generating flatpak deployment"
artifacts:
paths:
- ${BUNDLE}
expire_in: 2 days
environment:
name: deploy/$CI_COMMIT_REF_NAME
url: https://gitlab.gnome.org/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/raw/${BUNDLE}
on_stop: stop_deploy
except:
- tags
# don't run on stable branches
- /^gnome-\d-\d\d$/
# No need to run on the upstream master branch either
- master@GNOME/evince
stop_deploy:
stage: deploy
script:
- echo "Stopping flatpak deployment"
when: manual
environment:
name: deploy/$CI_COMMIT_REF_NAME
action: stop
except:
- tags
# don't run on stable branches
- /^gnome-\d-\d\d$/
# No need to run on the upstream master branch either
- master@GNOME/evince
\ No newline at end of file
......@@ -6039,7 +6039,7 @@
(pdf_document_file_exporter_begin),
(pdf_document_file_exporter_do_page):
Make cairo-pdf depedency optional.
Make cairo-pdf dependency optional.
2006-12-18 Carlos Garcia Campos <carlosgc@gnome.org>
......
......@@ -45,31 +45,27 @@ header_DATA = \
# Appdata files
appdatadir = $(datadir)/appdata
appdata_in_files = evince.appdata.xml.in
appdatadir = $(datadir)/metainfo
appdata_in_files = org.gnome.Evince.appdata.xml.in
nodist_appdata_DATA = $(appdata_in_files:.xml.in=.xml)
@INTLTOOL_XML_RULE@
org.gnome.Evince.appdata.xml: org.gnome.Evince.appdata.xml.in
$(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
# Applications
intltool_extra = intltool-extract.in intltool-merge.in intltool-update.in
EXTRA_DIST = \
$(intltool_extra) \
$(header_DATA) \
$(appdata_in_files) \
autogen.sh \
MAINTAINERS
MAINTAINERS \
README.md
CLEANFILES = \
$(nodist_appdata_DATA) \
$(NULL)
DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update
DISTCLEANFILES =
MAINTAINERCLEANFILES = \
ChangeLog \
......
This diff is collapsed.
Security fixes
==============
* Evince 3.24.1
* Remove support for tar and tar-like commands in commics backend
(#784630). CVE-2017-1000083. (Bastien Nocera)
* Evince 3.21.92
* Fix a crash when processing button events in EvView (#769700)
CVE-2013-3718. (Marek Kasik)
* Evince 2.91.5
* Fix several security issues in dvi backend.
CVE-2010-2640, CVE-2010-2641, CVE-2010-2642 and CVE-2010-2643.
(José Aliste)
* Evince 0.7.0
* Buffer overflow in PS backend (#380191).
CVE-2006-5864. (Carlos Garcia Campos)
Evince
==================================================
Evince is a document viewer capable of displaying
multiple and single page document formats like PDF
and Postscript. For more general information about
Evince please visit our website at
https://wiki.gnome.org/Apps/Evince
This software is licensed under the GPL
Evince Requirements
==================================================
GNOME Platform libraries [ http://www.gnome.org/start/ ]
Poppler for PDF viewing [ http://poppler.freedesktop.org/ ]
GhostScript for Postscript viewing [ http://pages.cs.wisc.edu/~ghost/ ]
Evince Optional Backend Libraries
==================================================
DjVuLibre for DjVu viewing [ http://djvulibre.djvuzone.org/ ]
Rar for viewing CBR comics [ http://www.rarlab.com/ ]
# ![evince-logo] Evince
Evince is a document viewer capable of displaying multiple and single
page document formats like PDF and Postscript. For more general
information about Evince please visit our website at
https://wiki.gnome.org/Apps/Evince.
This software is licensed under the [GPLv2][license].
## Evince Requirements
* [GNOME Platform libraries][gnome]
* [Poppler for PDF viewing][poppler]
## Evince Optional Backend Libraries
* [Spectre for PostScript (PS) viewing][ghostscript]
* [DjVuLibre for DjVu viewing][djvulibre]
* [Kpathsea for Device-independent file format (DVI) viewing][dvi]
* [Archive library for Comic Book Resources (CBR) viewing][comics]
* [LibTiff for Multipage TIFF viewing][tiff]
* [LibGXPS for XML Paper Specification (XPS) viewing][xps]
[gnome]: https://www.gnome.org/start/
[poppler]: https://poppler.freedesktop.org/
[ghostscript]: https://www.freedesktop.org/wiki/Software/libspectre/
[djvulibre]: https://djvulibre.djvuzone.org/
[dvi]: https://tug.org/texinfohtml/kpathsea.html
[comics]: http://libarchive.org/
[tiff]: http://libtiff.org/
[xps]: https://wiki.gnome.org/Projects/libgxps
[license]: COPYING
[evince-logo]: data/icons/48x48/apps/org.gnome.Evince.png
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
test -n "$srcdir" || srcdir=$(dirname "$0")
test -n "$srcdir" || srcdir=.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
olddir=$(pwd)
PKG_NAME="evince"
cd $srcdir
(test -f $srcdir/configure.ac) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
(test -f configure.ac) || {
echo "*** ERROR: Directory '$srcdir' does not look like the top-level project directory ***"
exit 1
}
which gnome-autogen.sh || {
echo "You need to install gnome-common from the GNOME CVS"
exit 1
}
# shellcheck disable=SC2016
PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac)
if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
echo "*** If you wish to pass any to it, please specify them on the" >&2
echo "*** '$0' command line." >&2
echo "" >&2
fi
aclocal --install || exit 1
gtkdocize --copy || exit 1
autoreconf --verbose --force --install || exit 1
cd "$olddir"
if [ "$NOCONFIGURE" = "" ]; then
$srcdir/configure "$@" || exit 1
REQUIRED_AUTOMAKE_VERSION=1.10
REQUIRED_GTK_DOC_VERSION=1.13
USE_GNOME2_MACROS=1
. gnome-autogen.sh
if [ "$1" = "--help" ]; then
exit 0
else
echo "Now type 'make' to compile $PKG_NAME" || exit 1
fi
else
echo "Skipping configure process."
fi
{
global:
register_evince_backend;
local:
*;
};
......@@ -2,34 +2,55 @@ backend_LTLIBRARIES = libcomicsdocument.la
libcomicsdocument_la_SOURCES = \
comics-document.c \
comics-document.h
comics-document.h \
ev-archive.c \
ev-archive.h
libcomicsdocument_la_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/libdocument \
-I$(top_srcdir)/cut-n-paste \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
-DEVINCE_COMPILATION \
$(AM_CPPFLAGS)
libcomicsdocument_la_CFLAGS = \
$(BACKEND_CFLAGS) \
$(LIBARCHIVE_CFLAGS) \
$(LIB_CFLAGS) \
$(AM_CFLAGS)
libcomicsdocument_la_LDFLAGS = $(BACKEND_LIBTOOL_FLAGS)
libcomicsdocument_la_LIBADD = \
$(top_builddir)/libdocument/libevdocument3.la \
$(top_builddir)/cut-n-paste/unarr/libunarr.la \
$(LIBARCHIVE_LIBS) \
$(BACKEND_LIBS) \
$(LIB_LIBS)
backend_in_files = comicsdocument.evince-backend.in.in
backend_DATA = $(backend_in_files:.evince-backend.in.in=.evince-backend)
@EV_INTLTOOL_EVINCE_BACKEND_RULE@
backend_in_files = comicsdocument.evince-backend.desktop.in.in
backend_DATA = $(backend_in_files:.evince-backend.desktop.in.in=.evince-backend)
appstreamdir = $(datadir)/appdata
comicsdocument.evince-backend: comicsdocument.evince-backend.desktop.in
$(AM_V_GEN)$(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@
appstreamdir = $(datadir)/metainfo
appstream_in_files = evince-comicsdocument.metainfo.xml.in.in
appstream_DATA = $(appstream_in_files:.xml.in.in=.xml)
@INTLTOOL_XML_RULE@
evince-comicsdocument.metainfo.xml: evince-comicsdocument.metainfo.xml.in
$(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
noinst_PROGRAMS = test-ev-archive
test_ev_archive_SOURCES = ev-archive.c ev-archive.h test-ev-archive.c
test_ev_archive_CPPFLAGS = $(libcomicsdocument_la_CPPFLAGS)
test_ev_archive_CFLAGS = $(libcomicsdocument_la_CFLAGS)
test_ev_archive_LDADD = \
$(top_builddir)/cut-n-paste/unarr/libunarr.la \
$(LIBARCHIVE_LIBS) \
$(BACKEND_LIBS) \
$(LIB_LIBS)
EXTRA_DIST = $(backend_in_files) $(appstream_in_files)
......
This diff is collapsed.
[Evince Backend]
Module=comicsdocument
_TypeDescription=Comic Books
TypeDescription=Comic Books
MimeType=@COMICS_MIME_TYPES@;
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
/*
* Copyright (C) 2017, Bastien Nocera <hadess@hadess.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "ev-archive.h"
#include <archive.h>
#include <archive_entry.h>
#include <unarr/unarr.h>
#include <gio/gio.h>
#define BUFFER_SIZE (64 * 1024)
struct _EvArchive {
GObject parent_instance;
EvArchiveType type;
/* libarchive */
struct archive *libar;
struct archive_entry *libar_entry;
/* unarr */
ar_stream *unarr_stream;
ar_archive *unarr;
};
G_DEFINE_TYPE(EvArchive, ev_archive, G_TYPE_OBJECT);
static void
ev_archive_finalize (GObject *object)
{
EvArchive *archive = EV_ARCHIVE (object);
switch (archive->type) {
case EV_ARCHIVE_TYPE_RAR:
g_clear_pointer (&archive->unarr, ar_close_archive);
g_clear_pointer (&archive->unarr_stream, ar_close);
break;
case EV_ARCHIVE_TYPE_ZIP:
case EV_ARCHIVE_TYPE_7Z:
case EV_ARCHIVE_TYPE_TAR:
g_clear_pointer (&archive->libar, archive_free);
break;
default:
break;
}
G_OBJECT_CLASS (ev_archive_parent_class)->finalize (object);
}
static void
ev_archive_class_init (EvArchiveClass *klass)
{
GObjectClass *object_class = (GObjectClass *) klass;
object_class->finalize = ev_archive_finalize;
}
EvArchive *
ev_archive_new (void)
{
return g_object_new (EV_TYPE_ARCHIVE, NULL);
}
static void
libarchive_set_archive_type (EvArchive *archive,
EvArchiveType archive_type)
{
archive->type = archive_type;
archive->libar = archive_read_new ();
if (archive_type == EV_ARCHIVE_TYPE_ZIP)
archive_read_support_format_zip (archive->libar);
else if (archive_type == EV_ARCHIVE_TYPE_7Z)
archive_read_support_format_7zip (archive->libar);
else if (archive_type == EV_ARCHIVE_TYPE_TAR)
archive_read_support_format_tar (archive->libar);
}
EvArchiveType
ev_archive_get_archive_type (EvArchive *archive)
{
g_return_val_if_fail (EV_IS_ARCHIVE (archive), EV_ARCHIVE_TYPE_NONE);
return archive->type;
}
gboolean
ev_archive_set_archive_type (EvArchive *archive,
EvArchiveType archive_type)
{
g_return_val_if_fail (EV_IS_ARCHIVE (archive), FALSE);
g_return_val_if_fail (archive->type == EV_ARCHIVE_TYPE_NONE, FALSE);
switch (archive_type) {
case EV_ARCHIVE_TYPE_RAR:
archive->type = archive_type;
break;
case EV_ARCHIVE_TYPE_ZIP:
case EV_ARCHIVE_TYPE_7Z:
case EV_ARCHIVE_TYPE_TAR:
libarchive_set_archive_type (archive, archive_type);
break;
default:
g_assert_not_reached ();
}
return TRUE;
}
gboolean
ev_archive_open_filename (EvArchive *archive,
const char *path,
GError **error)
{
int r;
g_return_val_if_fail (EV_IS_ARCHIVE (archive), FALSE);
g_return_val_if_fail (archive->type != EV_ARCHIVE_TYPE_NONE, FALSE);
g_return_val_if_fail (path != NULL, FALSE);
switch (archive->type) {
case EV_ARCHIVE_TYPE_NONE:
g_assert_not_reached ();
case EV_ARCHIVE_TYPE_RAR:
archive->unarr_stream = ar_open_file (path);
if (archive->unarr_stream == NULL) {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Error opening archive");
return FALSE;
}
archive->unarr = ar_open_rar_archive (archive->unarr_stream);
if (archive->unarr == NULL) {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Error opening RAR archive");
return FALSE;
}
return TRUE;
case EV_ARCHIVE_TYPE_ZIP:
case EV_ARCHIVE_TYPE_7Z:
case EV_ARCHIVE_TYPE_TAR:
r = archive_read_open_filename (archive->libar, path, BUFFER_SIZE);
if (r != ARCHIVE_OK) {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Error opening archive: %s", archive_error_string (archive->libar));
return FALSE;
}
return TRUE;
}
return FALSE;
}
static gboolean
libarchive_read_next_header (EvArchive *archive,
GError **error)
{
while (1) {
int r;
r = archive_read_next_header (archive->libar, &archive->libar_entry);
if (r != ARCHIVE_OK) {
if (r != ARCHIVE_EOF)
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Error reading archive: %s", archive_error_string (archive->libar));
return FALSE;
}
if (archive_entry_filetype (archive->libar_entry) != AE_IFREG) {
g_debug ("Skipping '%s' as it's not a regular file",
archive_entry_pathname (archive->libar_entry));
continue;
}
g_debug ("At header for file '%s'", archive_entry_pathname (archive->libar_entry));
break;
}
return TRUE;
}
gboolean
ev_archive_read_next_header (EvArchive *archive,
GError **error)
{
g_return_val_if_fail (EV_IS_ARCHIVE (archive), FALSE);
g_return_val_if_fail (archive->type != EV_ARCHIVE_TYPE_NONE, FALSE);
switch (archive->type) {
case EV_ARCHIVE_TYPE_NONE:
g_assert_not_reached ();
case EV_ARCHIVE_TYPE_RAR:
return ar_parse_entry (archive->unarr);
case EV_ARCHIVE_TYPE_ZIP:
case EV_ARCHIVE_TYPE_7Z:
case EV_ARCHIVE_TYPE_TAR:
return libarchive_read_next_header (archive, error);
}
return FALSE;
}
const char *
ev_archive_get_entry_pathname (EvArchive *archive)
{
g_return_val_if_fail (EV_IS_ARCHIVE (archive), NULL);
g_return_val_if_fail (archive->type != EV_ARCHIVE_TYPE_NONE, NULL);
switch (archive->type) {
case EV_ARCHIVE_TYPE_NONE:
g_assert_not_reached ();
case EV_ARCHIVE_TYPE_RAR:
g_return_val_if_fail (archive->unarr != NULL, NULL);
return ar_entry_get_name (archive->unarr);
case EV_ARCHIVE_TYPE_ZIP:
case EV_ARCHIVE_TYPE_7Z:
case EV_ARCHIVE_TYPE_TAR:
g_return_val_if_fail (archive->libar_entry != NULL, NULL);
return archive_entry_pathname (archive->libar_entry);
}
return NULL;
}
gint64
ev_archive_get_entry_size (EvArchive *archive)
{
g_return_val_if_fail (EV_IS_ARCHIVE (archive), -1);
g_return_val_if_fail (archive->type != EV_ARCHIVE_TYPE_NONE, -1);
switch (archive->type) {
case EV_ARCHIVE_TYPE_RAR:
g_return_val_if_fail (archive->unarr != NULL, -1);
return ar_entry_get_size (archive->unarr);
case EV_ARCHIVE_TYPE_NONE:
g_assert_not_reached ();
case EV_ARCHIVE_TYPE_ZIP:
case EV_ARCHIVE_TYPE_7Z:
case EV_ARCHIVE_TYPE_TAR:
g_return_val_if_fail (archive->libar_entry != NULL, -1);
return archive_entry_size (archive->libar_entry);
}
return -1;
}
gboolean
ev_archive_get_entry_is_encrypted (EvArchive *archive)
{
g_return_val_if_fail (EV_IS_ARCHIVE (archive), FALSE);
g_return_val_if_fail (archive->type != EV_ARCHIVE_TYPE_NONE, FALSE);
switch (archive->type) {
case EV_ARCHIVE_TYPE_RAR:
g_return_val_if_fail (archive->unarr != NULL, FALSE);
/* password-protected RAR is not even detected right now */
return FALSE;
case EV_ARCHIVE_TYPE_NONE:
g_assert_not_reached ();
case EV_ARCHIVE_TYPE_ZIP:
case EV_ARCHIVE_TYPE_7Z:
case EV_ARCHIVE_TYPE_TAR:
g_return_val_if_fail (archive->libar_entry != NULL, -1);
return archive_entry_is_encrypted (archive->libar_entry);
}
return FALSE;
}
gssize
ev_archive_read_data (EvArchive *archive,
void *buf,
gsize count,
GError **error)
{
gssize r = -1;
g_return_val_if_fail (EV_IS_ARCHIVE (archive), -1);
g_return_val_if_fail (archive->type != EV_ARCHIVE_TYPE_NONE, -1);
switch (archive->type) {
case EV_ARCHIVE_TYPE_RAR:
g_return_val_if_fail (archive->unarr != NULL, -1);
if (!ar_entry_uncompress (archive->unarr, buf, count)) {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Failed to decompress RAR data");
return -1;
}
r = count;
break;
case EV_ARCHIVE_TYPE_NONE:
g_assert_not_reached ();
case EV_ARCHIVE_TYPE_ZIP:
case EV_ARCHIVE_TYPE_7Z:
case EV_ARCHIVE_TYPE_TAR:
g_return_val_if_fail (archive->libar_entry != NULL, -1);
r = archive_read_data (archive->libar, buf, count);
if (r < 0) {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Failed to decompress data: %s", archive_error_string (archive->libar));
}
break;
}
return r;
}
void
ev_archive_reset (EvArchive *archive)
{
g_return_if_fail (EV_IS_ARCHIVE (archive));
g_return_if_fail (archive->type != EV_ARCHIVE_TYPE_NONE);
switch (archive->type) {
case EV_ARCHIVE_TYPE_RAR:
g_clear_pointer (&archive->unarr, ar_close_archive);
g_clear_pointer (&archive->unarr_stream, ar_close);
break;
case EV_ARCHIVE_TYPE_ZIP:
case EV_ARCHIVE_TYPE_7Z:
case EV_ARCHIVE_TYPE_TAR:
g_clear_pointer (&archive->libar, archive_free);
libarchive_set_archive_type (archive, archive->type);
break;
default:
g_assert_not_reached ();
}
}
static void
ev_archive_init (EvArchive *archive)
{
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
/*
* Copyright (C) 2017, Bastien Nocera <hadess@hadess.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __EV_ARCHIVE_H__
#define __EV_ARCHIVE_H__
#include <glib-object.h>
G_BEGIN_DECLS
#define EV_TYPE_ARCHIVE ev_archive_get_type ()
G_DECLARE_FINAL_TYPE (EvArchive, ev_archive, EV, ARCHIVE, GObject)
typedef enum {
EV_ARCHIVE_TYPE_NONE = 0,
EV_ARCHIVE_TYPE_RAR,
EV_ARCHIVE_TYPE_ZIP,
EV_ARCHIVE_TYPE_7Z,
EV_ARCHIVE_TYPE_TAR
} EvArchiveType;
EvArchive *ev_archive_new (void);
gboolean ev_archive_set_archive_type (EvArchive *archive,
EvArchiveType archive_type);
EvArchiveType ev_archive_get_archive_type (EvArchive *archive);
gboolean ev_archive_open_filename (EvArchive *archive,
const char *path,
GError **error);
gboolean ev_archive_read_next_header (EvArchive *archive,
GError **error);
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);
gssize ev_archive_read_data (EvArchive *archive,
void *buf,
gsize count,
GError **error);
void ev_archive_reset (EvArchive *archive);
G_END_DECLS
#endif /* __EV_ARCHIVE_H__ */
<?xml version="1.0" encoding="UTF-8"?>
<component type="addon">
<id>evince-comicsdocument</id>
<extends>evince.desktop</extends>
<_name>Comic Books</_name>
<_summary>Adds support for reading comic books</_summary>
<extends>org.gnome.Evince</extends>
<name>Comic Books</name>
<summary>Adds support for reading comic books</summary>
<mimetypes>
@APPDATA_COMICS_MIME_TYPES@
</mimetypes>
<kudos>
<kudo>ModernToolkit</kudo>
</kudos>
<url type="homepage">https://wiki.gnome.org/Apps/Evince/SupportedDocumentFormats</url>
<metadata_license>GPL-2.0+</metadata_license>
<metadata_license>GPL-2.0+ or GFDL-1.3-only</metadata_license>
<project_license>GPL-2.0+</project_license>
<updatecontact>carlosgc@gnome.org</updatecontact>
<update_contact>evince-list@gnome.org</update_contact>
</component>
sources = files(
'comics-document.c',
'ev-archive.c',
)
incs = backends_incs + [cut_n_paste_inc]
deps = backends_deps + [
libarchive_dep,
libunarr_dep,
]
shared_module(
backend_name,
sources: sources,
include_directories: incs,
dependencies: deps,
c_args: backends_cflags,
link_args: backends_ldflags,
link_depends: backends_symbol_map,
install: true,
install_dir: ev_backendsdir,
)
test_name = 'test-ev-archive'
sources = files(
'ev-archive.c',
'test-ev-archive.c',
)
executable(
test_name,
sources,
include_directories: incs,
dependencies: deps,
)
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
/*
* Copyright (C) 2017, Bastien Nocera <hadess@hadess.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "ev-archive.h"
static void
usage (const char *prog)
{
g_print ("- Lists file in a supported archive format\n");
g_print ("Usage: %s archive-type filename\n", prog);
g_print ("Where archive-type is one of rar, zip, 7z or tar\n");
}
static EvArchiveType
str_to_archive_type (const char *str)
{
g_return_val_if_fail (str != NULL, EV_ARCHIVE_TYPE_NONE);
if (g_strcmp0 (str, "rar") == 0)
return EV_ARCHIVE_TYPE_RAR;
if (g_strcmp0 (str, "zip") == 0)
return EV_ARCHIVE_TYPE_ZIP;
if (g_strcmp0 (str, "7z") == 0)
return EV_ARCHIVE_TYPE_7Z;
if (g_strcmp0 (str, "tar") == 0)
return EV_ARCHIVE_TYPE_TAR;
g_warning ("Archive type '%s' not supported", str);
return EV_ARCHIVE_TYPE_NONE;
}
int
main (int argc, char **argv)
{
EvArchive *ar;
EvArchiveType ar_type;
GError *error = NULL;
gboolean printed_header = FALSE;
if (argc != 3) {
usage (argv[0]);
return 1;
}
ar_type = str_to_archive_type (argv[1]);
if (ar_type == EV_ARCHIVE_TYPE_NONE)
return 1;
ar = ev_archive_new ();
if (!ev_archive_set_archive_type (ar, ar_type)) {
g_warning ("Failed to set archive type");
goto out;
}
if (!ev_archive_open_filename (ar, argv[2], &error)) {
g_warning ("Failed to open '%s': %s",
argv[2], error->message);
g_error_free (error);
goto out;
}
while (1) {
const char *name;
gboolean is_encrypted;
gint64 size;
if (!ev_archive_read_next_header (ar, &error)) {
if (error != NULL) {
g_warning ("Fatal error handling archive: %s", error->message);
g_clear_error (&error);
goto out;
}
break;
}
name = ev_archive_get_entry_pathname (ar);
is_encrypted = ev_archive_get_entry_is_encrypted (ar);
size = ev_archive_get_entry_size (ar);
if (!printed_header) {
g_print ("P\tSIZE\tNAME\n");
printed_header = TRUE;
}
g_print ("%c\t%"G_GINT64_FORMAT"\t%s\n",
is_encrypted ? 'P' : ' ',
size, name);
}
ev_archive_reset (ar);
g_clear_object (&ar);
return 0;
out:
g_clear_object (&ar);
return 1;
}
......@@ -28,14 +28,18 @@ libdjvudocument_la_LIBADD = \
$(BACKEND_LIBS) \
$(DJVU_LIBS)
backend_in_files = djvudocument.evince-backend.in.in
backend_DATA = $(backend_in_files:.evince-backend.in.in=.evince-backend)
@EV_INTLTOOL_EVINCE_BACKEND_RULE@
backend_in_files = djvudocument.evince-backend.desktop.in.in
backend_DATA = $(backend_in_files:.evince-backend.desktop.in.in=.evince-backend)
appstreamdir = $(datadir)/appdata
djvudocument.evince-backend: djvudocument.evince-backend.desktop.in
$(AM_V_GEN)$(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@
appstreamdir = $(datadir)/metainfo
appstream_in_files = evince-djvudocument.metainfo.xml.in.in
appstream_DATA = $(appstream_in_files:.xml.in.in=.xml)
@INTLTOOL_XML_RULE@
evince-djvudocument.metainfo.xml: evince-djvudocument.metainfo.xml.in
$(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
EXTRA_DIST = $(backend_in_files) $(appstream_in_files)
......
......@@ -164,8 +164,12 @@ djvu_document_load (EvDocument *document,
filename = g_filename_from_uri (uri, NULL, error);
if (!filename)
return FALSE;
#ifdef __APPLE__
doc = ddjvu_document_create_by_filename_utf8 (djvu_document->d_context, filename, TRUE);
#else
doc = ddjvu_document_create_by_filename (djvu_document->d_context, filename, TRUE);
#endif
if (!doc) {
g_free (filename);
......
......@@ -63,20 +63,24 @@ djvu_text_page_selection_process_box (DjvuTextPage *page,
{
if (page->results || p == page->start) {
EvRectangle box;
const char *text;
box.x1 =