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
warranty. In no event will the authors be held liable for any damages
......
......@@ -12,7 +12,7 @@ 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)
libsynctex from TeXLive (optional, for SyncTeX support)
Sphinx (optional, for manpages and HTML documentation)
doxygen (optional, for HTML documentation)
breathe (optional, for HTML documentation)
......
......@@ -6,7 +6,7 @@ PROJECT = zathura
ZATHURA_VERSION_MAJOR = 0
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.
ZATHURA_API_VERSION = 2
# If the ABI breaks for any reason, this has to be bumped.
......
......@@ -6,7 +6,7 @@ include ../colors.mk
include config.mk
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
SPHINX_OPTS+=-d $(SPHINX_BUILDDIR)/doctrees
......@@ -18,15 +18,17 @@ clean:
$(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 $(SPHINX_BUILDDIR)/zathurarc.5: $(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)/doxygen/xml/index.xml: $(DOXYGEN_SOURCES)
$(QUIET)mkdir -p $(SPHINX_BUILDDIR)
$(QUIET)mkdir -p $(SPHINX_BUILDDIR)/doxygen/xml
$(call colorecho,DOC,"Run doxygen")
$(QUIET)$(DOXYGEN_BIN) Doxyfile
......
.\" 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
zathura \- a document viewer
.
......@@ -33,7 +33,8 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.SH SYNOPSIS
.sp
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
.sp
\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.
.TP
.BI \-\-synctex\-forward\fB= input
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
.B \-\-fork
Fork into background
......@@ -313,9 +320,6 @@ Execute an external command
.B info
Show document information
.TP
.B help
Show help page
.TP
.B open
Open a document
.TP
......@@ -342,8 +346,8 @@ description please consult zathurarc(5).
.SH SYNCTEX SUPPORT
.sp
Both synctex forward and backwards synchronization are supported by zathura, To
enable synctex forward synchronization, please look at the \fI\-\-syntex\fP and
\fI\-\-synctex\-editor\fP options. zathura will also emit a signal via the D\-Bus
enable synctex forward synchronization, please look at the \fI\-\-synctex\-forward\fP
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
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
......
.\" 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
zathurarc \- zathura configuration file
.
......@@ -403,6 +403,12 @@ Show or hide statusbar.
\fBzoom\fP
.sp
Zoom in or out.
.IP \(bu 2
\fBmark_add\fP
Set a quickmark.
.IP \(bu 2
\fBmark_evaluate\fP
Go to a quickmark.
.UNINDENT
.SS Pass arguments
.sp
......@@ -605,8 +611,8 @@ Default value: monospace normal 9
Shows or hides GUI elements.
If it contains \(aqc\(aq, the command line is displayed.
If it contains \(aqs\(aq, the statusbar is displayed.
If it contains \(aqh\(aq, the vertical scrollbar is displayed.
If it contains \(aqv\(aq, the horizontal scrollbar is displayed.
If it contains \(aqh\(aq, the horizontal scrollbar is displayed.
If it contains \(aqv\(aq, the vertical scrollbar is displayed.
.INDENT 0.0
.IP \(bu 2
Value type: String
......
......@@ -16,9 +16,6 @@ exec
info
Show document information
help
Show help page
open
Open a document
......
......@@ -28,7 +28,13 @@
--synctex-forward=input
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 into background
......
Both synctex forward and backwards synchronization are supported by zathura, To
enable synctex forward synchronization, please look at the *--syntex* and
*--synctex-editor* options. zathura will also emit a signal via the D-Bus
enable synctex forward synchronization, please look at the *--synctex-forward*
and *--synctex-editor* options. zathura will also emit a signal via the D-Bus
interface. To support synctex backwards synchronization, zathura provides a
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
......
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:
Zoom in or out.
* ``mark_add``
Set a quickmark.
* ``mark_evaluate``
Go to a quickmark.
Pass arguments
^^^^^^^^^^^^^^
Some shortcut function require or have optional arguments which influence the
......@@ -454,8 +461,8 @@ guioptions
Shows or hides GUI elements.
If it contains 'c', the command line is displayed.
If it contains 's', the statusbar is displayed.
If it contains 'h', the vertical scrollbar is displayed.
If it contains 'v', the horizontal scrollbar is displayed.
If it contains 'h', the horizontal scrollbar is displayed.
If it contains 'v', the vertical scrollbar is displayed.
* Value type: String
* Default value: s
......
......@@ -19,10 +19,10 @@ all: ${MOS}
clean:
$(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 && \
for f in $(^F) ; do \
echo girara/$$f >> $@.tmp ; \
echo zathura/$$f >> $@.tmp ; \
done && \
mv $@.tmp $@
......
......@@ -5,9 +5,10 @@
#include "document.h"
START_TEST(test_open) {
fail_unless(zathura_document_open(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", "pw", 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) == 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
Suite* suite_document()
......
......@@ -16,7 +16,7 @@
*
* @param widget The gtk window of zathura
* @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);
......@@ -108,7 +108,7 @@ void cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
*
* @param entry The dialog inputbar
* @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);
......@@ -117,7 +117,7 @@ bool cb_sc_follow(GtkEntry* entry, girara_session_t* session);
*
* @param entry The dialog inputbar
* @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);
......
......@@ -11,7 +11,7 @@
*
* @param session The used girara session
* @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);
......@@ -20,7 +20,7 @@ bool cmd_bookmark_create(girara_session_t* session, girara_list_t* argument_list
*
* @param session The used girara session
* @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);
......@@ -29,7 +29,7 @@ bool cmd_bookmark_delete(girara_session_t* session, girara_list_t* argument_list
*
* @param session The used girara session
* @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);
......@@ -38,7 +38,7 @@ bool cmd_bookmark_open(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -47,7 +47,7 @@ bool cmd_close(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -56,7 +56,7 @@ bool cmd_info(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -65,7 +65,7 @@ bool cmd_help(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -74,7 +74,7 @@ bool cmd_hlsearch(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -83,7 +83,7 @@ bool cmd_open(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -92,7 +92,7 @@ bool cmd_print(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -101,7 +101,7 @@ bool cmd_nohlsearch(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -110,7 +110,7 @@ bool cmd_quit(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -119,7 +119,7 @@ bool cmd_save(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -129,7 +129,7 @@ bool cmd_savef(girara_session_t* session, girara_list_t* argument_list);
* @param session The used girara session
* @param input The current input
* @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);
......@@ -138,7 +138,7 @@ bool cmd_search(girara_session_t* session, const char* input, girara_argument_t*
*
* @param session The used girara session
* @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);
......@@ -147,7 +147,7 @@ bool cmd_export(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -156,7 +156,7 @@ bool cmd_exec(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......@@ -165,7 +165,7 @@ bool cmd_offset(girara_session_t* session, girara_list_t* argument_list);
*
* @param session The used girara session
* @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);
......
......@@ -11,7 +11,7 @@
*
* @param session The used girara session
* @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);
......@@ -21,7 +21,7 @@ girara_completion_t* cc_open(girara_session_t* session, const char* input);
*
* @param session The used girara session
* @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);
......@@ -30,7 +30,7 @@ girara_completion_t* cc_write(girara_session_t* session, const char* input);
*
* @param session The used girara session
* @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);
......
......@@ -466,6 +466,8 @@ config_load_default(zathura_t* zathura)
girara_shortcut_mapping_add(gsession, "goto", sc_goto);
girara_shortcut_mapping_add(gsession, "jumplist", sc_jumplist);
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_index", sc_navigate_index);
girara_shortcut_mapping_add(gsession, "print", sc_print);
......
......@@ -17,14 +17,23 @@
#include <glib.h>
#include <gio/gio.h>
/** Read a most GT_MAX_READ bytes before falling back to file. */
static const size_t GT_MAX_READ = 1 << 16;
struct zathura_content_type_context_s
{
#ifdef WITH_MAGIC
static const char*
guess_type_magic(const char* path) {
const char* mime_type = NULL;
magic_t magic;
#endif
};
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 */
const int flags =
MAGIC_MIME_TYPE |
......@@ -36,46 +45,78 @@ guess_type_magic(const char* path) {
magic_t magic = magic_open(flags);
if (magic == NULL) {
girara_debug("failed creating the magic cookie");
goto cleanup;
return context;
}
/* ... and load mime database */
if (magic_load(magic, NULL) < 0) {
girara_debug("failed loading the magic database: %s", magic_error(magic));
goto cleanup;
magic_close(magic);
return context;
}
/* get the mime type */
mime_type = magic_file(magic, path);
if (mime_type == NULL) {
girara_debug("failed guessing filetype: %s", magic_error(magic));
goto cleanup;
context->magic = magic;
#endif
return context;
}
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:
if (magic != NULL) {
magic_close(magic);
g_free(context);
}
/** Read a most GT_MAX_READ bytes before falling back to file. */
static const size_t GT_MAX_READ = 1 << 16;
#ifdef WITH_MAGIC
static char*
guess_type_magic(zathura_content_type_context_t* context, const char* path)
{
if (context == NULL || context->magic == NULL) {
return NULL;
}
const char* mime_type = NULL;
/* get the mime type */
mime_type = magic_file(context->magic, path);
if (mime_type == NULL) {
girara_debug("failed guessing filetype: %s", magic_error(context->magic));
return NULL;
}
girara_debug("magic detected filetype: %s", mime_type);
return mime_type;
/* dup so we own the memory */
return g_strdup(mime_type);;
}
static const char*
static char*
guess_type_file(const char* UNUSED(path))
{
return NULL;
}
#else
static const char*
guess_type_magic(const char* UNUSED(path)) {
guess_type_magic(zathura_content_type_context_t* UNUSED(context),
const char* UNUSED(path))
{
return NULL;
}
static const char*
static char*
guess_type_file(const char* path)
{
GString* command = g_string_new("file -b --mime-type ");
......@@ -106,11 +147,11 @@ guess_type_file(const char* path)
}
#endif
static const char*
static char*
guess_type_glib(const char* path)
{
gboolean uncertain = FALSE;
const char* content_type = g_content_type_guess(path, NULL, 0, &uncertain);
char* content_type = g_content_type_guess(path, NULL, 0, &uncertain);
if (content_type == NULL) {
girara_debug("g_content_type failed\n");
} else {
......@@ -160,11 +201,12 @@ guess_type_glib(const char* path)
return NULL;
}
const char*
guess_content_type(const char* path)
char*
zathura_content_type_guess(zathura_content_type_context_t* context,
const char* path)
{
/* try libmagic first */
const char* content_type = guess_type_magic(path);
char* content_type = guess_type_magic(context, path);
if (content_type != NULL) {
return content_type;
}
......
......@@ -3,13 +3,30 @@
#ifndef ZATHURA_CONTENT_TYPE_H
#define ZATHURA_CONTENT_TYPE_H
#include "types.h"
/**
* Create new context for MIME type detection.
*
* @return new context
*/
zathura_content_type_context_t* zathura_content_type_new(void);
/**
* Free MIME type detection context.
*
* @param context The context.
*/
void zathura_content_type_free(zathura_content_type_context_t* context);
/**
* "Guess" the content type of a file. Various methods are tried depending on
* the available libraries.
*
* @param path file name
* @return content type of path
* @return content type of path, needs to freeed with g_free.
*/
const char* guess_content_type(const char* path);
char* zathura_content_type_guess(zathura_content_type_context_t* context,
const char* path);
#endif
......@@ -469,7 +469,7 @@ iterate_instances_call_synctex_view(const char* filename,
const bool ret = call_synctex_view(connection, filename, well_known_name,
input_file, line, column);
g_free(well_known_name);
return ret ? 1 : 0;
return ret ? 1 : -1;
}
GVariant* vnames = g_dbus_connection_call_sync(
......
......@@ -61,16 +61,16 @@ check_set_error(zathura_error_t* error, zathura_error_t code) {
}
zathura_document_t*
zathura_document_open(zathura_plugin_manager_t* plugin_manager, const char*
path, const char *uri, const char* password, zathura_error_t* error)
zathura_document_open(zathura_t* zathura, const char* path, const char* uri,
const char* password, zathura_error_t* error)
{
if (path == NULL) {
if (zathura == NULL || path == NULL) {
return NULL;
}
GFile* file = g_file_new_for_path(path);
char* real_path = NULL;
const char* content_type = NULL;
char* content_type = NULL;
zathura_plugin_t* plugin = NULL;
zathura_document_t* document = NULL;
......@@ -87,14 +87,14 @@ zathura_document_open(zathura_plugin_manager_t* plugin_manager, const char*
goto error_free;
}
content_type = guess_content_type(real_path);
content_type = zathura_content_type_guess(zathura->content_type_context, real_path);
if (content_type == NULL) {
girara_error("Could not determine file type.");
check_set_error(error, ZATHURA_ERROR_UNKNOWN);
goto error_free;
}
plugin = zathura_plugin_manager_get_plugin(plugin_manager, content_type);
plugin = zathura_plugin_manager_get_plugin(zathura->plugins.manager, content_type);
if (plugin == NULL) {
girara_error("Unknown file type: '%s'", content_type);
......@@ -106,7 +106,7 @@ zathura_document_open(zathura_plugin_manager_t* plugin_manager, const char*
goto error_free;
}
g_free((void*)content_type);
g_free(content_type);
content_type = NULL;
document = g_try_malloc0(sizeof(zathura_document_t));
......
......@@ -11,21 +11,21 @@
/**
* Open the document
*
* @param plugin_manager The plugin manager
* @param plugin_manager The zathura instance
* @param path Path to the document
* @param password Password of the document or NULL
* @param error Optional error parameter
* @return The document object and NULL if an error occurs
*/
zathura_document_t* zathura_document_open(zathura_plugin_manager_t*
plugin_manager, const char* path, const char *uri, const char* password, zathura_error_t*
zathura_document_t* zathura_document_open(zathura_t* zathura,
const char* path, const char *uri, const char* password, zathura_error_t*
error);
/**
* Free the document
*
* @param document
* @return ZATHURA_ERROR_OK when no error occured, otherwise see
* @return ZATHURA_ERROR_OK when no error occurred, otherwise see
* zathura_error_t
*/
zathura_error_t zathura_document_free(zathura_document_t* document);
......@@ -67,7 +67,7 @@ const char* zathura_document_get_password(zathura_document_t* document);
*
* @param document The document
* @param index The index of the page
* @return The page or NULL if an error occured
* @return The page or NULL if an error occurred
*/
zathura_page_t* zathura_document_get_page(zathura_document_t* document, unsigned int index);
......@@ -283,7 +283,7 @@ void zathura_document_set_page_layout(zathura_document_t* document, unsigned int
unsigned int pages_per_row, unsigned int first_page_column);
/**
* Returns the padding in pixels betwen pages
* Returns the padding in pixels between pages
*
* @param document The document
* @return The padding in pixels between pages
......@@ -311,7 +311,7 @@ unsigned int zathura_document_get_first_page_column(zathura_document_t* document
*
* @param document The document object
* @param path Path for the saved file
* @return ZATHURA_ERROR_OK when no error occured, otherwise see
* @return ZATHURA_ERROR_OK when no error occurred, otherwise see
* zathura_error_t
*/
zathura_error_t zathura_document_save_as(zathura_document_t* document, const char* path);
......@@ -321,7 +321,7 @@ zathura_error_t zathura_document_save_as(zathura_document_t* document, const cha
*
* @param document The document object
* @param error Set to an error value (see \ref zathura_error_t) if an
* error occured
* error occurred
* @return Generated index
*/
......@@ -332,7 +332,7 @@ girara_tree_node_t* zathura_document_index_generate(zathura_document_t* document
*
* @param document The document object
* @param error Set to an error value (see \ref zathura_error_t) if an
* error occured