Commit 8deccdb5 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Merge tag 'upstream/0.3.5'

Upstream version 0.3.5

# gpg: Signature made Mon 15 Feb 2016 01:35:23 CET using RSA key ID 6EA71993
# gpg: Good signature from "Sebastian Ramacher <sebastian@ramacher.at>"
# gpg:                 aka "Sebastian Ramacher <s.ramacher@gmail.com>"
# gpg:                 aka "Sebastian Ramacher <s.ramacher@gmx.at>"
# gpg:                 aka "Sebastian Ramacher <s.ramacher@student.tugraz.at>"
# gpg:                 aka "Sebastian Ramacher <sramacher@debian.org>"
# gpg:                 aka "Sebastian Ramacher <sebastian.ramacher@iaik.tugraz.at>"
parents 77dbbea2 f5c229a5
Copyright (c) 2009-2015 pwmt.org Copyright (c) 2009-2016 pwmt.org
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
......
...@@ -12,7 +12,7 @@ sqlite3 (optional, >= 3.5.9) ...@@ -12,7 +12,7 @@ sqlite3 (optional, >= 3.5.9)
check (for tests) check (for tests)
intltool intltool
libmagic from file(1) (optional, for mime-type detection) libmagic from file(1) (optional, for mime-type detection)
libsynctex from TeXLive (option, for SyncTeX support) libsynctex from TeXLive (optional, for SyncTeX support)
Sphinx (optional, for manpages and HTML documentation) Sphinx (optional, for manpages and HTML documentation)
doxygen (optional, for HTML documentation) doxygen (optional, for HTML documentation)
breathe (optional, for HTML documentation) breathe (optional, for HTML documentation)
......
...@@ -6,7 +6,7 @@ PROJECT = zathura ...@@ -6,7 +6,7 @@ PROJECT = zathura
ZATHURA_VERSION_MAJOR = 0 ZATHURA_VERSION_MAJOR = 0
ZATHURA_VERSION_MINOR = 3 ZATHURA_VERSION_MINOR = 3
ZATHURA_VERSION_REV = 4 ZATHURA_VERSION_REV = 5
# If the API changes, the API version and the ABI version have to be bumped. # If the API changes, the API version and the ABI version have to be bumped.
ZATHURA_API_VERSION = 2 ZATHURA_API_VERSION = 2
# If the ABI breaks for any reason, this has to be bumped. # If the ABI breaks for any reason, this has to be bumped.
......
...@@ -6,7 +6,7 @@ include ../colors.mk ...@@ -6,7 +6,7 @@ include ../colors.mk
include config.mk include config.mk
MAN_SOURCES=$(wildcard man/*.rst) $(wildcard man/*.txt) man/conf.py MAN_SOURCES=$(wildcard man/*.rst) $(wildcard man/*.txt) man/conf.py
DOXYGEN_SOURCES=$(wildcard ../*.h) Doxyfile DOXYGEN_SOURCES=$(wildcard ../zathura/*.h) Doxyfile
HTML_SOURCES=$(wildcard *.rst api/*.rst configuration/*.rst installation/*.rst usage/*.rst) conf.py HTML_SOURCES=$(wildcard *.rst api/*.rst configuration/*.rst installation/*.rst usage/*.rst) conf.py
SPHINX_OPTS+=-d $(SPHINX_BUILDDIR)/doctrees SPHINX_OPTS+=-d $(SPHINX_BUILDDIR)/doctrees
...@@ -18,15 +18,17 @@ clean: ...@@ -18,15 +18,17 @@ clean:
$(QUIET)rm -rf $(SPHINX_BUILDDIR)/ $(QUIET)rm -rf $(SPHINX_BUILDDIR)/
$(SPHINX_BUILDDIR)/html/index.html: $(HTML_SOURCES) $(SPHINX_BUILDDIR)/doxygen/xml/index.xml $(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") $(call colorecho,DOC,"Build HTML documentation")
$(QUIET)$(SPHINX_BIN) -b html $(SPHINX_OPTS) . $(SPHINX_BUILDDIR)/html $(QUIET)$(SPHINX_BIN) -b html $(SPHINX_OPTS) . $(SPHINX_BUILDDIR)/html
$(SPHINX_BUILDDIR)/zathura.1 $(SPHINX_BUILDDIR)/zathurarc.5: $(MAN_SOURCES) $(SPHINX_BUILDDIR)/zathura.1 $(SPHINX_BUILDDIR)/zathurarc.5: $(MAN_SOURCES)
$(QUIET)mkdir -p $(SPHINX_BUILDDIR)
$(call colorecho,DOC,"Build man pages") $(call colorecho,DOC,"Build man pages")
$(QUIET)$(SPHINX_BIN) -b man $(SPHINX_OPTS) man $(SPHINX_BUILDDIR) $(QUIET)$(SPHINX_BIN) -b man $(SPHINX_OPTS) man $(SPHINX_BUILDDIR)
$(SPHINX_BUILDDIR)/doxygen/xml/index.xml: $(DOXYGEN_SOURCES) $(SPHINX_BUILDDIR)/doxygen/xml/index.xml: $(DOXYGEN_SOURCES)
$(QUIET)mkdir -p $(SPHINX_BUILDDIR) $(QUIET)mkdir -p $(SPHINX_BUILDDIR)/doxygen/xml
$(call colorecho,DOC,"Run doxygen") $(call colorecho,DOC,"Run doxygen")
$(QUIET)$(DOXYGEN_BIN) Doxyfile $(QUIET)$(DOXYGEN_BIN) Doxyfile
......
.\" Man page generated from reStructuredText. .\" Man page generated from reStructuredText.
. .
.TH "ZATHURA" "1" "2015-12-21" "0.2.7" "zathura" .TH "ZATHURA" "1" "2016-02-14" "0.2.7" "zathura"
.SH NAME .SH NAME
zathura \- a document viewer zathura \- a document viewer
. .
...@@ -33,7 +33,8 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] ...@@ -33,7 +33,8 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.SH SYNOPSIS .SH SYNOPSIS
.sp .sp
zathura [\-e XID] [\-c PATH] [\-d PATH] [\-p PATH] [\-w PASSWORD] [\-P NUMBER] zathura [\-e XID] [\-c PATH] [\-d PATH] [\-p PATH] [\-w PASSWORD] [\-P NUMBER]
[\-\-fork] [\-l LEVEL] [\-s] [\-x CMD] [\-\-synctex\-forward INPUT] <files> [\-\-fork] [\-l LEVEL] [\-s] [\-x CMD] [\-\-synctex\-forward INPUT] [\-\-synctex\-pid PID]
<files>
.SH DESCRIPTION .SH DESCRIPTION
.sp .sp
\fBzathura\fP displays the given files. If a single hyphen\-minus (\-) is given as \fBzathura\fP displays the given files. If a single hyphen\-minus (\-) is given as
...@@ -72,7 +73,13 @@ Set the synctex editor command. Overrides the synctex\-editor\-command setting. ...@@ -72,7 +73,13 @@ Set the synctex editor command. Overrides the synctex\-editor\-command setting.
.TP .TP
.BI \-\-synctex\-forward\fB= input .BI \-\-synctex\-forward\fB= input
Jump to the given position. The switch expects the same format as specified Jump to the given position. The switch expects the same format as specified
for synctex\(aqs view \-i. for synctex\(aqs view \-i. If no instance is running for the specified document,
a new instance will be launched (only if \-\-synctex\-pid is not specified).
.TP
.BI \-\-synctex\-pid\fB= pid
Instead of looking for an instance having the correct file opened, try only
the instance with the given PID. Note that if the given PID does not have the
correct file open or does not exist, no new instance will be spanned.
.TP .TP
.B \-\-fork .B \-\-fork
Fork into background Fork into background
...@@ -313,9 +320,6 @@ Execute an external command ...@@ -313,9 +320,6 @@ Execute an external command
.B info .B info
Show document information Show document information
.TP .TP
.B help
Show help page
.TP
.B open .B open
Open a document Open a document
.TP .TP
...@@ -342,8 +346,8 @@ description please consult zathurarc(5). ...@@ -342,8 +346,8 @@ description please consult zathurarc(5).
.SH SYNCTEX SUPPORT .SH SYNCTEX SUPPORT
.sp .sp
Both synctex forward and backwards synchronization are supported by zathura, To Both synctex forward and backwards synchronization are supported by zathura, To
enable synctex forward synchronization, please look at the \fI\-\-syntex\fP and enable synctex forward synchronization, please look at the \fI\-\-synctex\-forward\fP
\fI\-\-synctex\-editor\fP options. zathura will also emit a signal via the D\-Bus and \fI\-\-synctex\-editor\fP options. zathura will also emit a signal via the D\-Bus
interface. To support synctex backwards synchronization, zathura provides a interface. To support synctex backwards synchronization, zathura provides a
D\-Bus interface that can be called by the editor. For convince zathura also D\-Bus interface that can be called by the editor. For convince zathura also
knows how to parse the output of the \fIsynctex view\fP command. It is enough to knows how to parse the output of the \fIsynctex view\fP command. It is enough to
......
.\" Man page generated from reStructuredText. .\" Man page generated from reStructuredText.
. .
.TH "ZATHURARC" "5" "2015-12-21" "0.2.7" "zathura" .TH "ZATHURARC" "5" "2016-02-14" "0.2.7" "zathura"
.SH NAME .SH NAME
zathurarc \- zathura configuration file zathurarc \- zathura configuration file
. .
...@@ -403,6 +403,12 @@ Show or hide statusbar. ...@@ -403,6 +403,12 @@ Show or hide statusbar.
\fBzoom\fP \fBzoom\fP
.sp .sp
Zoom in or out. Zoom in or out.
.IP \(bu 2
\fBmark_add\fP
Set a quickmark.
.IP \(bu 2
\fBmark_evaluate\fP
Go to a quickmark.
.UNINDENT .UNINDENT
.SS Pass arguments .SS Pass arguments
.sp .sp
...@@ -605,8 +611,8 @@ Default value: monospace normal 9 ...@@ -605,8 +611,8 @@ Default value: monospace normal 9
Shows or hides GUI elements. Shows or hides GUI elements.
If it contains \(aqc\(aq, the command line is displayed. If it contains \(aqc\(aq, the command line is displayed.
If it contains \(aqs\(aq, the statusbar is displayed. If it contains \(aqs\(aq, the statusbar is displayed.
If it contains \(aqh\(aq, the vertical scrollbar is displayed. If it contains \(aqh\(aq, the horizontal scrollbar is displayed.
If it contains \(aqv\(aq, the horizontal scrollbar is displayed. If it contains \(aqv\(aq, the vertical scrollbar is displayed.
.INDENT 0.0 .INDENT 0.0
.IP \(bu 2 .IP \(bu 2
Value type: String Value type: String
......
...@@ -16,9 +16,6 @@ exec ...@@ -16,9 +16,6 @@ exec
info info
Show document information Show document information
help
Show help page
open open
Open a document Open a document
......
...@@ -28,7 +28,13 @@ ...@@ -28,7 +28,13 @@
--synctex-forward=input --synctex-forward=input
Jump to the given position. The switch expects the same format as specified Jump to the given position. The switch expects the same format as specified
for synctex's view -i. for synctex's view -i. If no instance is running for the specified document,
a new instance will be launched (only if --synctex-pid is not specified).
--synctex-pid=pid
Instead of looking for an instance having the correct file opened, try only
the instance with the given PID. Note that if the given PID does not have the
correct file open or does not exist, no new instance will be spanned.
--fork --fork
Fork into background Fork into background
......
Both synctex forward and backwards synchronization are supported by zathura, To Both synctex forward and backwards synchronization are supported by zathura, To
enable synctex forward synchronization, please look at the *--syntex* and enable synctex forward synchronization, please look at the *--synctex-forward*
*--synctex-editor* options. zathura will also emit a signal via the D-Bus and *--synctex-editor* options. zathura will also emit a signal via the D-Bus
interface. To support synctex backwards synchronization, zathura provides a interface. To support synctex backwards synchronization, zathura provides a
D-Bus interface that can be called by the editor. For convince zathura also D-Bus interface that can be called by the editor. For convince zathura also
knows how to parse the output of the *synctex view* command. It is enough to knows how to parse the output of the *synctex view* command. It is enough to
......
zathura [-e XID] [-c PATH] [-d PATH] [-p PATH] [-w PASSWORD] [-P NUMBER] zathura [-e XID] [-c PATH] [-d PATH] [-p PATH] [-w PASSWORD] [-P NUMBER]
[--fork] [-l LEVEL] [-s] [-x CMD] [--synctex-forward INPUT] <files> [--fork] [-l LEVEL] [-s] [-x CMD] [--synctex-forward INPUT] [--synctex-pid PID]
<files>
...@@ -307,6 +307,13 @@ The following shortcut functions can be mapped: ...@@ -307,6 +307,13 @@ The following shortcut functions can be mapped:
Zoom in or out. Zoom in or out.
* ``mark_add``
Set a quickmark.
* ``mark_evaluate``
Go to a quickmark.
Pass arguments Pass arguments
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
Some shortcut function require or have optional arguments which influence the Some shortcut function require or have optional arguments which influence the
...@@ -454,8 +461,8 @@ guioptions ...@@ -454,8 +461,8 @@ guioptions
Shows or hides GUI elements. Shows or hides GUI elements.
If it contains 'c', the command line is displayed. If it contains 'c', the command line is displayed.
If it contains 's', the statusbar is displayed. If it contains 's', the statusbar is displayed.
If it contains 'h', the vertical scrollbar is displayed. If it contains 'h', the horizontal scrollbar is displayed.
If it contains 'v', the horizontal scrollbar is displayed. If it contains 'v', the vertical scrollbar is displayed.
* Value type: String * Value type: String
* Default value: s * Default value: s
......
...@@ -5,4 +5,4 @@ Usage ...@@ -5,4 +5,4 @@ Usage
:maxdepth: 2 :maxdepth: 2
:numbered: :numbered:
commands commands
...@@ -19,10 +19,10 @@ all: ${MOS} ...@@ -19,10 +19,10 @@ all: ${MOS}
clean: clean:
$(QUIET)rm -rf POTFILES.in POTFILES.in.tmp $(patsubst %.po, %, $(CATALOGS)) ${PROJECT}.pot $(QUIET)rm -rf POTFILES.in POTFILES.in.tmp $(patsubst %.po, %, $(CATALOGS)) ${PROJECT}.pot
POTFILES.in: $(sort $(wildcard ../girara/*.c)) POTFILES.in: $(sort $(wildcard ../zathura/*.c))
$(QUIET) set -e && rm -f $@.tmp && touch $@.tmp && \ $(QUIET) set -e && rm -f $@.tmp && touch $@.tmp && \
for f in $(^F) ; do \ for f in $(^F) ; do \
echo girara/$$f >> $@.tmp ; \ echo zathura/$$f >> $@.tmp ; \
done && \ done && \
mv $@.tmp $@ mv $@.tmp $@
......
...@@ -5,9 +5,10 @@ ...@@ -5,9 +5,10 @@
#include "document.h" #include "document.h"
START_TEST(test_open) { START_TEST(test_open) {
fail_unless(zathura_document_open(NULL, NULL, NULL, NULL) == NULL, "Could create document", NULL); fail_unless(zathura_document_open(NULL, NULL, NULL, NULL, NULL) == NULL, "Could create document", NULL);
fail_unless(zathura_document_open(NULL, "fl", NULL, NULL) == NULL, "Could create document", NULL); fail_unless(zathura_document_open(NULL, "fl", NULL, NULL, NULL) == NULL, "Could create document", NULL);
fail_unless(zathura_document_open(NULL, "fl", "pw", NULL) == NULL, "Could create document", NULL); fail_unless(zathura_document_open(NULL, "fl", "ur", NULL, NULL) == NULL, "Could create document", NULL);
fail_unless(zathura_document_open(NULL, "fl", NULL, "pw", NULL) == NULL, "Could create document", NULL);
} END_TEST } END_TEST
Suite* suite_document() Suite* suite_document()
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* *
* @param widget The gtk window of zathura * @param widget The gtk window of zathura
* @param zathura Correspondending zathura session * @param zathura Correspondending zathura session
* @return true if no error occured and the event has been handled * @return true if no error occurred and the event has been handled
*/ */
gboolean cb_destroy(GtkWidget* widget, zathura_t* zathura); gboolean cb_destroy(GtkWidget* widget, zathura_t* zathura);
...@@ -108,7 +108,7 @@ void cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path, ...@@ -108,7 +108,7 @@ void cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
* *
* @param entry The dialog inputbar * @param entry The dialog inputbar
* @param session The girara session * @param session The girara session
* @return true if no error occured and the event has been handled * @return true if no error occurred and the event has been handled
*/ */
bool cb_sc_follow(GtkEntry* entry, girara_session_t* session); bool cb_sc_follow(GtkEntry* entry, girara_session_t* session);
...@@ -117,7 +117,7 @@ bool cb_sc_follow(GtkEntry* entry, girara_session_t* session); ...@@ -117,7 +117,7 @@ bool cb_sc_follow(GtkEntry* entry, girara_session_t* session);
* *
* @param entry The dialog inputbar * @param entry The dialog inputbar
* @param session The girara session * @param session The girara session
* @return true if no error occured and the event has been handled * @return true if no error occurred and the event has been handled
*/ */
bool cb_sc_display_link(GtkEntry* entry, girara_session_t* session); bool cb_sc_display_link(GtkEntry* entry, girara_session_t* session);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_bookmark_create(girara_session_t* session, girara_list_t* argument_list); bool cmd_bookmark_create(girara_session_t* session, girara_list_t* argument_list);
...@@ -20,7 +20,7 @@ bool cmd_bookmark_create(girara_session_t* session, girara_list_t* argument_list ...@@ -20,7 +20,7 @@ bool cmd_bookmark_create(girara_session_t* session, girara_list_t* argument_list
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_bookmark_delete(girara_session_t* session, girara_list_t* argument_list); bool cmd_bookmark_delete(girara_session_t* session, girara_list_t* argument_list);
...@@ -29,7 +29,7 @@ bool cmd_bookmark_delete(girara_session_t* session, girara_list_t* argument_list ...@@ -29,7 +29,7 @@ bool cmd_bookmark_delete(girara_session_t* session, girara_list_t* argument_list
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_bookmark_open(girara_session_t* session, girara_list_t* argument_list); bool cmd_bookmark_open(girara_session_t* session, girara_list_t* argument_list);
...@@ -38,7 +38,7 @@ bool cmd_bookmark_open(girara_session_t* session, girara_list_t* argument_list); ...@@ -38,7 +38,7 @@ bool cmd_bookmark_open(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_close(girara_session_t* session, girara_list_t* argument_list); bool cmd_close(girara_session_t* session, girara_list_t* argument_list);
...@@ -47,7 +47,7 @@ bool cmd_close(girara_session_t* session, girara_list_t* argument_list); ...@@ -47,7 +47,7 @@ bool cmd_close(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_info(girara_session_t* session, girara_list_t* argument_list); bool cmd_info(girara_session_t* session, girara_list_t* argument_list);
...@@ -56,7 +56,7 @@ bool cmd_info(girara_session_t* session, girara_list_t* argument_list); ...@@ -56,7 +56,7 @@ bool cmd_info(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_help(girara_session_t* session, girara_list_t* argument_list); bool cmd_help(girara_session_t* session, girara_list_t* argument_list);
...@@ -65,7 +65,7 @@ bool cmd_help(girara_session_t* session, girara_list_t* argument_list); ...@@ -65,7 +65,7 @@ bool cmd_help(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_hlsearch(girara_session_t* session, girara_list_t* argument_list); bool cmd_hlsearch(girara_session_t* session, girara_list_t* argument_list);
...@@ -74,7 +74,7 @@ bool cmd_hlsearch(girara_session_t* session, girara_list_t* argument_list); ...@@ -74,7 +74,7 @@ bool cmd_hlsearch(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_open(girara_session_t* session, girara_list_t* argument_list); bool cmd_open(girara_session_t* session, girara_list_t* argument_list);
...@@ -83,7 +83,7 @@ bool cmd_open(girara_session_t* session, girara_list_t* argument_list); ...@@ -83,7 +83,7 @@ bool cmd_open(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_print(girara_session_t* session, girara_list_t* argument_list); bool cmd_print(girara_session_t* session, girara_list_t* argument_list);
...@@ -92,7 +92,7 @@ bool cmd_print(girara_session_t* session, girara_list_t* argument_list); ...@@ -92,7 +92,7 @@ bool cmd_print(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_nohlsearch(girara_session_t* session, girara_list_t* argument_list); bool cmd_nohlsearch(girara_session_t* session, girara_list_t* argument_list);
...@@ -101,7 +101,7 @@ bool cmd_nohlsearch(girara_session_t* session, girara_list_t* argument_list); ...@@ -101,7 +101,7 @@ bool cmd_nohlsearch(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_quit(girara_session_t* session, girara_list_t* argument_list); bool cmd_quit(girara_session_t* session, girara_list_t* argument_list);
...@@ -110,7 +110,7 @@ bool cmd_quit(girara_session_t* session, girara_list_t* argument_list); ...@@ -110,7 +110,7 @@ bool cmd_quit(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_save(girara_session_t* session, girara_list_t* argument_list); bool cmd_save(girara_session_t* session, girara_list_t* argument_list);
...@@ -119,7 +119,7 @@ bool cmd_save(girara_session_t* session, girara_list_t* argument_list); ...@@ -119,7 +119,7 @@ bool cmd_save(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_savef(girara_session_t* session, girara_list_t* argument_list); bool cmd_savef(girara_session_t* session, girara_list_t* argument_list);
...@@ -129,7 +129,7 @@ bool cmd_savef(girara_session_t* session, girara_list_t* argument_list); ...@@ -129,7 +129,7 @@ bool cmd_savef(girara_session_t* session, girara_list_t* argument_list);
* @param session The used girara session * @param session The used girara session
* @param input The current input * @param input The current input
* @param argument Passed argument * @param argument Passed argument
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_search(girara_session_t* session, const char* input, girara_argument_t* argument); bool cmd_search(girara_session_t* session, const char* input, girara_argument_t* argument);
...@@ -138,7 +138,7 @@ bool cmd_search(girara_session_t* session, const char* input, girara_argument_t* ...@@ -138,7 +138,7 @@ bool cmd_search(girara_session_t* session, const char* input, girara_argument_t*
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_export(girara_session_t* session, girara_list_t* argument_list); bool cmd_export(girara_session_t* session, girara_list_t* argument_list);
...@@ -147,7 +147,7 @@ bool cmd_export(girara_session_t* session, girara_list_t* argument_list); ...@@ -147,7 +147,7 @@ bool cmd_export(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_exec(girara_session_t* session, girara_list_t* argument_list); bool cmd_exec(girara_session_t* session, girara_list_t* argument_list);
...@@ -156,7 +156,7 @@ bool cmd_exec(girara_session_t* session, girara_list_t* argument_list); ...@@ -156,7 +156,7 @@ bool cmd_exec(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_offset(girara_session_t* session, girara_list_t* argument_list); bool cmd_offset(girara_session_t* session, girara_list_t* argument_list);
...@@ -165,7 +165,7 @@ bool cmd_offset(girara_session_t* session, girara_list_t* argument_list); ...@@ -165,7 +165,7 @@ bool cmd_offset(girara_session_t* session, girara_list_t* argument_list);
* *
* @param session The used girara session * @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return true if no error occured * @return true if no error occurred
*/ */
bool cmd_version(girara_session_t* session, girara_list_t* argument_list); bool cmd_version(girara_session_t* session, girara_list_t* argument_list);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* @param session The used girara session * @param session The used girara session
* @param input The current input * @param input The current input
* @return The completion object or NULL if an error occured * @return The completion object or NULL if an error occurred
*/ */
girara_completion_t* cc_open(girara_session_t* session, const char* input); girara_completion_t* cc_open(girara_session_t* session, const char* input);
...@@ -21,7 +21,7 @@ girara_completion_t* cc_open(girara_session_t* session, const char* input); ...@@ -21,7 +21,7 @@ girara_completion_t* cc_open(girara_session_t* session, const char* input);
* *
* @param session The used girara session * @param session The used girara session
* @param input The current input * @param input The current input
* @return The completion object or NULL if an error occured * @return The completion object or NULL if an error occurred
*/ */
girara_completion_t* cc_write(girara_session_t* session, const char* input); girara_completion_t* cc_write(girara_session_t* session, const char* input);
...@@ -30,7 +30,7 @@ girara_completion_t* cc_write(girara_session_t* session, const char* input); ...@@ -30,7 +30,7 @@ girara_completion_t* cc_write(girara_session_t* session, const char* input);
* *
* @param session The used girara session * @param session The used girara session
* @param input The current input * @param input The current input
* @return The completion object or NULL if an error occured * @return The completion object or NULL if an error occurred
*/ */
girara_completion_t* cc_bookmarks(girara_session_t* session, const char* input); girara_completion_t* cc_bookmarks(girara_session_t* session, const char* input);
......
...@@ -466,6 +466,8 @@ config_load_default(zathura_t* zathura) ...@@ -466,6 +466,8 @@ config_load_default(zathura_t* zathura)
girara_shortcut_mapping_add(gsession, "goto", sc_goto); girara_shortcut_mapping_add(gsession, "goto", sc_goto);
girara_shortcut_mapping_add(gsession, "jumplist", sc_jumplist); girara_shortcut_mapping_add(gsession, "jumplist", sc_jumplist);
girara_shortcut_mapping_add(gsession, "bisect", sc_bisect); girara_shortcut_mapping_add(gsession, "bisect", sc_bisect);
girara_shortcut_mapping_add(gsession, "mark_add", sc_mark_add);
girara_shortcut_mapping_add(gsession, "mark_evaluate", sc_mark_evaluate);
girara_shortcut_mapping_add(gsession, "navigate", sc_navigate); girara_shortcut_mapping_add(gsession, "navigate", sc_navigate);
girara_shortcut_mapping_add(gsession, "navigate_index", sc_navigate_index); girara_shortcut_mapping_add(gsession, "navigate_index", sc_navigate_index);
girara_shortcut_mapping_add(gsession, "print", sc_print); girara_shortcut_mapping_add(gsession, "print", sc_print);
......
...@@ -17,14 +17,23 @@ ...@@ -17,14 +17,23 @@
#include <glib.h> #include <glib.h>
#include <gio/gio.h> #include <gio/gio.h>
/** Read a most GT_MAX_READ bytes before falling back to file. */ struct zathura_content_type_context_s
static const size_t GT_MAX_READ = 1 << 16; {
#ifdef WITH_MAGIC #ifdef WITH_MAGIC
static const char* magic_t magic;
guess_type_magic(const char* path) { #endif
const char* mime_type = NULL; };
zathura_content_type_context_t*
zathura_content_type_new(void)
{
zathura_content_type_context_t* context =
g_try_malloc0(sizeof(zathura_content_type_context_t));
if (context == NULL) {
return NULL;
}
#ifdef WITH_MAGIC
/* creat magic cookie */ /* creat magic cookie */
const int flags = const int flags =
MAGIC_MIME_TYPE | MAGIC_MIME_TYPE |
...@@ -36,46 +45,78 @@ guess_type_magic(const char* path) { ...@@ -36,46 +45,78 @@ guess_type_magic(const char* path) {
magic_t magic = magic_open(flags); magic_t magic = magic_open(flags);
if (magic == NULL) { if (magic == NULL) {
girara_debug("failed creating the magic cookie"); girara_debug("failed creating the magic cookie");
goto cleanup; return context;
} }
/* ... and load mime database */ /* ... and load mime database */
if (magic_load(magic, NULL) < 0) { if (magic_load(magic, NULL) < 0) {
girara_debug("failed loading the magic database: %s", magic_error(magic)); girara_debug("failed loading the magic database: %s", magic_error(magic));
goto cleanup; magic_close(magic);
return context;
} }
/* get the mime type */ context->magic = magic;
mime_type = magic_file(magic, path); #endif
if (mime_type == NULL) {
girara_debug("failed guessing filetype: %s", magic_error(magic)); return context;
goto cleanup; }
void
zathura_content_type_free(zathura_content_type_context_t* context)
{
if (context == NULL) {
return;
} }
/* dup so we own the memory */
mime_type = g_strdup(mime_type);
girara_debug("magic detected filetype: %s", mime_type); #ifdef WITH_MAGIC
if (context->magic != NULL) {
magic_close(context->magic);
}
#endif
cleanup: g_free(context);
if (magic != NULL) { }
magic_close(magic);
/** Read a most GT_MAX_READ bytes before falling back to file. */
static const size_t GT_MAX_READ = 1 << 16;