Commit 6218ee88 authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'release/0.3.4'

parents d9e74bb1 ae20f729
Pipeline #86 skipped
......@@ -24,13 +24,10 @@ zathura-*.tar.gz
# build dirs
.depend
.tx
build/
gcov/
doc/_build
# binaries
zathura
zathura-debug
# version file
version.h
.version-checks/
......
......@@ -21,20 +21,10 @@ LIBS += $(MAGIC_LIB)
CPPFLAGS += -DWITH_MAGIC
endif
ifneq ($(WITH_SYSTEM_SYNCTEX),0)
ifneq ($(WITH_SYNCTEX),0)
INCS += $(SYNCTEX_INC)
LIBS += $(SYNCTEX_LIB)
else
INCS += $(ZLIB_INC)
LIBS += $(ZLIB_LIB)
SOURCE += $(wildcard ${PROJECT}/synctex/*.c)
ifeq (,$(findstring -Isynctex,${CPPFLAGS}))
CPPFLAGS += -I${PROJECT}/synctex
endif
ifeq (,$(findstring -DSYNCTEX_VERBOSE=0,${CPPFLAGS}))
CPPFLAGS += -DSYNCTEX_VERBOSE=0
endif
CPPFLAGS += -DWITH_SYNCTEX
endif
ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),)
......@@ -111,9 +101,9 @@ ${OBJECTS}: config.mk ${PROJECT}/version.h \
${BUILDDIR_RELEASE}/%.o: %.c
$(call colorecho,CC,$<)
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p ${DEPENDDIR}/$(dir $@)
@mkdir -p $(dir $(abspath $@))
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF ${DEPENDDIR}/$@.dep
${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}: ${OBJECTS}
$(call colorecho,CC,$@)
......@@ -135,10 +125,10 @@ ${OBJECTS_DEBUG}: config.mk ${PROJECT}/version.h \
${BUILDDIR_DEBUG}/%.o: %.c
$(call colorecho,CC,$<)
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p ${DEPENDDIR}/$(dir $@)
@mkdir -p $(dir $(abspath $@))
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} \
-o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep
-o $@ $< -MMD -MF ${DEPENDDIR}/$@.dep
${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}: ${OBJECTS_DEBUG}
$(call colorecho,CC,$@)
......@@ -158,10 +148,10 @@ ${OBJECTS_GCOV}: config.mk ${PROJECT}/version.h \
${BUILDDIR_GCOV}/%.o: %.c
$(call colorecho,CC,$<)
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p ${DEPENDDIR}/$(dir $@)
@mkdir -p $(dir $(abspath $@))
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${GCOV_CFLAGS} \
-o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep
-o $@ $< -MMD -MF ${DEPENDDIR}/$@.dep
${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}: ${OBJECTS_GCOV}
$(call colorecho,CC,$@)
......@@ -298,7 +288,8 @@ uninstall: uninstall-headers
$(QUIET)rm -f $(DESTDIR)$(APPDATAPREFIX)/$(PROJECT).appdata.xml
$(MAKE) -C po uninstall
-include $(wildcard ${DEPENDDIR}/*.dep)
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 \
......
......@@ -5,13 +5,14 @@ girara user interface library and several document libraries.
Requirements
------------
gtk3
glib (>= 2.28)
gtk3 (>= 3.6)
glib (>= 2.32)
girara (>= 0.2.4)
sqlite3 (optional, >= 3.5.9)
check (for tests)
intltool
libmagic from file(1) (optional, for mime-type detection)
libsynctex from TeXLive (option, for SyncTeX support)
Sphinx (optional, for manpages and HTML documentation)
doxygen (optional, for HTML documentation)
breathe (optional, for HTML documentation)
......@@ -24,7 +25,7 @@ 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 additioan to Sphinx.
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.
......@@ -35,7 +36,7 @@ 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 zathuras documentation, please install all python
If you want to build zathura's documentation, please install all python
dependencies from the ./doc/requirements.txt file.
Installation
......
# 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
ifeq ($(COLOR),1)
COLOR_NORMAL = `$(TPUT) sgr0`
COLOR_ACTION = `$(TPUT) bold``$(TPUT) setaf 3`
COLOR_COMMENT = `$(TPUT) bold``$(TPUT) setaf 2`
COLOR_BRACKET = `$(TPUT) setaf 4`
CC += -fdiagnostics-color=always
define colorecho
@echo $(COLOR_BRACKET)" ["$(COLOR_ACTION)$1$(COLOR_BRACKET)"] "$(COLOR_COMMENT)$2$(COLOR_BRACKET) $(COLOR_NORMAL)
endef
......
......@@ -6,7 +6,7 @@ PROJECT = zathura
ZATHURA_VERSION_MAJOR = 0
ZATHURA_VERSION_MINOR = 3
ZATHURA_VERSION_REV = 3
ZATHURA_VERSION_REV = 4
# If the API changes, the API version and the ABI version have to be bumped.
ZATHURA_API_VERSION = 2
# If the ABI breaks for any reason, this has to be bumped.
......@@ -18,15 +18,15 @@ VERSION = ${ZATHURA_VERSION_MAJOR}.${ZATHURA_VERSION_MINOR}.${ZATHURA_VERSION_RE
# girara
GIRARA_VERSION_CHECK ?= 1
GIRARA_MIN_VERSION = 0.2.4
GIRARA_MIN_VERSION = 0.2.5
GIRARA_PKG_CONFIG_NAME = girara-gtk3
# glib
GLIB_VERSION_CHECK ?= 1
GLIB_MIN_VERSION = 2.28
GLIB_MIN_VERSION = 2.32
GLIB_PKG_CONFIG_NAME = glib-2.0
# GTK
GTK_VERSION_CHECK ?= 1
GTK_MIN_VERSION = 3.0
GTK_MIN_VERSION = 3.6
GTK_PKG_CONFIG_NAME = gtk+-3.0
# pkg-config binary
......@@ -37,8 +37,8 @@ PKG_CONFIG ?= pkg-config
WITH_SQLITE ?= $(shell (${PKG_CONFIG} --atleast-version=3.5.9 sqlite3 && echo 1) || echo 0)
# synctex
# To use the embedded copy of the syntex parser set WITH_SYSTEM_SYNCTEX to 0.
WITH_SYSTEM_SYNCTEX ?= $(shell (${PKG_CONFIG} synctex && echo 1) || echo 0)
# 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.
......@@ -91,24 +91,24 @@ MAGIC_INC ?=
MAGIC_LIB ?= -lmagic
endif
ifneq ($(WITH_SYSTEM_SYNCTEX),0)
ifneq ($(WITH_SYNCTEX),0)
SYNCTEX_INC ?= $(shell ${PKG_CONFIG} --cflags synctex)
SYNCTEX_LIB ?= $(shell ${PKG_CONFIG} --libs synctex)
else
ZLIB_INC ?= $(shell ${PKG_CONFIG} --cflags zlib)
ZLIB_LIB ?= $(shell ${PKG_CONFIG} --libs zlib)
endif
INCS = ${GIRARA_INC} ${GTK_INC} ${GTHREAD_INC} ${GMODULE_INC} ${GLIB_INC}
LIBS = ${GIRARA_LIB} ${GTK_LIB} ${GTHREAD_LIB} ${GMODULE_LIB} ${GLIB_LIB} -lpthread -lm
# flags
CFLAGS += -std=c99 -pedantic -Wall -Wno-format-zero-length -Wextra $(INCS)
# 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
# ld
# linker flags
LDFLAGS += -rdynamic
# compiler
......@@ -139,6 +139,9 @@ 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
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 pwmt.org -->
<!-- Copyright 2014-2015 pwmt.org -->
<application>
<id type="desktop">zathura.desktop</id>
<component type="desktop">
<id>zathura.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>Zlib</project_license>
<description>
......@@ -22,12 +22,21 @@
</ul>
</p>
</description>
<url type="homepage">http://pwmt.org/projects/zathura</url>
<url type="homepage">https://pwmt.org/projects/zathura</url>
<url type="bugtracker">https://bugs.pwmt.org/project/zathura</url>
<screenshots>
<screenshot type="default">http://pwmt.org/projects/zathura/img/zathura-cover.png</screenshot>
<screenshot>http://pwmt.org/projects/zathura/img/zathura-completion.png</screenshot>
<screenshot>http://pwmt.org/projects/zathura/img/zathura-follow.png</screenshot>
<screenshot>http://pwmt.org/projects/zathura/img/zathura-bookmarks.png</screenshot>
<screenshot type="default">
<image>https://pwmt.org/projects/zathura/img/zathura-cover.png</image>
</screenshot>
<screenshot>
<image>https://pwmt.org/projects/zathura/img/zathura-completion.png</image>
</screenshot>
<screenshot>
<image>https://pwmt.org/projects/zathura/img/zathura-follow.png</image>
</screenshot>
<screenshot>
<image>https://pwmt.org/projects/zathura/img/zathura-bookmarks.png</image>
</screenshot>
</screenshots>
<updatecontact>zathura@lists.pwmt.org</updatecontact>
</application>
<update_contact>zathura@lists.pwmt.org</update_contact>
</component>
......@@ -2,11 +2,25 @@
#
# See LICENSE file for license and copyright information
import os.path
import glob
import time
dirname = os.path.dirname(__file__)
files = glob.glob(os.path.join(dirname, '*.rst'))
files.extend(glob.glob(os.path.join(dirname, '*.txt')))
maxdate = 0
for path in files:
s = os.stat(path)
maxdate = max(maxdate, s.st_mtime)
# -- General configuration ------------------------------------------------
source_suffix = '.rst'
master_doc = 'zathura.1'
templates_path = ['_templates']
today = time.strftime('%Y-%m-%d', time.gmtime(maxdate))
# -- Project configuration ------------------------------------------------
......
......@@ -74,9 +74,9 @@ the *zathurarc* file to make those changes permanent:
include - Including another config file
---------------------------------------
This commands allows to include other configuration files. If a relative path is
given, the path will be resolved relative to the configuration file that is
currently processed.
This commands allows one to include other configuration files. If a relative
path is given, the path will be resolved relative to the configuration file that
is currently processed.
::
......@@ -731,9 +731,12 @@ Defines the number of pages that are rendered next to each other in a row.
first-page-column
^^^^^^^^^^^^^^^^^
Defines the column in which the first page will be displayed.
This setting is stored separately for every value of pages-per-row according to
the following pattern <1 page per row>:[<2 pages per row>[: ...]]. Per default,
the first column is set to 2 for double-page layout.
* Value type: Integer
* Default value: 1
* Value type: String
* Default value: 1:2
recolor
^^^^^^^
......@@ -820,6 +823,30 @@ Defines if the last/first page should be wrapped
* Value type: Boolean
* Default value: false
show-directories
^^^^^^^^^^^^^^^^
Defines if the directories should be displayed in completion.
* Value type: Boolean
* Default value: true
show-hidden
^^^^^^^^^^^
Defines if hidden files and directories should be displayed in completion.
* Value type: Boolean
* Default value: false
show-recent
^^^^^^^^^^^
Defines the number of recent files that should be displayed in completion.
If the value is negative, no upper bounds are applied. If the value is 0, no
recent files are shown.
* Value type: Integer
* Default value: 10
scroll-page-aware
^^^^^^^^^^^^^^^^^
Defines if scrolling by half or full pages stops at page boundaries.
......@@ -863,6 +890,13 @@ Use basename of the file in the window title.
* Value type: Boolean
* Default value: false
window-title-home-tilde
^^^^^^^^^^^^^^^^^^^^^^^
Display a short version of the file path, which replaces $HOME with ~, in the window title.
* Value type: Boolean
* Default value: false
window-title-page
^^^^^^^^^^^^^^^^^
Display the page number in the window title.
......@@ -877,6 +911,13 @@ Use basename of the file in the statusbar.
* Value type: Boolean
* Default value: false
statusbar-home-tilde
^^^^^^^^^^^^^^^^^^^^
Display a short version of the file path, which replaces $HOME with ~, in the statusbar.
* Value type: Boolean
* Default value: false
zoom-center
^^^^^^^^^^^
En/Disables horizontally centered zooming.
......
# See LICENSE file for license and copyright information
include ../config.mk
include ../common.mk
include ../colors.mk
PROJECT = zathura
GETTEXT_PACKAGE = $(PROJECT)
CATALOGS = $(wildcard *.po)
CATALOGS = $(sort $(wildcard *.po))
LINGUAS ?= $(patsubst %.po, %, $(CATALOGS))
ifeq ($(LINGUAS),)
ALINGUAS =
......@@ -11,48 +14,45 @@ ALINGUAS = $(shell find $(patsubst %, %.po, $(LINGUAS)) 2>/dev/null)
endif
MOS = $(patsubst %, %/LC_MESSAGES/${GETTEXT_PACKAGE}.mo, $(patsubst %.po, %, $(ALINGUAS)))
include ../config.mk
include ../common.mk
all: ${MOS}
clean:
$(QUIET)rm -rf POTFILES.in POTFILES.in.tmp $(patsubst %.po, %, $(CATALOGS)) ${PROJECT}.pot
POTFILES.in: $(wildcard ../zathura/*.c)
POTFILES.in: $(sort $(wildcard ../girara/*.c))
$(QUIET) set -e && rm -f $@.tmp && touch $@.tmp && \
for f in $(^F) ; do \
echo zathura/$$f >> $@.tmp ; \
echo girara/$$f >> $@.tmp ; \
done && \
mv $@.tmp $@
${PROJECT}.pot: POTFILES.in
$(ECHO) regenerate ${PROJECT}.pot
$(QUIET)intltool-update --pot --gettext-package=${PROJECT}
${GETTEXT_PACKAGE}.pot: POTFILES.in
$(ECHO) regenerate $@
$(QUIET)intltool-update --pot --gettext-package=${GETTEXT_PACKAGE}
update-po: ${PROJECT}.pot
$(ECHO) updating po: files ${CATALOGS}
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=${PROJECT} `echo $$f | sed 's/\.po//'` ; \
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/${PROJECT}.mo: %.po
%/LC_MESSAGES/${GETTEXT_PACKAGE}.mo: %.po
@mkdir -p $(@D)
$(ECHO) msgfmt $(shell echo $< | sed 's/\.po//')
$(call colorecho,MSGFMT,$(shell echo $< | sed 's/\.po//'))
$(QUIET)${MSGFMT} ${MSGFMTFLAGS} -c $< -o $@
install: ${MOS}
$(ECHO) installing translations
$(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}
$(ECHO) removing translations
$(call colorecho,UNINSTALL,"Uninstall translations")
$(QUIET)set -e && for f in $^ ; do \
rm -f $(DESTDIR)$(LOCALEDIR)/$$f; \
rm -f $(LOCALEDIR)/$$f; \
done
.PHONY: all clean update-po install uninstall
.PHONY: all clean install uninstall update-po
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.
......@@ -33,21 +33,10 @@ LIBS += $(MAGIC_LIB)
CPPFLAGS += -DWITH_MAGIC
endif
ifneq ($(WITH_SYSTEM_SYNCTEX),0)
ifneq ($(WITH_SYNCTEX),0)
INCS += $(SYNCTEX_INC)
LIBS += $(SYNCTEX_LIB)
else
ZATHURA_OBJECTS += $(wildcard ../${BUILDDIR_RELEASE}/zathura/synctex/*.o)
ZATHURA_OBJECTS_DEBUG += $(wildcard ../${BUILDDIR_DEBUG}/zathura/synctex/*.o)
ZATHURA_OBJECTS_GCOV += $(wildcard ../${BUILDDIR_GCOV}/zathura/synctex/*.o)
LIBS += $(ZLIB_LIB)
ifeq (,$(findstring -Isynctex,${CPPFLAGS}))
CPPFLAGS += -I../zathura/synctex
endif
ifeq (,$(findstring -DSYNCTEX_VERBOSE=0,${CPPFLAGS}))
CPPFLAGS += -DSYNCTEX_VERBOSE=0
endif
CPPFLAGS += -DWITH_SYNCTEX
endif
ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),)
......
......@@ -19,7 +19,7 @@ Comment[pt_BR]=Um visualizador de documentos minimalista
Comment[ru]=Минималистичный просмотрщик документов
Comment[tr]=Minimalist bir belge görüntüleyicisi
Comment[uk_UA]=Легкий переглядач документів
Exec=zathura %f
Exec=zathura %U
Terminal=false
Categories=Office;Viewer;
Keywords=PDF;PS;PostScript;DjVU;document;presentation;
Keywords=PDF;PS;PostScript;DjVU;document;presentation;viewer;
......@@ -243,8 +243,13 @@ cb_page_layout_value_changed(girara_session_t* session, const char* name, girara
unsigned int pages_per_row = 1;
girara_setting_get(session, "pages-per-row", &pages_per_row);
unsigned int first_page_column = 1;
girara_setting_get(session, "first-page-column", &first_page_column);
/* get list of first_page_column settings */
char* first_page_column_list = NULL;
girara_setting_get(session, "first-page-column", &first_page_column_list);
/* find value for first_page_column */
unsigned int first_page_column = find_first_page_column(first_page_column_list, pages_per_row);
g_free(first_page_column_list);
unsigned int page_padding = 1;
girara_setting_get(zathura->ui.session, "page-padding", &page_padding);
......@@ -435,11 +440,12 @@ cb_password_dialog(GtkEntry* entry, zathura_password_dialog_info_t* dialog)
}
/* try to open document again */
if (document_open(dialog->zathura, dialog->path, input,
if (document_open(dialog->zathura, dialog->path, dialog->uri, input,
ZATHURA_PAGE_NUMBER_UNSPECIFIED) == false) {
gdk_threads_add_idle(password_dialog, dialog);
} else {
g_free(dialog->path);
g_free(dialog->uri);
free(dialog);
}
......@@ -622,7 +628,8 @@ cb_page_widget_link(ZathuraPage* page, void* data)
bool enter = (bool) data;
GdkWindow* window = gtk_widget_get_parent_window(GTK_WIDGET(page));
GdkCursor* cursor = gdk_cursor_new(enter == true ? GDK_HAND1 : GDK_LEFT_PTR);
GdkDisplay* display = gtk_widget_get_display(GTK_WIDGET(page));
GdkCursor* cursor = gdk_cursor_new_for_display(display, enter == true ? GDK_HAND1 : GDK_LEFT_PTR);
gdk_window_set_cursor(window, cursor);
g_object_unref(cursor);
}
......
......@@ -238,9 +238,9 @@ cmd_open(girara_session_t* session, girara_list_t* argument_list)
document_close(zathura, false);
}
document_open(zathura, girara_list_nth(argument_list, 0),
document_open_idle(zathura, girara_list_nth(argument_list, 0),
(argc == 2) ? girara_list_nth(argument_list, 1) : NULL,
ZATHURA_PAGE_NUMBER_UNSPECIFIED);
ZATHURA_PAGE_NUMBER_UNSPECIFIED, NULL, NULL);
} else {
girara_notify(session, GIRARA_ERROR, _("No arguments given."));
return false;
......
......@@ -12,6 +12,7 @@
#include "completion.h"
#include "utils.h"
#include "page.h"
#include "database.h"
#include <girara/session.h>
#include <girara/settings.h>
......@@ -32,7 +33,7 @@ compare_case_insensitive(const char* str1, const char* str2)
static girara_list_t*
list_files(zathura_t* zathura, const char* current_path, const char* current_file,
unsigned int current_file_length, bool is_dir, bool check_file_ext)
size_t current_file_length, bool is_dir, bool check_file_ext)
{
if (zathura == NULL || zathura->ui.session == NULL || current_path == NULL) {
return NULL;
......@@ -113,15 +114,20 @@ error_free:
}
static girara_completion_t*
list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext)
list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext, int show_recent)
{
girara_completion_t* completion = girara_completion_init();
girara_completion_group_t* group = girara_completion_group_create(zathura->ui.session, NULL);
girara_completion_group_t* group = girara_completion_group_create(zathura->ui.session, "files");
girara_completion_group_t* history_group = NULL;
gchar* path = NULL;
gchar* current_path = NULL;
if (completion == NULL || group == NULL) {
if (show_recent > 0) {
history_group = girara_completion_group_create(zathura->ui.session, "recent files");
}
if (completion == NULL || group == NULL || (show_recent > 0 && history_group == NULL)) {
goto error_free;
}
......@@ -169,12 +175,12 @@ list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext)
/* get current file */
gchar* current_file = is_dir ? "" : basename(path);
int current_file_length = strlen(current_file);
const size_t current_file_length = strlen(current_file);
/* read directory */
if (g_file_test(current_path, G_FILE_TEST_IS_DIR) == TRUE) {
girara_list_t* names = list_files(zathura, current_path, current_file, current_file_length, is_dir, check_file_ext);
if (!names) {
if (names == NULL) {
goto error_free;
}
......@@ -184,9 +190,32 @@ list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext)
girara_list_free(names);
}
if (show_recent > 0) {
girara_list_t* recent_files = zathura_db_get_recent_files(zathura->database, show_recent);
if (recent_files == NULL) {
goto error_free;
}
if (girara_list_size(recent_files) != 0) {
const size_t path_len = strlen(path);
GIRARA_LIST_FOREACH(recent_files, const char*, iter, file)
if (strncmp(path, file, path_len) == 0) {
girara_completion_group_add_element(history_group, file, NULL);
}
GIRARA_LIST_FOREACH_END(recent_files, const char*, iter, file);
girara_list_free(recent_files);
} else {
girara_completion_group_free(history_group);
history_group = NULL;
}
}
g_free(path);
g_free(current_path);
if (history_group != NULL) {
girara_completion_add_group(completion, history_group);
}
girara_completion_add_group(completion, group);
return completion;
......@@ -196,6 +225,9 @@ error_free:
if (completion) {
girara_completion_free(completion);
}
if (history_group) {
girara_completion_group_free(history_group);
}
if (group) {
girara_completion_group_free(group);
}
......@@ -213,7 +245,10 @@ cc_open(girara_session_t* session, const char* input)
g_return_val_if_fail(session->global.data != NULL, NULL);
zathura_t* zathura = session->global.data;
return list_files_for_cc(zathura, input, true);
int show_recent = 0;
girara_setting_get(zathura->ui.session, "show-recent", &show_recent);
return list_files_for_cc(zathura, input, true, show_recent);
}
girara_completion_t*
......@@ -223,7 +258,7 @@ cc_write(girara_session_t* session, const char* input)
g_return_val_if_fail(session->global.data != NULL, NULL);
zathura_t* zathura = session->global.data;
return list_files_for_cc(zathura, input, false);
return list_files_for_cc(zathura, input, false, false);
}
girara_completion_t*
......
......@@ -149,7 +149,7 @@ config_load_default(zathura_t* zathura)
int_value = 1;
girara_setting_add(gsession, "pages-per-row", &int_value, INT, false, _("Number of pages per row"), cb_page_layout_value_changed, NULL);
int_value = 1;
girara_setting_add(gsession, "first-page-column", &int_value, INT, false, _("Column of the first page"), cb_page_layout_value_changed, NULL);
girara_setting_add(gsession, "first-page-column", "1:2", STRING, false, _("Column of the first page"), cb_page_layout_value_changed, NULL);
float_value = 40;
girara_setting_add(gsession, "scroll-step", &float_value, FLOAT, false, _("Scroll step"), NULL, NULL);
float_value = 40;
......@@ -212,6 +212,8 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "show-hidden", &bool_value, BOOLEAN, false, _("Show hidden files and directories"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "show-directories", &bool_value, BOOLEAN, false, _("Show directories"), NULL, NULL);
int_value = 10;
girara_setting_add(gsession, "show-recent", &int_value, INT, false, _("Show recent files"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "open-first-page", &bool_value, BOOLEAN, false, _("Always open on first page"), NULL, NULL);
bool_value = false;
......@@ -224,9 +226,13 @@ config_load_default(zathura_t* zathura)
bool_value = false;
girara_setting_add(gsession, "window-title-basename", &bool_value, BOOLEAN, false, _("Use basename of the file in the window title"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "window-title-home-tilde", &bool_value, BOOLEAN, false, _("Use ~ instead of $HOME in the filename in the window title"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "window-title-page", &bool_value, BOOLEAN, false, _("Display the page number in the window title"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "statusbar-basename", &bool_value, BOOLEAN, false, _("Use basename of the file in the statusbar"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "statusbar-home-tilde", &bool_value, BOOLEAN, false, _("Use ~ instead of $HOME in the filename in the statusbar"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "synctex", &bool_value, BOOLEAN, false, _("Enable synctex support"), NULL, NULL);
string_value = "";
......@@ -381,9 +387,13 @@ config_load_default(zathura_t* zathura)
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_navigate_index, INDEX, EXPAND, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Return, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_j, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_q, NULL, sc_quit, INDEX, 0, NULL);