Merge remote-tracking branch 'upstream/develop' into feature/physical-size

This commit is contained in:
Jeremie Knuesel 2018-02-23 15:47:52 +01:00
commit f1ebe9e5d5
34 changed files with 398 additions and 862 deletions

6
.gitignore vendored
View file

@ -21,15 +21,9 @@ zathura-*.tar.gz
*.patch
# build dirs
.depend
.tx
build/
gcov/
doc/_build
# version file
version.h
.version-checks/
# development files
.clang_complete

279
Makefile
View file

@ -1,279 +0,0 @@
# See LICENSE file for license and copyright information
include config.mk
include colors.mk
include common.mk
# source files
OSOURCE = $(sort $(wildcard ${PROJECT}/*.c) \
${PROJECT}/resources.c)
SOURCE_FILTER =
ifneq (${WITH_SQLITE},0)
CPPFLAGS += -DWITH_SQLITE
else
SOURCE_FILTER += ${PROJECT}/database-sqlite.c
endif
ifneq ($(WITH_MAGIC),0)
CPPFLAGS += -DWITH_MAGIC
endif
ifneq ($(WITH_SYNCTEX),0)
CPPFLAGS += -DWITH_SYNCTEX
endif
ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),)
VALGRIND_ARGUMENTS += --suppressions=${VALGRIND_SUPPRESSION_FILE}
endif
ifeq (,$(findstring -DZATHURA_PLUGINDIR,${CPPFLAGS}))
CPPFLAGS += -DZATHURA_PLUGINDIR=\"${PLUGINDIR}\"
endif
ifeq (,$(findstring -DGETTEXT_PACKAGE,${CPPFLAGS}))
CPPFLAGS += -DGETTEXT_PACKAGE=\"${PROJECT}\"
endif
ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS}))
CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\"
endif
SOURCE = $(filter-out $(SOURCE_FILTER),$(OSOURCE))
OBJECTS = $(addprefix ${BUILDDIR_RELEASE}/,${SOURCE:.c=.o})
OBJECTS_DEBUG = $(addprefix ${BUILDDIR_DEBUG}/,${SOURCE:.c=.o})
OBJECTS_GCOV = $(addprefix ${BUILDDIR_GCOV}/,${SOURCE:.c=.o})
HEADERINST = $(addprefix ${PROJECT}/,version.h document.h macros.h page.h types.h plugin-api.h links.h)
all: options ${PROJECT} po build-manpages
# pkg-config based version checks
.version-checks/%: config.mk
$(QUIET)test $($(*)_VERSION_CHECK) -eq 0 || \
${PKG_CONFIG} --atleast-version $($(*)_MIN_VERSION) $($(*)_PKG_CONFIG_NAME) || ( \
echo "The minimum required version of $(*) is $($(*)_MIN_VERSION)" && \
false \
)
@mkdir -p .version-checks
$(QUIET)touch $@
options:
@echo ${PROJECT} build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LIBS = ${LIBS}"
@echo "DFLAGS = ${DFLAGS}"
@echo "CC = ${CC}"
# generated files
${PROJECT}/version.h: ${PROJECT}/version.h.in config.mk
$(QUIET)sed -e 's/ZVMAJOR/${ZATHURA_VERSION_MAJOR}/' \
-e 's/ZVMINOR/${ZATHURA_VERSION_MINOR}/' \
-e 's/ZVREV/${ZATHURA_VERSION_REV}/' \
-e 's/ZVAPI/${ZATHURA_API_VERSION}/' \
-e 's/ZVABI/${ZATHURA_ABI_VERSION}/' ${PROJECT}/version.h.in > ${PROJECT}/version.h.tmp
$(QUIET)mv ${PROJECT}/version.h.tmp ${PROJECT}/version.h
${PROJECT}/resources.%: data/zathura.gresource.xml config.mk
$(call colorecho,GEN,$@)
@mkdir -p ${DEPENDDIR}/$(dir $@)
$(QUIET)$(GLIB_COMPILE_RESOURCES) --generate --c-name=zathura_resources --internal \
--dependency-file=$(DEPENDDIR)/$@.dep \
--sourcedir=data --target=$@ data/zathura.gresource.xml
# common dependencies
${OBJECTS} ${OBJECTS_DEBUG} ${OBJECTS_GCOV}: config.mk \
.version-checks/GIRARA \
.version-checks/GLIB \
.version-checks/GTK \
${PROJECT}/version.h \
${PROJECT}/resources.h
# rlease build
${BUILDDIR_RELEASE}/%.o: %.c
$(call colorecho,CC,$<)
@mkdir -p ${DEPENDDIR}/$(dir $@)
@mkdir -p $(dir $(abspath $@))
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF ${DEPENDDIR}/$@.dep
${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}: ${OBJECTS}
$(call colorecho,CC,$@)
@mkdir -p ${BUILDDIR_RELEASE}/${BINDIR}
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} \
-o ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} ${OBJECTS} ${LIBS}
${PROJECT}: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
release: ${PROJECT}
run: release
$(QUIET)./${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
# debug build
${BUILDDIR_DEBUG}/%.o: %.c
$(call colorecho,CC,$<)
@mkdir -p ${DEPENDDIR}/$(dir $@)
@mkdir -p $(dir $(abspath $@))
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} \
-o $@ $< -MMD -MF ${DEPENDDIR}/$@.dep
${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}: ${OBJECTS_DEBUG}
$(call colorecho,CC,$@)
@mkdir -p ${BUILDDIR_DEBUG}/${BINDIR}
$(QUIET)${CC} ${LDFLAGS} \
-o ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT} ${OBJECTS_DEBUG} ${LIBS}
debug: ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
run-debug: debug
$(QUIET)./${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
# gcov build
${BUILDDIR_GCOV}/%.o: %.c
$(call colorecho,CC,$<)
@mkdir -p ${DEPENDDIR}/$(dir $@)
@mkdir -p $(dir $(abspath $@))
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${GCOV_CFLAGS} \
-o $@ $< -MMD -MF ${DEPENDDIR}/$@.dep
${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}: ${OBJECTS_GCOV}
$(call colorecho,CC,$@)
@mkdir -p ${BUILDDIR_GCOV}/${BINDIR}
$(QUIET)${CC} ${LDFLAGS} ${GCOV_CFLAGS} ${GCOV_LDFLAGS} \
-o ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT} ${OBJECTS_GCOV} ${LIBS}
gcov: options ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}
$(QUIET)${MAKE} -C tests run-gcov
$(call colorecho,LCOV,"Analyse data")
$(QUIET)${LCOV_EXEC} ${LCOV_FLAGS}
$(call colorecho,LCOV,"Generate report")
$(QUIET)${GENHTML_EXEC} ${GENHTML_FLAGS}
run-gcov: ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}
$(QUIET)./${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}
# clean
clean:
$(QUIET)rm -rf \
${BUILDDIR} \
${DEPENDDIR} \
${TARFILE} \
${TARDIR} \
${PROJECT}.pc \
${PROJECT}/version.h \
${PROJECT}/version.h.tmp \
${PROJECT}/resources.c \
${PROJECT}/resources.h \
$(PROJECT).info \
gcov \
.version-checks
$(QUIET)$(MAKE) -C tests clean
$(QUIET)$(MAKE) -C po clean
$(QUIET)$(MAKE) -C doc clean
${PROJECT}.pc: ${PROJECT}.pc.in config.mk
$(QUIET)echo project=${PROJECT} > ${PROJECT}.pc
$(QUIET)echo version=${VERSION} >> ${PROJECT}.pc
$(QUIET)echo apiversion=${ZATHURA_API_VERSION} >> ${PROJECT}.pc
$(QUIET)echo abiversion=${ZATHURA_ABI_VERSION} >> ${PROJECT}.pc
$(QUIET)echo includedir=${INCLUDEDIR} >> ${PROJECT}.pc
$(QUIET)echo plugindir=${PLUGINDIR} >> ${PROJECT}.pc
$(QUIET)echo GTK_VERSION=3 >> ${PROJECT}.pc
$(QUIET)cat ${PROJECT}.pc.in >> ${PROJECT}.pc
valgrind: debug
$(QUIET)G_SLICE=always-malloc G_DEBUG=gc-friendly ${VALGRIND} ${VALGRIND_ARGUMENTS} \
${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
gdb: debug
$(QUIET)cgdb ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
test: ${OBJECTS}
$(QUIET)$(MAKE) -C tests run
dist: clean build-manpages
$(QUIET)tar -czf $(TARFILE) --exclude=.gitignore \
--transform 's,^,zathura-$(VERSION)/,' \
`git ls-files` \
doc/_build/$(PROJECT).1 doc/_build/$(PROJECT)rc.5
doc:
$(QUIET)$(MAKE) -C doc
po:
$(QUIET)${MAKE} -C po
update-po:
$(QUIET)${MAKE} -C po update-po
build-manpages:
$(QUIET)${MAKE} -C doc man
install-manpages: build-manpages
$(call colorecho,INSTALL,"man pages")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${MANPREFIX}/man1 ${DESTDIR}${MANPREFIX}/man5
ifneq "$(wildcard doc/_build/${PROJECT}.1)" ""
$(QUIET)install -m 644 doc/_build/${PROJECT}.1 ${DESTDIR}${MANPREFIX}/man1
endif
ifneq "$(wildcard doc/_build/${PROJECT}rc.5)" ""
$(QUIET)install -m 644 doc/_build/${PROJECT}rc.5 ${DESTDIR}${MANPREFIX}/man5
endif
install-headers: ${PROJECT}.pc
$(call colorecho,INSTALL,"header files")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(QUIET)install -m 644 ${HEADERINST} ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(call colorecho,INSTALL,"pkgconfig file")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig
$(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
install-dbus:
$(call colorecho,INSTALL,"D-Bus interface definitions")
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(DBUSINTERFACEDIR)
$(QUIET)install -m 644 data/org.pwmt.zathura.xml $(DESTDIR)$(DBUSINTERFACEDIR)
install-appdata:
$(call colorecho,INSTALL,"AppData file")
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(APPDATAPREFIX)
$(QUIET)install -m 644 data/$(PROJECT).appdata.xml $(DESTDIR)$(APPDATAPREFIX)
install: all install-headers install-manpages install-dbus install-appdata
$(call colorecho,INSTALL,"executeable file")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${PREFIX}/bin
$(QUIET)install -m 755 ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} ${DESTDIR}${PREFIX}/bin
$(QUIET)mkdir -m 755 -p ${DESTDIR}${DESKTOPPREFIX}
$(call colorecho,INSTALL,"desktop file")
$(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX}
$(MAKE) -C po install
uninstall-headers:
$(call colorecho,UNINSTALL,"header files")
$(QUIET)rm -rf ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(call colorecho,UNINSTALL,"pkgconfig file")
$(QUIET)rm -f ${DESTDIR}${LIBDIR}/pkgconfig/${PROJECT}.pc
uninstall: uninstall-headers
$(ECHO) removing executable file
$(call colorecho,UNINSTALL,"executeable")
$(QUIET)rm -f ${DESTDIR}${PREFIX}/bin/${PROJECT}
$(call colorecho,UNINSTALL,"man pages")
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5
$(call colorecho,UNINSTALL,"desktop file")
$(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop
$(call colorecho,UNINSTALL,"D-Bus interface definitions")
$(QUIET)rm -f $(DESTDIR)$(DBUSINTERFACEDIR)/org.pwmt.zathura.xml
$(call colorecho,UNINSTALL,"AppData file")
$(QUIET)rm -f $(DESTDIR)$(APPDATAPREFIX)/$(PROJECT).appdata.xml
$(MAKE) -C po uninstall
DEPENDS = ${DEPENDDIRS:^=${DEPENDDIR}/}$(addprefix ${DEPENDDIR}/,${OBJECTS:.o=.o.dep})
-include ${DEPENDS}
.PHONY: all options clean doc debug valgrind gdb dist doc install uninstall \
test po install-headers uninstall-headers update-po install-manpages \
build-manpages install-dbus

35
README
View file

@ -1,15 +1,18 @@
zathura - a document viewer
===========================
zathura is a highly customizable and functional document viewer based on the
girara user interface library and several document libraries.
Requirements
------------
meson (>= 0.43)
gtk3 (>= 3.22)
glib (>= 2.50)
girara (>= 0.2.8)
sqlite3 (optional, >= 3.5.9)
check (for tests)
check (optional, for tests)
intltool
libmagic from file(1) (optional, for mime-type detection)
libsynctex from TeXLive (optional, for SyncTeX support)
@ -18,42 +21,28 @@ doxygen (optional, for HTML documentation)
breathe (optional, for HTML documentation)
sphinx_rtd_theme (optional, for HTML documentation)
Please note that you need to have a working pkg-config installation and that the
Makefile is only compatible with GNU make. If you don't have a working
pkg-config installation please set the GTK_INC, GTK_LIB, GIRARA_INC, GIRARA_LIB,
SQLITE_INC and SQLITE_LIB variables accordingly.
Also note that Sphinx is needed to build the manpages. If it is not
installed, the man pages won't be built. For the HTML documentation, doxygen,
breathe and sphinx_rtd_theme are needed in addition to Sphinx.
If you don't want to build with support for sqlite databases, you can set
WITH_SQLITE=0 and sqlite support won't be available.
enable-sqlite=off and sqlite support won't be available.
The use of magic to detect mime types is optional and can be disabled by setting
WITH_MAGIC=0.
If you pass these flags as a command line argument to make, you have to ensure
to pass the same flags when executing the install target.
If you want to build zathura's HTML documentation, please install all python
dependencies from the ./doc/requirements.txt file and run:
make doc
enable-magic=off.
Installation
------------
To build and install zathura:
make install
Uninstall
---------
To delete zathura from your system, just type:
make uninstall
meson build
cd build
ninja
ninja install
Bugs
----
Please report bugs at http://bugs.pwmt.org or contact us on our mailing list at
zathura@lists.pwmt.org.

View file

@ -1,31 +0,0 @@
# See LICENSE file for license and copyright information
ifeq ($(COLOR),1)
# GCC diagnostics colors
DIAGNOSTICS_COLOR_AVAILABLE ?= $(shell ($(CC) -fdiagnostics-color=always -E - </dev/null >/dev/null 2>/dev/null && echo 1) || echo 0)
ifeq ($(DIAGNOSTICS_COLOR_AVAILABLE),1)
CPPFLAGS += -fdiagnostics-color=always
endif
# colorful output
TPUT ?= /usr/bin/tput
TPUT_AVAILABLE ?= $(shell ${TPUT} -V 2>/dev/null)
ifdef TPUT_AVAILABLE
COLOR_NORMAL = `$(TPUT) sgr0`
COLOR_ACTION = `$(TPUT) bold``$(TPUT) setaf 3`
COLOR_COMMENT = `$(TPUT) bold``$(TPUT) setaf 2`
COLOR_BRACKET = `$(TPUT) setaf 4`
define colorecho
@echo $(COLOR_BRACKET)" ["$(COLOR_ACTION)$1$(COLOR_BRACKET)"] "$(COLOR_COMMENT)$2$(COLOR_BRACKET) $(COLOR_NORMAL)
endef
else
define colorecho
@echo " [$1]" $2
endef
endif
else
define colorecho
@echo " [$1]" $2
endef
endif

View file

@ -1,9 +0,0 @@
# See LICENSE file for license and copyright information
ifeq "$(VERBOSE)" "0"
ECHO=@echo
QUIET=@
else
ECHO=@\#
QUIET=
endif

173
config.mk
View file

@ -1,173 +0,0 @@
# See LICENSE file for license and copyright information
# zathura make config
# project
PROJECT = zathura
ZATHURA_VERSION_MAJOR = 0
ZATHURA_VERSION_MINOR = 3
ZATHURA_VERSION_REV = 8
# If the API changes, the API version and the ABI version have to be bumped.
ZATHURA_API_VERSION = 3
# If the ABI breaks for any reason, this has to be bumped.
ZATHURA_ABI_VERSION = 4
VERSION = ${ZATHURA_VERSION_MAJOR}.${ZATHURA_VERSION_MINOR}.${ZATHURA_VERSION_REV}
# version checks
# If you want to disable any of the checks, set *_VERSION_CHECK to 0.
# girara
GIRARA_VERSION_CHECK ?= 1
GIRARA_MIN_VERSION = 0.2.8
GIRARA_PKG_CONFIG_NAME = girara-gtk3
# glib
GLIB_VERSION_CHECK ?= 1
GLIB_MIN_VERSION = 2.50
GLIB_PKG_CONFIG_NAME = glib-2.0
# GTK
GTK_VERSION_CHECK ?= 1
GTK_MIN_VERSION = 3.22
GTK_PKG_CONFIG_NAME = gtk+-3.0
# pkg-config binary
PKG_CONFIG ?= pkg-config
# glib-compile-resources
GLIB_COMPILE_RESOURCES ?= glib-compile-resources
# database
# To disable support for the sqlite backend set WITH_SQLITE to 0.
WITH_SQLITE ?= $(shell (${PKG_CONFIG} --atleast-version=3.5.9 sqlite3 && echo 1) || echo 0)
# synctex
# To disable support for synctex with libsynctex set WITH_SYNCTEX to 0.
WITH_SYNCTEX ?= $(shell (${PKG_CONFIG} synctex && echo 1) || echo 0)
# mimetype detection
# To disable support for mimetype detction with libmagic set WITH_MAGIC to 0.
WITH_MAGIC ?= 1
# paths
PREFIX ?= /usr
MANPREFIX ?= ${PREFIX}/share/man
DESKTOPPREFIX ?= ${PREFIX}/share/applications
APPDATAPREFIX ?= ${PREFIX}/share/metainfo
LIBDIR ?= ${PREFIX}/lib
INCLUDEDIR ?= ${PREFIX}/include
DBUSINTERFACEDIR ?= ${PREFIX}/share/dbus-1/interfaces
VIMFTPLUGINDIR ?= ${PREFIX}/share/vim/addons/ftplugin
DEPENDDIR ?= .depend
BUILDDIR ?= build
BUILDDIR_RELEASE ?= ${BUILDDIR}/release
BUILDDIR_DEBUG ?= ${BUILDDIR}/debug
BUILDDIR_GCOV ?= ${BUILDDIR}/gcov
BINDIR ?= bin
# plugin directory
PLUGINDIR ?= ${LIBDIR}/zathura
# locale directory
LOCALEDIR ?= ${PREFIX}/share/locale
# libs
ifeq (${GTK_INC}-${GTK_LIB},-)
PKG_CONFIG_LIBS += gtk+-3.0
else
INCS += ${GTK_INC}
LIBS += ${GTK_LIB}
endif
ifeq (${GLIB_INC}-${GLIB_LIB},-)
PKG_CONFIG_LIBS += gthread-2.0 gmodule-no-export-2.0 glib-2.0
else
INCS += ${GLIB_INC}
LIBS += ${GLIB_LIB}
endif
ifeq (${GIRARA_INC}-${GIRARA_LIB},-)
PKG_CONFIG_LIBS += girara-gtk3
else
INCS += ${GIRARA_INC}
LIBS += ${GIRARA_LIB}
endif
ifneq (${WITH_SQLITE},0)
ifeq (${SQLITE_INC}-${SQLITE_LIB},-)
PKG_CONFIG_LIBS += sqlite3
else
INCS += ${SQLITE_INC}
LIBS += ${SQLITE_LIB}
endif
endif
ifneq (${WITH_MAGIC},0)
MAGIC_INC ?=
MAGIC_LIB ?= -lmagic
INCS += ${MAGIC_INC}
LIBS += ${MAGIC_LIB}
endif
ifneq ($(WITH_SYNCTEX),0)
ifeq (${SYNCTEX_INC}-${SYNCTEX_LIB},-)
PKG_CONFIG_LIBS += synctex
else
INCS += ${SYNCTEX_INC}
LIBS += ${SYNCTEX_LIB}
endif
endif
ifneq (${PKG_CONFIG_LIBS},)
INCS += $(shell ${PKG_CONFIG} --cflags ${PKG_CONFIG_LIBS})
LIBS += $(shell ${PKG_CONFIG} --libs ${PKG_CONFIG_LIBS})
endif
LIBS += -lpthread -lm
# pre-processor flags
CPPFLAGS += -D_FILE_OFFSET_BITS=64
# compiler flags
CFLAGS += -std=c11 -pedantic -Wall -Wno-format-zero-length -Wextra $(INCS)
# debug
DFLAGS ?= -g
# linker flags
LDFLAGS += -rdynamic
# compiler
CC ?= gcc
# strip
SFLAGS ?= -s
# msgfmt
MSGFMT ?= msgfmt
# gcov & lcov
GCOV_CFLAGS=-fprofile-arcs -ftest-coverage
GCOV_LDFLAGS=-fprofile-arcs
LCOV_OUTPUT=gcov
LCOV_EXEC=lcov
LCOV_FLAGS=--base-directory . --directory ${BUILDDIR_GCOV} --capture --rc \
lcov_branch_coverage=1 --output-file ${BUILDDIR_GCOV}/$(PROJECT).info
GENHTML_EXEC=genhtml
GENHTML_FLAGS=--rc lcov_branch_coverage=1 --output-directory ${LCOV_OUTPUT} ${BUILDDIR_GCOV}/$(PROJECT).info
# valgrind
VALGRIND = valgrind
VALGRIND_ARGUMENTS = --tool=memcheck --leak-check=yes --leak-resolution=high \
--show-reachable=yes --log-file=zathura-valgrind.log
VALGRIND_SUPPRESSION_FILE = zathura.suppression
# set to something != 0 if you want verbose build output
VERBOSE ?= 0
# gettext package name
GETTEXT_PACKAGE ?= ${PROJECT}
# colors
COLOR ?= 1
# dist
TARFILE = ${PROJECT}-${VERSION}.tar.gz
TARDIR = ${PROJECT}-${VERSION}

10
data/meson.build Normal file
View file

@ -0,0 +1,10 @@
gnome = import('gnome')
zathura_resources = gnome.compile_resources(
'resources',
'zathura.gresource.xml',
c_name: 'zathura_resources',
dependencies: files('zathura.css_t', 'org.pwmt.zathura.xml')
)
install_data('zathura.appdata.xml', install_dir: metainfodir)
install_data('org.pwmt.zathura.xml', install_dir: dbusinterfacesdir)

View file

@ -1,55 +0,0 @@
# See LICENSE file for license and copyright information
#
include ../config.mk
include ../common.mk
include ../colors.mk
include config.mk
MAN_SOURCES=$(wildcard man/*.rst) $(wildcard man/*.txt) man/conf.py
DOXYGEN_SOURCES=$(wildcard ../zathura/*.h) Doxyfile
HTML_SOURCES=$(wildcard *.rst api/*.rst configuration/*.rst installation/*.rst usage/*.rst) conf.py
SPHINX_OPTS+=-d $(SPHINX_BUILDDIR)/doctrees
all: man html
clean:
$(call colorecho,RM,doc/$(SPHINX_BUILDDIR))
$(QUIET)rm -rf $(SPHINX_BUILDDIR)/
$(SPHINX_BUILDDIR)/html/index.html: $(HTML_SOURCES) $(SPHINX_BUILDDIR)/doxygen/xml/index.xml
$(QUIET)mkdir -p $(SPHINX_BUILDDIR)/html
$(call colorecho,DOC,"Build HTML documentation")
$(QUIET)$(SPHINX_BIN) -b html $(SPHINX_OPTS) . $(SPHINX_BUILDDIR)/html
$(SPHINX_BUILDDIR)/zathura.1: $(MAN_SOURCES)
$(QUIET)mkdir -p $(SPHINX_BUILDDIR)
$(call colorecho,DOC,"Build man pages")
$(QUIET)$(SPHINX_BIN) -b man $(SPHINX_OPTS) man $(SPHINX_BUILDDIR)
$(SPHINX_BUILDDIR)/zathurarc.5: $(SPHINX_BUILDDIR)/zathura.1
@if test -f $@; then :; else \
rm -f $(SPHINX_BUILDDIR)/zathura.1; \
$(MAKE) $(SPHINX_BUILDDIR)/zathura.1; \
fi
$(SPHINX_BUILDDIR)/doxygen/xml/index.xml: $(DOXYGEN_SOURCES)
$(QUIET)mkdir -p $(SPHINX_BUILDDIR)/doxygen/xml
$(call colorecho,DOC,"Run doxygen")
$(QUIET)$(DOXYGEN_BIN) Doxyfile
ifeq ($(shell which $(SPHINX_BIN) >/dev/null 2>&1; echo $$?), 1)
man:
html:
else
man: $(SPHINX_BUILDDIR)/zathura.1 $(SPHINX_BUILDDIR)/zathurarc.5
# TODO: Make a better test for breathe and sphinx_rtd_theme
ifeq ($(shell which $(DOXYGEN_BIN) >/dev/null 2>&1 && $(PYTHON_BIN) -c "import breathe; import sphinx_rtd_theme" >/dev/null 2>&1; echo $$?), 0)
html: $(SPHINX_BUILDDIR)/html/index.html
else
html:
endif
endif
.PHONY: clean html man all

View file

@ -1,8 +0,0 @@
# See LICENSE file for license and copyright information
SPHINX_BIN ?= sphinx-build
SPHINX_BUILDDIR = _build
SPHINX_OPTS ?=
DOXYGEN_BIN ?= doxygen
# This needs to be the same python interpreter as used by sphinx-build
PYTHON_BIN ?= python

24
doc/meson.build Normal file
View file

@ -0,0 +1,24 @@
sphinx = find_program('sphinx-build')
custom_target('man pages',
command: [sphinx, '-b', 'man', join_paths(meson.current_source_dir(), 'man'), meson.current_build_dir()],
output: ['zathura.1', 'zathurarc.5'],
input: [
'man/conf.py',
'man/_bindings.txt',
'man/_commands.txt',
'man/_options.txt',
'man/_synopsis.txt',
'man/zathurarc.5.rst',
'man/_bugs.txt',
'man/_configuration.txt',
'man/_description.txt',
'man/_synctex.txt',
'man/zathura.1.rst'
],
build_by_default: true,
install: true,
install_dir: [
join_paths(get_option('mandir'), 'man1'),
join_paths(get_option('mandir'), 'man5')
]
)

190
meson.build Normal file
View file

@ -0,0 +1,190 @@
project('zathura', 'c',
version: '0.3.8',
meson_version: '>=0.43',
default_options: 'c_std=c11',
)
version = meson.project_version()
version_array = version.split('.')
# Rules for so_major and so_minor:
# Before a release perform the following checks against the last release:
# * If a function has been removed or the paramaters of a function have changed
# bump SOMAJOR and set SOMINOR to 0.
# * If any of the exported datastructures have changed in a incompatible way
# bump SOMAJOR and set SOMINOR to 0.
# * If a function has been added bump SOMINOR.
plugin_api_version = '3'
plugin_abi_version = '4'
conf_data = configuration_data()
conf_data.set('ZVMAJOR', version_array[0])
conf_data.set('ZVMINOR', version_array[1])
conf_data.set('ZVREV', version_array[2])
conf_data.set('ZVAPI', plugin_api_version)
conf_data.set('ZVABI', plugin_abi_version)
conf_data.set('version', version)
cc = meson.get_compiler('c', required: false)
prefix = get_option('prefix')
localedir = get_option('localedir')
datadir = get_option('datadir')
metainfodir = join_paths(datadir, 'metainfo')
desktopdir = join_paths(datadir, 'applications')
dbusinterfacesdir = join_paths(datadir, 'dbus-1', 'interfaces')
plugindir = join_paths(get_option('libdir'), 'zathura')
# required dependencies
libm = cc.find_library('libm')
girara = dependency('girara-gtk3', version: '>=0.2.8')
glib = dependency('glib-2.0', version: '>=2.50')
gthread = dependency('gthread-2.0', version: '>=2.50')
gmodule = dependency('gmodule-no-export-2.0', version: '>=2.50')
gtk3 = dependency('gtk+-3.0', version: '>=3.22')
build_dependencies = [libm, girara, glib, gthread, gmodule, gtk3]
# defines
defines = [
'-DGETTEXT_PACKAGE="zathura"',
'-DLOCALEDIR="@0@"'.format(join_paths(prefix, localedir)),
'-DZATHURA_PLUGINDIR="@0@"'.format(join_paths(prefix, plugindir)),
'-D_DEFAULT_SOURCE',
]
# compile flags
flags = [
'-Wall',
'-Wextra',
'-pedantic',
'-Werror=implicit-function-declaration'
]
flags = cc.get_supported_arguments(flags)
# linker flags
linker_flags = [
'-rdynamic'
]
linker_flags = cc.get_supported_arguments(linker_flags)
# optional dependencies
additional_sources = []
sqlite = dependency('sqlite3', version: '>=3.5.9', required: false)
synctex = dependency('synctex', required: false)
magic = cc.find_library('magic', required: false)
if get_option('enable-sqlite') and sqlite.found()
build_dependencies += sqlite
defines += '-DWITH_SQLITE'
additional_sources = files('zathura/database-sqlite.c')
endif
if get_option('enable-synctex') and synctex.found()
build_dependencies += synctex
defines += '-DWITH_SYNCTEX'
endif
if get_option('enable-magic') and magic.found()
build_dependencies += magic
defines += '-DWITH_MAGIC'
endif
# generate version header file
version_header = configure_file(
input: 'zathura/version.h.in',
output: 'zathura-version.h',
configuration: conf_data
)
include_directories = [
include_directories('.')
]
subdir('data')
subdir('po')
# source files
sources = files(
'zathura/adjustment.c',
'zathura/bookmarks.c',
'zathura/callbacks.c',
'zathura/checked-integer-arithmetic.c',
'zathura/commands.c',
'zathura/completion.c',
'zathura/config.c',
'zathura/content-type.c',
'zathura/database.c',
'zathura/database-plain.c',
'zathura/dbus-interface.c',
'zathura/document.c',
'zathura/file-monitor.c',
'zathura/file-monitor-glib.c',
'zathura/file-monitor-signal.c',
'zathura/jumplist.c',
'zathura/links.c',
'zathura/marks.c',
'zathura/page.c',
'zathura/page-widget.c',
'zathura/plugin.c',
'zathura/print.c',
'zathura/render.c',
'zathura/shortcuts.c',
'zathura/synctex.c',
'zathura/types.c',
'zathura/utils.c',
'zathura/zathura.c',
)
sources += zathura_resources
sources += additional_sources
# header fiels to install
headers = files(
'zathura/document.h',
'zathura/links.h',
'zathura/macros.h',
'zathura/page.h',
'zathura/plugin-api.h',
'zathura/types.h',
)
headers += version_header
# zathura helper library
libzathura = static_library('zathura',
sources,
dependencies: build_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
# zathura executable
zathura = executable(
'zathura',
files('zathura/main.c'),
dependencies: build_dependencies + [declare_dependency(link_with: libzathura)],
install: true,
include_directories: include_directories,
c_args: defines + flags,
link_args: linker_flags, # replace with export_dynamic: true once we have meson >= 0.45
gui_app: true
)
install_headers(headers, subdir: 'zathura')
# pkg-config file
pkg = import('pkgconfig')
pkg.generate(
name: 'zathura',
description: 'document viewer - plugin API',
url: 'https://pwmt.org/projects/zathura',
version: version,
requires_private: ['girara-gtk3', 'cairo'],
variables: [
'apiversion=@0@'.format(plugin_api_version),
'abiversion=@0@'.format(plugin_abi_version),
'plugindir=${libdir}/zathura'
]
)
install_data('zathura.desktop', install_dir: desktopdir)
subdir('doc')
subdir('tests')

15
meson_options.txt Normal file
View file

@ -0,0 +1,15 @@
option('enable-sqlite',
type: 'boolean',
value: true,
description: 'Enable sqlite support if available.'
)
option('enable-synctex',
type: 'boolean',
value: true,
description: 'Enable synctex support if available.'
)
option('enable-magic',
type: 'boolean',
value: true,
description: 'Enable magic support if available.'
)

21
po/LINGUAS Normal file
View file

@ -0,0 +1,21 @@
ca
cs
de
el
eo
es_CL
es
et
fr
he
hr
id_ID
it
lt
no
pl
pt_BR
ru
ta_IN
tr
uk_UA

View file

@ -1,58 +0,0 @@
# See LICENSE file for license and copyright information
include ../config.mk
include ../common.mk
include ../colors.mk
PROJECT = zathura
CATALOGS = $(sort $(wildcard *.po))
LINGUAS ?= $(patsubst %.po, %, $(CATALOGS))
ifeq ($(LINGUAS),)
ALINGUAS =
else
ALINGUAS = $(shell find $(patsubst %, %.po, $(LINGUAS)) 2>/dev/null)
endif
MOS = $(patsubst %, %/LC_MESSAGES/${GETTEXT_PACKAGE}.mo, $(patsubst %.po, %, $(ALINGUAS)))
all: ${MOS}
clean:
$(QUIET)rm -rf POTFILES.in POTFILES.in.tmp $(patsubst %.po, %, $(CATALOGS)) ${PROJECT}.pot
POTFILES.in: $(sort $(wildcard ../zathura/*.c))
$(QUIET) set -e && rm -f $@.tmp && touch $@.tmp && \
for f in $(^F) ; do \
echo zathura/$$f >> $@.tmp ; \
done && \
mv $@.tmp $@
${GETTEXT_PACKAGE}.pot: POTFILES.in
$(ECHO) regenerate $@
$(QUIET)intltool-update --pot --gettext-package=${GETTEXT_PACKAGE}
update-po: ${GETTEXT_PACKAGE}.pot
$(call colorecho,PO,"Updating po files ${CATALOGS}")
$(QUIET)set -e && for f in ${CATALOGS} ; do \
intltool-update --dist --gettext-package=${GETTEXT_PACKAGE} `echo $$f | sed 's/\.po//'` ; \
sed -i 's/Report-Msgid-Bugs-To: \\n/Report-Msgid-Bugs-To: http:\/\/bugs.pwmt.org\\n/' "$$f" ; \
done
%/LC_MESSAGES/${GETTEXT_PACKAGE}.mo: %.po
@mkdir -p $(@D)
$(call colorecho,MSGFMT,$(shell echo $< | sed 's/\.po//'))
$(QUIET)${MSGFMT} ${MSGFMTFLAGS} -c $< -o $@
install: ${MOS}
$(call colorecho,INSTALL,"Install translations")
$(QUIET)set -e && for f in $^ ; do \
mkdir -p -m 755 $(DESTDIR)$(LOCALEDIR)/`dirname $$f`; \
install -m 644 $$f $(DESTDIR)$(LOCALEDIR)/`dirname $$f` ; \
done
uninstall: ${MOS}
$(call colorecho,UNINSTALL,"Uninstall translations")
$(QUIET)set -e && for f in $^ ; do \
rm -f $(LOCALEDIR)/$$f; \
done
.PHONY: all clean install uninstall update-po

30
po/POTFILES Normal file
View file

@ -0,0 +1,30 @@
zathura/adjustment.c
zathura/bookmarks.c
zathura/callbacks.c
zathura/checked-integer-arithmetic.c
zathura/commands.c
zathura/completion.c
zathura/config.c
zathura/content-type.c
zathura/database-plain.c
zathura/database-sqlite.c
zathura/database.c
zathura/dbus-interface.c
zathura/document.c
zathura/file-monitor-glib.c
zathura/file-monitor-signal.c
zathura/file-monitor.c
zathura/jumplist.c
zathura/links.c
zathura/main.c
zathura/marks.c
zathura/page-widget.c
zathura/page.c
zathura/plugin.c
zathura/print.c
zathura/render.c
zathura/shortcuts.c
zathura/synctex.c
zathura/types.c
zathura/utils.c
zathura/zathura.c

4
po/meson.build Normal file
View file

@ -0,0 +1,4 @@
i18n = import('i18n')
i18n.gettext('zathura',
preset: 'glib'
)

View file

@ -1,132 +0,0 @@
# See LICENSE file for license and copyright information
include ../config.mk
include ../colors.mk
include ../common.mk
include config.mk
PROJECT = tests
SOURCE = tests.c $(wildcard test_*.c)
OBJECTS = $(addprefix ${BUILDDIR_RELEASE}/,${SOURCE:.c=.o})
OBJECTS_DEBUG = $(addprefix ${BUILDDIR_DEBUG}/,${SOURCE:.c=.o})
OBJECTS_GCOV = $(addprefix ${BUILDDIR_GCOV}/,${SOURCE:.c=.o})
FILTER = %/main.o
ifneq (${WITH_SQLITE},0)
CPPFLAGS += -DWITH_SQLITE
else
FILTER += %/database-sqlite.o
endif
ifneq ($(WITH_MAGIC),0)
CPPFLAGS += -DWITH_MAGIC
endif
ifneq ($(WITH_SYNCTEX),0)
CPPFLAGS += -DWITH_SYNCTEX
endif
ZATHURA_OBJECTS = \
$(filter-out $(FILTER), $(wildcard ../${BUILDDIR_RELEASE}/zathura/*.o))
ZATHURA_OBJECTS_DEBUG = \
$(filter-out $(FILTER), $(wildcard ../${BUILDDIR_DEBUG}/zathura/*.o))
ZATHURA_OBJECTS_GCOV= \
$(filter-out $(FILTER), $(wildcard ../${BUILDDIR_GCOV}/zathura/*.o))
ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),)
VALGRIND_ARGUMENTS += --suppressions=${VALGRIND_SUPPRESSION_FILE}
endif
all: release
# release
${OBJECTS}: config.mk ../config.mk ../zathura/version.h
${BUILDDIR_RELEASE}/%.o: %.c
$(call colorecho,CC,$<)
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p $(dir $(abspath $@))
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} \
-o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep
${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}: ${OBJECTS}
$(QUIET)${MAKE} WITH_LIBFIU=1 -C .. ${BUILDDIR_RELEASE}/${BINDIR}/zathura
$(call colorecho,CC,$@)
@mkdir -p ${BUILDDIR_RELEASE}/${BINDIR}
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} \
-o ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} \
${OBJECTS} ${ZATHURA_OBJECTS} ${LIBS}
release: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
run: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
$(QUIET)${FIU_EXEC} ./${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
# debug
${OBJECTS_DEBUG}: config.mk ../config.mk ../zathura/version.h
${BUILDDIR_DEBUG}/%.o: %.c
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p $(dir $(abspath $@))
$(call colorecho,CC,$<)
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} \
-o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep
${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}: ${OBJECTS_DEBUG}
$(QUIET)${MAKE} WITH_LIBFIU=1 -C .. ${BUILDDIR_DEBUG}/${BINDIR}/zathura
$(call colorecho,CC,$@)
@mkdir -p ${BUILDDIR_DEBUG}/${BINDIR}
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} \
-o ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT} \
${OBJECTS} ${ZATHURA_OBJECTS_DEBUG} ${LIBS}
debug: ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
run-debug: ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
$(QUIET)${FIU_EXEC} ./${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
# gcov
${OBJECTS_GCOV}: config.mk ../config.mk ../zathura/version.h
${BUILDDIR_GCOV}/%.o: %.c
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p $(dir $(abspath $@))
$(call colorecho,CC,$<)
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${GCOV_CFLAGS} ${DFLAGS} ${GCOV_DFLAGS} \
-o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep
${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}: ${OBJECTS_GCOV}
$(QUIET)${MAKE} WITH_LIBFIU=1 -C .. ${BUILDDIR_GCOV}/${BINDIR}/zathura
$(call colorecho,CC,$@)
@mkdir -p ${BUILDDIR_GCOV}/${BINDIR}
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} ${GCOV_CFLAGS} ${GCOV_LDFLAGS} \
-o ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT} \
${OBJECTS} ${ZATHURA_OBJECTS_GCOV} ${LIBS}
gcov: ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}
run-gcov: gcov
$(QUIET)${FIU_EXEC} ./${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}
../zathura/version.h:
$(MAKE) -C .. zathura/version.h
valgrind: ${PROJECT}-debug
$(QUIET)G_SLICE=always-malloc G_DEBUG=gc-friendly ${FIU_EXEC} ${VALGRIND} ${VALGRIND_ARGUMENTS} ./${PROJECT}-debug
clean:
$(call colorecho,RM, "Clean test files")
$(QUIET)rm -rf ${PROJECT}
$(QUIET)rm -rf ${PROJECT}-debug
$(QUIET)rm -rf ${PROJECT}-gcov
$(QUIET)rm -rf ${BUILDDIR}
$(QUIET)rm -rf ${DEPENDDIR}
.PHONY: all clean debug run
-include $(wildcard ${DEPENDDIR}/*.dep)

View file

@ -1,17 +0,0 @@
# See LICENSE file for license and copyright information
CHECK_INC ?= $(shell pkg-config --cflags check)
CHECK_LIB ?= $(shell pkg-config --libs check)
INCS += ${CHECK_INC} ${FIU_INC} -I../zathura
LIBS += ${CHECK_LIB} ${FIU_LIB}
ZATHURA_RELEASE=../${BUILDDIR_RELEASE}/${BINDIR}/zathura
ZATHURA_DEBUG=../${BUILDDIR_DEBUG}/${BINDIR}/zathura
ZATHURA_GCOV=../${BUILDDIR_GCOV}/${BINDIR}/zathura
# valgrind
VALGRIND = valgrind
VALGRIND_ARGUMENTS = --tool=memcheck --leak-check=yes --leak-resolution=high \
--show-reachable=yes --log-file=zathura-valgrind.log
VALGRIND_SUPPRESSION_FILE = zathura.suppression

24
tests/meson.build Normal file
View file

@ -0,0 +1,24 @@
check = dependency('check', required: false)
if check.found()
test_dependencies = [
declare_dependency(link_with: libzathura),
check
]
include_directories += [ include_directories('../zathura') ]
test_sources = [
'tests.c',
'test_document.c',
'test_session.c',
'test_utils.c'
]
tests = executable('tests', test_sources,
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
test('tests', tests)
endif

View file

@ -1,9 +0,0 @@
INC_PATH=-I${includedir}
Name: ${project}
Description: document viewer
Version: ${version}
URL: http://pwmt.org/projects/zathura
Cflags: ${INC_PATH}
Requires.private: girara-gtk${GTK_VERSION} cairo

View file

@ -288,12 +288,7 @@ cmd_print(girara_session_t* session, girara_list_t* UNUSED(argument_list))
bool
cmd_nohlsearch(girara_session_t* session, girara_list_t* UNUSED(argument_list))
{
g_return_val_if_fail(session != NULL, false);
g_return_val_if_fail(session->global.data != NULL, false);
zathura_t* zathura = session->global.data;
document_draw_search_results(zathura, false);
render_all(zathura);
sc_nohlsearch(session, NULL, NULL, 0);
return true;
}

View file

@ -476,6 +476,7 @@ config_load_default(zathura_t* zathura)
girara_shortcut_mapping_add(gsession, "mark_evaluate", sc_mark_evaluate);
girara_shortcut_mapping_add(gsession, "navigate", sc_navigate);
girara_shortcut_mapping_add(gsession, "navigate_index", sc_navigate_index);
girara_shortcut_mapping_add(gsession, "nohlsearch", sc_nohlsearch);
girara_shortcut_mapping_add(gsession, "print", sc_print);
girara_shortcut_mapping_add(gsession, "quit", sc_quit);
girara_shortcut_mapping_add(gsession, "recolor", sc_recolor);

View file

@ -1,8 +1,5 @@
/* See LICENSE file for license and copyright information */
#define _DEFAULT_SOURCE
#define _XOPEN_SOURCE 700
#include "content-type.h"
#include "macros.h"
@ -115,7 +112,7 @@ guess_type_file(const char* UNUSED(path))
return NULL;
}
#else
static const char*
static char*
guess_type_magic(zathura_content_type_context_t* UNUSED(context),
const char* UNUSED(path))
{

View file

@ -414,7 +414,6 @@ sqlite_add_bookmark(zathura_database_t* db, const char* file,
sqlite3_bind_int(stmt, 3, bookmark->page) != SQLITE_OK ||
sqlite3_bind_double(stmt, 4, bookmark->x) != SQLITE_OK ||
sqlite3_bind_double(stmt, 5, bookmark->y) != SQLITE_OK) {
sqlite3_finalize(stmt);
girara_error("Failed to bind arguments.");
return false;
@ -542,14 +541,9 @@ sqlite_save_jumplist(zathura_database_t* db, const char* file, girara_list_t* ju
return true;
}
girara_list_iterator_t* cur = girara_list_iterator(jumplist);
bool status = true;
while (true) {
zathura_jump_t* jump = girara_list_iterator_data(cur);
GIRARA_LIST_FOREACH_BODY(jumplist, zathura_jump_t*, jump,
stmt = prepare_statement(priv->session, SQL_INSERT_JUMP);
if (stmt == NULL) {
status = false;
break;
@ -559,7 +553,6 @@ sqlite_save_jumplist(zathura_database_t* db, const char* file, girara_list_t* ju
sqlite3_bind_int(stmt, 2, jump->page) != SQLITE_OK ||
sqlite3_bind_double(stmt, 3, jump->x) != SQLITE_OK ||
sqlite3_bind_double(stmt, 4, jump->y) != SQLITE_OK) {
sqlite3_finalize(stmt);
girara_error("Failed to bind arguments.");
status = false;
@ -573,15 +566,7 @@ sqlite_save_jumplist(zathura_database_t* db, const char* file, girara_list_t* ju
status = false;
break;
}
if (girara_list_iterator_has_next(cur) == true) {
girara_list_iterator_next(cur);
} else {
break;
}
}
girara_list_iterator_free(cur);
);
if (status == false) {
sqlite3_exec(priv->session, "ROLLBACK;", NULL, 0, NULL);

View file

@ -146,7 +146,7 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* uri,
file = NULL;
/* open document */
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
if (functions->document_open == NULL) {
girara_error("plugin has no open function\n");
goto error_free;
@ -223,7 +223,7 @@ zathura_document_free(zathura_document_t* document)
/* free document */
zathura_error_t error = ZATHURA_ERROR_OK;
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
if (functions->document_free == NULL) {
error = ZATHURA_ERROR_NOT_IMPLEMENTED;
} else {
@ -656,7 +656,7 @@ zathura_document_save_as(zathura_document_t* document, const char* path)
return ZATHURA_ERROR_UNKNOWN;
}
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
if (functions->document_save_as == NULL) {
return ZATHURA_ERROR_NOT_IMPLEMENTED;
}
@ -672,7 +672,7 @@ zathura_document_index_generate(zathura_document_t* document, zathura_error_t* e
return NULL;
}
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
if (functions->document_index_generate == NULL) {
check_set_error(error, ZATHURA_ERROR_NOT_IMPLEMENTED);
return NULL;
@ -689,7 +689,7 @@ zathura_document_attachments_get(zathura_document_t* document, zathura_error_t*
return NULL;
}
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
if (functions->document_attachments_get == NULL) {
check_set_error(error, ZATHURA_ERROR_NOT_IMPLEMENTED);
return NULL;
@ -705,7 +705,7 @@ zathura_document_attachment_save(zathura_document_t* document, const char* attac
return ZATHURA_ERROR_INVALID_ARGUMENTS;
}
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
if (functions->document_attachment_save == NULL) {
return ZATHURA_ERROR_NOT_IMPLEMENTED;
}
@ -721,7 +721,7 @@ zathura_document_get_information(zathura_document_t* document, zathura_error_t*
return NULL;
}
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
if (functions->document_get_information == NULL) {
check_set_error(error, ZATHURA_ERROR_NOT_IMPLEMENTED);
return NULL;

View file

@ -45,7 +45,7 @@ zathura_page_new(zathura_document_t* document, unsigned int index, zathura_error
/* init plugin */
zathura_plugin_t* plugin = zathura_document_get_plugin(document);
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
if (functions->page_init == NULL) {
if (error != NULL) {
@ -88,7 +88,7 @@ zathura_page_free(zathura_page_t* page)
}
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
if (functions->page_clear == NULL) {
return ZATHURA_ERROR_NOT_IMPLEMENTED;
}
@ -211,7 +211,7 @@ zathura_page_search_text(zathura_page_t* page, const char* text, zathura_error_t
}
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
if (functions->page_search_text == NULL) {
if (error != NULL) {
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
@ -233,7 +233,7 @@ zathura_page_links_get(zathura_page_t* page, zathura_error_t* error)
}
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
if (functions->page_links_get == NULL) {
if (error != NULL) {
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
@ -261,7 +261,7 @@ zathura_page_form_fields_get(zathura_page_t* page, zathura_error_t* error)
}
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
if (functions->page_form_fields_get == NULL) {
if (error != NULL) {
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
@ -289,7 +289,7 @@ zathura_page_images_get(zathura_page_t* page, zathura_error_t* error)
}
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
if (functions->page_images_get == NULL) {
if (error != NULL) {
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
@ -311,7 +311,7 @@ zathura_page_image_get_cairo(zathura_page_t* page, zathura_image_t* image, zathu
}
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
if (functions->page_image_get_cairo == NULL) {
if (error != NULL) {
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
@ -333,7 +333,7 @@ zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, zathu
}
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
if (functions->page_get_text == NULL) {
if (error) {
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
@ -352,7 +352,7 @@ zathura_page_render(zathura_page_t* page, cairo_t* cairo, bool printing)
}
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
if (functions->page_render_cairo == NULL) {
return ZATHURA_ERROR_NOT_IMPLEMENTED;
}
@ -371,7 +371,7 @@ zathura_page_get_label(zathura_page_t* page, zathura_error_t* error)
}
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
if (functions->page_get_label == NULL) {
if (error) {
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;

View file

@ -6,7 +6,7 @@
#include "page.h"
#include "document.h"
#include "links.h"
#include "version.h"
#include "zathura-version.h"
typedef struct zathura_plugin_functions_s zathura_plugin_functions_t;

View file

@ -281,13 +281,18 @@ plugin_mapping_new(zathura_plugin_manager_t* plugin_manager, const gchar* type,
g_return_val_if_fail(type != NULL, false);
g_return_val_if_fail(plugin != NULL, false);
GIRARA_LIST_FOREACH_BODY_WITH_ITER(plugin_manager->type_plugin_mapping, zathura_type_plugin_mapping_t*, iter, mapping,
bool already_registered = false;
GIRARA_LIST_FOREACH_BODY(plugin_manager->type_plugin_mapping, zathura_type_plugin_mapping_t*, mapping,
if (g_content_type_equals(type, mapping->type)) {
girara_list_iterator_free(iter);
return false;
already_registered = true;
break;
}
);
if (already_registered == true) {
return false;
}
zathura_type_plugin_mapping_t* mapping = g_try_malloc0(sizeof(zathura_type_plugin_mapping_t));
if (mapping == NULL) {
return false;
@ -343,11 +348,11 @@ plugin_add_mimetype(zathura_plugin_t* plugin, const char* mime_type)
}
}
zathura_plugin_functions_t*
const zathura_plugin_functions_t*
zathura_plugin_get_functions(zathura_plugin_t* plugin)
{
if (plugin != NULL) {
return &(plugin->functions);
return &plugin->functions;
} else {
return NULL;
}

View file

@ -8,7 +8,7 @@
#include "types.h"
#include "plugin-api.h"
#include "version.h"
#include "zathura-version.h"
#include "zathura.h"
/**
@ -63,7 +63,7 @@ girara_list_t* zathura_plugin_manager_get_plugins(zathura_plugin_manager_t* plug
* @param plugin The plugin
* @return The plugin functions
*/
zathura_plugin_functions_t* zathura_plugin_get_functions(zathura_plugin_t* plugin);
const zathura_plugin_functions_t* zathura_plugin_get_functions(zathura_plugin_t* plugin);
/**
* Returns the name of the plugin

View file

@ -1458,3 +1458,16 @@ sc_exec(girara_session_t* session, girara_argument_t* argument, girara_event_t*
return girara_sc_exec(session, argument, event, t);
}
bool
sc_nohlsearch(girara_session_t* session, girara_argument_t* UNUSED(argument), girara_event_t* UNUSED(event), unsigned int UNUSED(t))
{
g_return_val_if_fail(session != NULL, false);
g_return_val_if_fail(session->global.data != NULL, false);
zathura_t* zathura = session->global.data;
document_draw_search_results(zathura, false);
render_all(zathura);
return false;
}

View file

@ -292,4 +292,16 @@ bool sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_even
*/
bool sc_exec(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t);
/**
* Remove search highlights.
*
* @param session The used girara session
* @param argument The used argument
* @param event Girara event
* @param t Number of executions
* @return true if no error occurred otherwise false
*/
bool sc_nohlsearch(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t);
#endif // SHORTCUTS_H

View file

@ -194,7 +194,8 @@ zathura_get_version_string(zathura_t* zathura, bool markup)
GString* string = g_string_new(NULL);
/* zathura version */
g_string_append_printf(string, "zathura %d.%d.%d", ZATHURA_VERSION_MAJOR, ZATHURA_VERSION_MINOR, ZATHURA_VERSION_REV);
g_string_append(string, "zathura " ZATHURA_VERSION);
g_string_append_printf(string, "\ngirara " GIRARA_VERSION " (runtime: %s)", girara_version());
const char* format = (markup == true) ? "\n<i>(plugin)</i> %s (%d.%d.%d) <i>(%s)</i>" : "\n(plugin) %s (%d.%d.%d) (%s)";

View file

@ -3,11 +3,11 @@
#ifndef ZATHURA_VERSION_H
#define ZATHURA_VERSION_H
#define ZATHURA_VERSION_MAJOR ZVMAJOR
#define ZATHURA_VERSION_MINOR ZVMINOR
#define ZATHURA_VERSION_REV ZVREV
#define ZATHURA_VERSION "ZVMAJOR.ZVMINOR.ZVREV"
#define ZATHURA_API_VERSION ZVAPI
#define ZATHURA_ABI_VERSION ZVABI
#define ZATHURA_VERSION_MAJOR @ZVMAJOR@
#define ZATHURA_VERSION_MINOR @ZVMINOR@
#define ZATHURA_VERSION_REV @ZVREV@
#define ZATHURA_VERSION "@version@"
#define ZATHURA_API_VERSION @ZVAPI@
#define ZATHURA_ABI_VERSION @ZVABI@
#endif

View file

@ -1,8 +1,5 @@
/* See LICENSE file for license and copyright information */
#define _DEFAULT_SOURCE
#define _XOPEN_SOURCE 700
#include <errno.h>
#include <stdlib.h>
#include <math.h>