Commit aa386c85 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Imported Upstream version 0.1.2

parent 161f0f1d
This diff is collapsed.
callbacks.o: callbacks.c /usr/include/glib-2.0/glib/gi18n.h callbacks.h \
document.h zathura.h macros.h version.h render.h utils.h shortcuts.h \
page-widget.h
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
page-widget.o: page-widget.c /usr/include/glib-2.0/glib/gi18n.h \
page-widget.h document.h zathura.h macros.h version.h render.h \
callbacks.h utils.h shortcuts.h
This diff is collapsed.
render.o: render.c render.h zathura.h macros.h callbacks.h document.h \
version.h page-widget.h utils.h
shortcuts.o: shortcuts.c /usr/include/glib-2.0/glib/gi18n.h callbacks.h \
document.h zathura.h macros.h version.h shortcuts.h render.h utils.h \
page-widget.h
This diff is collapsed.
zathura.o: zathura.c /usr/include/glib-2.0/glib/gstdio.h \
/usr/include/glib-2.0/glib/gprintf.h /usr/include/glib-2.0/glib/gi18n.h \
bookmarks.h zathura.h macros.h callbacks.h document.h version.h config.h \
database-sqlite.h database.h database-plain.h shortcuts.h utils.h \
render.h page-widget.h
......@@ -5,8 +5,11 @@ Sebastian Ramacher <s.ramacher@gmx.at>
Other contributors are (in alphabetical order):
Aepelzen <abietz@gmx.de>
Pavel Borzenkov <pavel.borzenkov@gmail.com>
Géraud Le Falher <daureg@gmail.com>
Ivan Sichmann Freitas <ivansichfreitas@gmail.com>
Felix Herrmann <felix@herrmann-koenigsberg.de>
int3 <jezreel@gmail.com>
karottenreibe <k@rottenrei.be>
Johannes Meng <j@jmeng.de>
......@@ -3,9 +3,10 @@
include config.mk
include common.mk
PROJECT = zathura
OSOURCE = $(wildcard *.c)
HEADER = $(wildcard *.h)
PROJECT = zathura
OSOURCE = $(wildcard *.c)
HEADER = $(wildcard *.h)
HEADERINST = version.h zathura.h document.h macros.h
ifneq (${WITH_SQLITE},0)
INCS += $(SQLITE_INC)
......@@ -23,7 +24,13 @@ endif
OBJECTS = $(patsubst %.c, %.o, $(SOURCE))
DOBJECTS = $(patsubst %.c, %.do, $(SOURCE))
all: options ${PROJECT}
all: options ${PROJECT} po build-manpages
girara-version-check:
ifneq ($(GIRARA_VERSION_CHECK), 0)
$(error "The minimum required version of girara is ${GIRARA_MIN_VERSION}")
endif
$(QUIET)touch girara-version-check
options:
@echo ${PROJECT} build options:
......@@ -36,7 +43,8 @@ version.h: version.h.in config.mk
$(QUIET)sed 's/ZVMAJOR/${ZATHURA_VERSION_MAJOR}/' < version.h.in | \
sed 's/ZVMINOR/${ZATHURA_VERSION_MINOR}/' | \
sed 's/ZVREV/${ZATHURA_VERSION_REV}/' | \
sed 's/ZVAPI/${ZATHURA_API_VERSION}/' > version.h
sed 's/ZVAPI/${ZATHURA_API_VERSION}/' | \
sed 's/ZVABI/${ZATHURA_ABI_VERSION}/' > version.h
%.o: %.c
$(ECHO) CC $<
......@@ -48,8 +56,8 @@ version.h: version.h.in config.mk
@mkdir -p .depend
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
${OBJECTS}: config.mk version.h
${DOBJECTS}: config.mk version.h
${OBJECTS}: config.mk version.h girara-version-check
${DOBJECTS}: config.mk version.h girara-version-check
${PROJECT}: ${OBJECTS}
$(ECHO) CC -o $@
......@@ -58,7 +66,8 @@ ${PROJECT}: ${OBJECTS}
clean:
$(QUIET)rm -rf ${PROJECT} ${OBJECTS} ${PROJECT}-${VERSION}.tar.gz \
${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc doc version.h \
*gcda *gcno $(PROJECT).info gcov
*gcda *gcno $(PROJECT).info gcov *.tmp \
girara-version-check
$(QUIET)make -C tests clean
$(QUIET)make -C po clean
......@@ -71,7 +80,8 @@ debug: ${PROJECT}-debug
${PROJECT}.pc: ${PROJECT}.pc.in config.mk
$(QUIET)echo project=${PROJECT} > ${PROJECT}.pc
$(QUIET)echo version=${VERSION} >> ${PROJECT}.pc
$(QUIET)echo apiversion=${ZATHHRA_API_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=${ZATHURA_GTK_VERSION} >> ${PROJECT}.pc
......@@ -87,13 +97,14 @@ gdb: debug
test: ${OBJECTS}
$(QUIET)make -C tests run
dist: clean
dist: clean build-manpages
$(QUIET)mkdir -p ${PROJECT}-${VERSION}
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/tests
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/po
$(QUIET)cp LICENSE Makefile config.mk common.mk README AUTHORS Doxyfile \
${PROJECT}.1.rst ${PROJECT}rc.5.rst ${OSOURCE} ${HEADER} ${PROJECT}.pc.in \
${PROJECT}.desktop version.h.in \
${PROJECT}.1 ${PROJECT}rc.5 \
${PROJECT}-${VERSION}
$(QUIET)cp tests/Makefile tests/config.mk tests/*.c \
${PROJECT}-${VERSION}/tests
......@@ -117,30 +128,42 @@ po:
update-po:
$(QUIET)${MAKE} -C po update-po
ifneq "$(wildcard ${RSTTOMAN})" ""
%.1 %.5: config.mk
$(QUIET)sed "s/VERSION/${VERSION}/g" < $@.rst > $@.tmp
$(QUIET)${RSTTOMAN} $@.tmp > $@
$(QUIET)rm $@.tmp
${PROJECT}.1: ${PROJECT}.1.rst
${PROJECT}rc.5: ${PROJECT}rc.5.rst
build-manpages: ${PROJECT}.1 ${PROJECT}rc.5
else
build-manpages:
endif
install-manpages: build-manpages
$(ECHO) installing manual pages
$(QUIET)mkdir -p ${DESTDIR}${MANPREFIX}/man1 ${DESTDIR}${MANPREFIX}/man5
ifneq "$(wildcard ${PROJECT}.1)" ""
$(QUIET)install -m 644 ${PROJECT}.1 ${DESTDIR}${MANPREFIX}/man1
endif
ifneq "$(wildcard ${PROJECT}rc.5)" ""
$(QUIET)install -m 644 ${PROJECT}rc.5 ${DESTDIR}${MANPREFIX}/man5
endif
install-headers: ${PROJECT}.pc
$(ECHO) installing header files
$(QUIET)mkdir -p ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(QUIET)install -m 644 zathura.h document.h version.h ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(QUIET)install -m 644 ${HEADERINST} ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(ECHO) installing pkgconfig file
$(QUIET)mkdir -p ${DESTDIR}${LIBDIR}/pkgconfig
$(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
install: all install-headers po
install: all install-headers install-manpages
$(ECHO) installing executable file
$(QUIET)mkdir -p ${DESTDIR}${PREFIX}/bin
$(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin
ifneq "$(wildcard ${RSTTOMAN})" ""
$(ECHO) installing manual pages
$(QUIET)mkdir -p ${DESTDIR}${MANPREFIX}/man1 ${DESTDIR}${MANPREFIX}/man5
$(QUIET)sed "s/VERSION/${VERSION}/g" < ${PROJECT}.1.rst > ${PROJECT}-v.1.rst
$(QUIET)${RSTTOMAN} ${PROJECT}-v.1.rst > ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
$(QUIET)rm ${PROJECT}-v.1.rst
$(QUIET)sed "s/VERSION/${VERSION}/g" < ${PROJECT}rc.5.rst > ${PROJECT}rc-v.5.rst
$(QUIET)${RSTTOMAN} ${PROJECT}rc-v.5.rst > ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5
$(QUIET)rm ${PROJECT}rc-v.5.rst
$(QUIET)chmod 644 ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
$(QUIET)chmod 644 ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5
endif
$(QUIET)mkdir -p ${DESTDIR}${DESKTOPPREFIX}
$(ECHO) installing desktop file
$(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX}
......@@ -165,4 +188,4 @@ uninstall:
-include $(wildcard .depend/*.dep)
.PHONY: all options clean doc debug valgrind gdb dist doc install uninstall test \
po install-headers uninstall-headers update-po
po install-headers uninstall-headers update-po install-manpages build-manpages
File added
......@@ -15,7 +15,7 @@
#include "document.h"
#include "utils.h"
#include "shortcuts.h"
#include "page_widget.h"
#include "page-widget.h"
gboolean
cb_destroy(GtkWidget* UNUSED(widget), zathura_t* zathura)
......@@ -69,8 +69,8 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
girara_setting_get(zathura->ui.session, "page-padding", &page_padding);
GdkRectangle center;
center.x = view_rect.x + (view_rect.width + 1) / 2;
center.y = view_rect.y + (view_rect.height + 1) / 2;
center.x = (view_rect.width + 1) / 2;
center.y = (view_rect.height + 1) / 2;
center.height = center.width = (2 * page_padding) + 1;
bool updated = false;
......@@ -94,6 +94,7 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
} else {
page->visible = false;
}
zathura_page_widget_update_view_time(ZATHURA_PAGE(page->drawing_area));
}
statusbar_page_number_update(zathura);
......@@ -325,3 +326,21 @@ cb_view_resized(GtkWidget* UNUSED(widget), GtkAllocation* allocation, zathura_t*
return false;
}
void
cb_setting_recolor_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{
g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL);
g_return_if_fail(name != NULL);
zathura_t* zathura = session->global.data;
bool bool_value = *((bool*) value);
if (zathura->global.recolor != bool_value) {
zathura->global.recolor = bool_value;
render_all(zathura);
}
}
......@@ -98,4 +98,16 @@ bool cb_password_dialog(GtkEntry* entry, zathura_password_dialog_info_t* dialog)
*/
bool cb_view_resized(GtkWidget* widget, GtkAllocation* allocation, zathura_t* zathura);
/**
* Emitted when the 'recolor' setting is changed
*
* @param session Girara session
* @param name Name of the setting ("recolor")
* @param type Type of the setting (BOOLEAN)
* @param value New value
* @param data Custom data
*/
void cb_setting_recolor_change(girara_session_t* session, const char* name,
girara_setting_type_t type, void* value, void* data);
#endif // CALLBACKS_H
File added
/* See LICENSE file for license and copyright information */
#include <string.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include "commands.h"
#include "shortcuts.h"
#include "bookmarks.h"
#include "database.h"
#include "document.h"
......@@ -11,7 +13,7 @@
#include "print.h"
#include "document.h"
#include "utils.h"
#include "page_widget.h"
#include "page-widget.h"
#include <girara/session.h>
......@@ -209,6 +211,14 @@ cmd_open(girara_session_t* session, girara_list_t* argument_list)
return true;
}
bool
cmd_quit(girara_session_t* session, girara_list_t* UNUSED(argument_list))
{
sc_quit(session, NULL, NULL, 0);
return true;
}
bool
cmd_print(girara_session_t* session, girara_list_t* UNUSED(argument_list))
{
......@@ -338,8 +348,7 @@ cmd_export(girara_session_t* session, girara_list_t* argument_list)
return false;
}
const unsigned int argc = girara_list_size(argument_list);
if (argc != 2) {
if (girara_list_size(argument_list) != 2) {
girara_notify(session, GIRARA_ERROR, _("Invalid number of arguments given."));
return false;
}
......@@ -362,3 +371,36 @@ cmd_export(girara_session_t* session, girara_list_t* argument_list)
return true;
}
bool
cmd_offset(girara_session_t* session, girara_list_t* 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;
if (zathura->document == NULL) {
girara_notify(session, GIRARA_ERROR, _("No document opened."));
return false;
}
/* no argument: take current page as offset */
unsigned int page_offset = zathura->document->current_page_number;
/* retrieve offset from argument */
if (girara_list_size(argument_list) == 1) {
const char* value = girara_list_nth(argument_list, 0);
if (value != NULL) {
page_offset = atoi(value);
if (page_offset == 0 && strcmp(value, "0") != 0) {
girara_notify(session, GIRARA_WARNING, _("Argument must be a number."));
return false;
}
}
}
if (page_offset < zathura->document->number_of_pages) {
zathura->document->page_offset = page_offset;
}
return true;
}
......@@ -78,6 +78,15 @@ bool cmd_open(girara_session_t* session, girara_list_t* argument_list);
*/
bool cmd_print(girara_session_t* session, girara_list_t* argument_list);
/**
* Close zathura
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return true if no error occured
*/
bool cmd_quit(girara_session_t* session, girara_list_t* argument_list);
/**
* Save the current file
*
......@@ -115,4 +124,13 @@ bool cmd_search(girara_session_t* session, const char* input, girara_argument_t*
*/
bool cmd_export(girara_session_t* session, girara_list_t* argument_list);
/**
* Set page offset
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return true if no error occured
*/
bool cmd_offset(girara_session_t* session, girara_list_t* argument_list);
#endif // COMMANDS_H
File added
This diff is collapsed.
......@@ -15,6 +15,16 @@
*/
girara_completion_t* cc_open(girara_session_t* session, const char* input);
/**
* Completion for the write command - Creates a list of accesible directories or
* files
*
* @param session The used girara session
* @param input The current input
* @return The completion object or NULL if an error occured
*/
girara_completion_t* cc_write(girara_session_t* session, const char* input);
/**
* Completion for the bmarks command - Creates a list of bookmarks
*
......
File added
This diff is collapsed.
......@@ -3,16 +3,25 @@
ZATHURA_VERSION_MAJOR = 0
ZATHURA_VERSION_MINOR = 1
ZATHURA_VERSION_REV = 1
ZATHURA_VERSION_REV = 2
# If the API changes, the API version and the ABI version have to be bumped.
ZATHURA_API_VERSION = 1
# If the ABI breaks for any reason, this has to be bumped.
ZATHURA_ABI_VERSION = 1
VERSION = ${ZATHURA_VERSION_MAJOR}.${ZATHURA_VERSION_MINOR}.${ZATHURA_VERSION_REV}
# the GTK version to use
# the GTK+ version to use
# note: zathura with GTK+ 3 is broken!
ZATHURA_GTK_VERSION ?= 2
# minimum required zathura version
# If you want to disable the check, set GIRARA_VERSION_CHECK to 0.
GIRARA_MIN_VERSION = 0.1.2
GIRARA_VERSION_CHECK ?= $(shell pkg-config --atleast-version=$(GIRARA_MIN_VERSION) girara-gtk${ZATHURA_GTK_VERSION}; echo $$?)
# database
# build with sqlite support
WITH_SQLITE ?= 1
# To disable support for the sqlite backend set WITH_SQLITE to 0.
WITH_SQLITE ?= $(shell (pkg-config --exists sqlite3 && echo 1) || echo 0)
# paths
PREFIX ?= /usr
......@@ -72,6 +81,9 @@ CC ?= gcc
# strip
SFLAGS ?= -s
# msgfmt
MSGFMT ?= msgfmt
# valgrind
VALGRIND = valgrind
VALGRIND_ARGUMENTS = --tool=memcheck --leak-check=yes --leak-resolution=high \
......
File added
This diff is collapsed.
This diff is collapsed.
......@@ -32,10 +32,11 @@ struct _ZathuraSQLDatabaseClass
};
GType zathura_sqldatabase_get_type(void);
/**
* Initialize database system.
*
* @param dir Path to the sqlite database.
* @param path Path to the sqlite database.
* @return A valid zathura_database_t instance or NULL on failure
*/
zathura_database_t* zathura_sqldatabase_new(const char* path);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment