Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Marius
zathura
Commits
a7b3d73f
Commit
a7b3d73f
authored
Feb 17, 2014
by
Moritz Lipp
Browse files
Merge branch 'release/0.2.7'
parents
6d22f33f
0f005c0d
Changes
66
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
a7b3d73f
...
...
@@ -18,3 +18,4 @@ doc/
zathura.1
zathurarc.5
.version-checks/
dbus-interface-definitions.c
LICENSE
View file @
a7b3d73f
Copyright (c) 2009-201
3
pwmt.org
Copyright (c) 2009-201
4
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
...
...
Makefile
View file @
a7b3d73f
...
...
@@ -4,22 +4,22 @@ include config.mk
include
common.mk
PROJECT
=
zathura
OSOURCE
=
$(
wildcard
*
.c
)
OSOURCE
=
$(
filter-out
dbus-interface-definitions.c,
$(
wildcard
*
.c
)
)
HEADER
=
$(
wildcard
*
.h
)
HEADERINST
=
version.h document.h macros.h page.h types.h plugin-api.h links.h
ifneq
(${WITH_SQLITE},0)
INCS
+=
$(SQLITE_INC)
LIBS
+=
$(SQLITE_LIB)
SOURCE
=
$(OSOURCE)
INCS
+=
$(SQLITE_INC)
LIBS
+=
$(SQLITE_LIB)
SOURCE
=
$(OSOURCE)
CPPFLAGS
+=
-DWITH_SQLITE
else
SOURCE
=
$(
filter-out
database-sqlite.c,
$(OSOURCE)
)
SOURCE
=
$(
filter-out
database-sqlite.c,
$(OSOURCE)
)
endif
ifneq
($(WITH_MAGIC),0)
INCS
+=
$(MAGIC_INC)
LIBS
+=
$(MAGIC_LIB)
INCS
+=
$(MAGIC_INC)
LIBS
+=
$(MAGIC_LIB)
CPPFLAGS
+=
-DWITH_MAGIC
endif
...
...
@@ -37,13 +37,13 @@ ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS}))
CPPFLAGS
+=
-DLOCALEDIR
=
\"
${LOCALEDIR}
\"
endif
OBJECTS
=
$(
patsubst
%.c, %.o,
$(SOURCE)
)
DOBJECTS
=
$(
patsubst
%.
c
, %.do,
$(
SOURCE
)
)
OBJECTS
=
$(
patsubst
%.c, %.o,
$(SOURCE)
)
dbus-interface-definitions.o
DOBJECTS
=
$(
patsubst
%.
o
, %.do,
$(
OBJECTS
)
)
all
:
options ${PROJECT} po build-manpages
# pkg-config based version checks
.version-checks/%
:
.version-checks/%
:
config.mk
$(QUIET)
test
$
(
$
(
*
)
_VERSION_CHECK
)
-eq
0
||
\
pkg-config
--atleast-version
$
(
$
(
*
)
_MIN_VERSION
)
$
(
$
(
*
)
_PKG_CONFIG_NAME
)
||
(
\
echo
"The minium required version of
$
(*) is
$
(
$
(*)_MIN_VERSION)"
&&
\
...
...
@@ -64,7 +64,15 @@ version.h: version.h.in config.mk
-e
's/ZVMINOR/
${ZATHURA_VERSION_MINOR}
/'
\
-e
's/ZVREV/
${ZATHURA_VERSION_REV}
/'
\
-e
's/ZVAPI/
${ZATHURA_API_VERSION}
/'
\
-e
's/ZVABI/
${ZATHURA_ABI_VERSION}
/'
version.h.in
>
version.h
-e
's/ZVABI/
${ZATHURA_ABI_VERSION}
/'
version.h.in
>
version.h.tmp
$(QUIET)
mv
version.h.tmp version.h
dbus-interface-definitions.c
:
data/org.pwmt.zathura.xml
$(QUIET)
echo
'#include "dbus-interface-definitions.h"'
>
dbus-interface-definitions.c.tmp
$(QUIET)
echo
'const char* DBUS_INTERFACE_XML ='
>>
dbus-interface-definitions.c.tmp
$(QUIET)
sed
's/^\(.*\)$$/"\1\\n"/'
data/org.pwmt.zathura.xml
>>
dbus-interface-definitions.c.tmp
$(QUIET)
echo
';'
>>
dbus-interface-definitions.c.tmp
$(QUIET)
mv
dbus-interface-definitions.c.tmp dbus-interface-definitions.c
%.o
:
%.c
$(ECHO)
CC
$<
...
...
@@ -84,8 +92,18 @@ ${PROJECT}: ${OBJECTS}
$(QUIET)${CC}
${SFLAGS}
${LDFLAGS}
-o
$@
${OBJECTS}
${LIBS}
clean
:
$(QUIET)
rm
-rf
${PROJECT}
${OBJECTS}
${PROJECT}
-
${VERSION}
.tar.gz
\
${DOBJECTS}
${PROJECT}
-debug
.depend
${PROJECT}
.pc doc version.h
\
$(QUIET)
rm
-rf
${PROJECT}
\
${OBJECTS}
\
${PROJECT}
-
${VERSION}
.tar.gz
\
${DOBJECTS}
\
${PROJECT}
-debug
\
.depend
\
${PROJECT}
.pc
\
doc
\
version.h
\
version.h.tmp
\
dbus-interface-definitions.c
\
dbus-interface-definitions.c.tmp
\
*
gcda
*
gcno
$(PROJECT)
.info gcov
*
.tmp
\
.version-checks
ifneq
"$(wildcard ${RSTTOMAN})" ""
...
...
@@ -107,7 +125,7 @@ ${PROJECT}.pc: ${PROJECT}.pc.in config.mk
$(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
$(QUIET)
echo
GTK_VERSION
=
3
>>
${PROJECT}
.pc
$(QUIET)
cat
${PROJECT}
.pc.in
>>
${PROJECT}
.pc
valgrind
:
debug
...
...
@@ -129,6 +147,7 @@ dist: clean build-manpages
${PROJECT}
.desktop version.h.in
\
${PROJECT}
.1
${PROJECT}
rc.5
\
${PROJECT}
-
${VERSION}
$(QUIET)
cp
-r
data
${PROJECT}
-
${VERSION}
$(QUIET)
cp
tests/Makefile tests/config.mk tests/
*
.c
\
${PROJECT}
-
${VERSION}
/tests
$(QUIET)
cp
po/Makefile po/
*
.po
${PROJECT}
-
${VERSION}
/po
...
...
@@ -184,7 +203,12 @@ install-headers: ${PROJECT}.pc
$(QUIET)
mkdir
-m
755
-p
${DESTDIR}${LIBDIR}
/pkgconfig
$(QUIET)
install
-m
644
${PROJECT}
.pc
${DESTDIR}${LIBDIR}
/pkgconfig
install
:
all install-headers install-manpages
install-dbus
:
$(ECHO)
installing D-Bus interface definitions
$(QUIET)
mkdir
-m
755
-p
$(DESTDIR)$(DBUSINTERFACEDIR)
$(QUIET)
install
-m
644 data/org.pwmt.zathura.xml
$(DESTDIR)$(DBUSINTERFACEDIR)
install
:
all install-headers install-manpages install-dbus
$(ECHO)
installing executable file
$(QUIET)
mkdir
-m
755
-p
${DESTDIR}${PREFIX}
/bin
$(QUIET)
install
-m
755
${PROJECT}
${DESTDIR}${PREFIX}
/bin
...
...
@@ -207,9 +231,12 @@ uninstall: uninstall-headers
$(QUIET)
rm
-f
${DESTDIR}${MANPREFIX}
/man5/
${PROJECT}
rc.5
$(ECHO)
removing desktop file
$(QUIET)
rm
-f
${DESTDIR}${DESKTOPPREFIX}
/
${PROJECT}
.desktop
$(ECHO)
removing D-Bus interface definitions
$(QUIET)
rm
-f
$(DESTDIR)$(DBUSINTERFACEDIR)
/org.pwmt.zathura.xml
$(MAKE)
-C
po 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 install-manpages build-manpages
.PHONY
:
all options clean doc debug valgrind gdb dist doc install uninstall
\
test po install-headers uninstall-headers update-po install-manpages
\
build-manpages install-dbus
README
View file @
a7b3d73f
...
...
@@ -5,9 +5,9 @@ girara user interface library and several document libraries.
Requirements
------------
gtk2 (>= 2.18) or
gtk3
gtk3
glib (>= 2.28)
girara
girara
(>= 0.1.8)
sqlite3 (optional, >= 3.5.9)
check (for tests)
intltool
...
...
adjustment.c
View file @
a7b3d73f
...
...
@@ -146,20 +146,6 @@ page_is_visible(zathura_document_t *document, unsigned int page_number)
fabs
(
pos_y
-
page_y
)
<
0
.
5
*
(
double
)(
view_height
+
cell_height
)
/
(
double
)
doc_height
);
}
GtkAdjustment
*
zathura_adjustment_clone
(
GtkAdjustment
*
adjustment
)
{
gdouble
value
=
gtk_adjustment_get_value
(
adjustment
);
gdouble
lower
=
gtk_adjustment_get_lower
(
adjustment
);
gdouble
upper
=
gtk_adjustment_get_upper
(
adjustment
);
gdouble
step_increment
=
gtk_adjustment_get_step_increment
(
adjustment
);
gdouble
page_increment
=
gtk_adjustment_get_page_increment
(
adjustment
);
gdouble
page_size
=
gtk_adjustment_get_page_size
(
adjustment
);
return
GTK_ADJUSTMENT
(
gtk_adjustment_new
(
value
,
lower
,
upper
,
step_increment
,
page_increment
,
page_size
));
}
void
zathura_adjustment_set_value
(
GtkAdjustment
*
adjustment
,
gdouble
value
)
{
...
...
adjustment.h
View file @
a7b3d73f
...
...
@@ -69,17 +69,6 @@ void page_number_to_position(zathura_document_t* document, unsigned int page_num
*/
bool
page_is_visible
(
zathura_document_t
*
document
,
unsigned
int
page_number
);
/**
* Clone a GtkAdjustment
*
* Creates a new adjustment with the same value, lower and upper bounds, step
* and page increments and page_size as the original adjustment.
*
* @param adjustment Adjustment instance to be cloned
* @return Pointer to the new adjustment
*/
GtkAdjustment
*
zathura_adjustment_clone
(
GtkAdjustment
*
adjustment
);
/**
* Set the adjustment value while enforcing its limits
*
...
...
bookmarks.c
View file @
a7b3d73f
...
...
@@ -48,7 +48,10 @@ zathura_bookmark_add(zathura_t* zathura, const gchar* id, unsigned int page)
return
old
;
}
zathura_bookmark_t
*
bookmark
=
g_malloc0
(
sizeof
(
zathura_bookmark_t
));
zathura_bookmark_t
*
bookmark
=
g_try_malloc0
(
sizeof
(
zathura_bookmark_t
));
if
(
bookmark
==
NULL
)
{
return
NULL
;
}
bookmark
->
id
=
g_strdup
(
id
);
bookmark
->
page
=
page
;
...
...
callbacks.c
View file @
a7b3d73f
...
...
@@ -50,7 +50,8 @@ cb_buffer_changed(girara_session_t* session)
}
static
void
update_visible_pages
(
zathura_t
*
zathura
)
{
update_visible_pages
(
zathura_t
*
zathura
)
{
const
unsigned
int
number_of_pages
=
zathura_document_get_number_of_pages
(
zathura
->
document
);
for
(
unsigned
int
page_id
=
0
;
page_id
<
number_of_pages
;
page_id
++
)
{
...
...
@@ -539,6 +540,11 @@ cb_page_widget_text_selected(ZathuraPage* page, const char* text, void* data)
g_return_if_fail
(
data
!=
NULL
);
zathura_t
*
zathura
=
data
;
girara_mode_t
mode
=
girara_mode_get
(
zathura
->
ui
.
session
);
if
(
mode
!=
zathura
->
modes
.
normal
&&
mode
!=
zathura
->
modes
.
fullscreen
)
{
return
;
}
GdkAtom
*
selection
=
get_selection
(
zathura
);
/* copy to clipboard */
...
...
commands.c
View file @
a7b3d73f
...
...
@@ -239,7 +239,7 @@ cmd_open(girara_session_t* session, girara_list_t* argument_list)
}
document_open
(
zathura
,
girara_list_nth
(
argument_list
,
0
),
(
argc
==
2
)
?
girara_list_nth
(
argument_list
,
1
)
:
NULL
,
(
argc
==
2
)
?
girara_list_nth
(
argument_list
,
1
)
:
NULL
,
ZATHURA_PAGE_NUMBER_UNSPECIFIED
);
}
else
{
girara_notify
(
session
,
GIRARA_ERROR
,
_
(
"No arguments given."
));
...
...
@@ -400,7 +400,10 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
}
}
girara_argument_t
*
arg
=
g_malloc0
(
sizeof
(
girara_argument_t
));
girara_argument_t
*
arg
=
g_try_malloc0
(
sizeof
(
girara_argument_t
));
if
(
arg
==
NULL
)
{
return
false
;
}
arg
->
n
=
FORWARD
;
sc_search
(
session
,
arg
,
NULL
,
0
);
...
...
config.c
View file @
a7b3d73f
This diff is collapsed.
Click to expand it.
config.h
View file @
a7b3d73f
...
...
@@ -3,9 +3,6 @@
#ifndef CONFIG_H
#define CONFIG_H
#define GLOBAL_RC "/etc/zathurarc"
#define ZATHURA_RC "zathurarc"
#include "zathura.h"
/**
...
...
@@ -21,6 +18,6 @@ void config_load_default(zathura_t* zathura);
* @param zathura The zathura session
* @param path Path to the configuration file
*/
void
config_load_file
(
zathura_t
*
zathura
,
char
*
path
);
void
config_load_file
s
(
zathura_t
*
zathura
);
#endif // CONFIG_H
config.mk
View file @
a7b3d73f
...
...
@@ -3,31 +3,28 @@
ZATHURA_VERSION_MAJOR
=
0
ZATHURA_VERSION_MINOR
=
2
ZATHURA_VERSION_REV
=
6
ZATHURA_VERSION_REV
=
7
# 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.
ZATHURA_ABI_VERSION
=
2
VERSION
=
${ZATHURA_VERSION_MAJOR}
.
${ZATHURA_VERSION_MINOR}
.
${ZATHURA_VERSION_REV}
# the GTK+ version to use
ZATHURA_GTK_VERSION
?=
3
# version checks
# If you want to disable any of the checks, set *_VERSION_CHECK to 0.
# girara
GIRARA_VERSION_CHECK
?=
1
GIRARA_MIN_VERSION
=
0.1.8
GIRARA_PKG_CONFIG_NAME
=
girara-gtk
$(ZATHURA_GTK_VERSION)
GIRARA_PKG_CONFIG_NAME
=
girara-gtk
3
# glib
GLIB_VERSION_CHECK
?=
1
GLIB_MIN_VERSION
=
2.28
GLIB_PKG_CONFIG_NAME
=
glib-2.0
# GTK
GTK_VERSION_CHECK
?=
1
GTK_MIN_VERSION
=
2.18
GTK_PKG_CONFIG_NAME
=
gtk+-
$(ZATHURA_GTK_VERSION)
.0
GTK_MIN_VERSION
=
3.0
GTK_PKG_CONFIG_NAME
=
gtk+-
3
.0
# database
# To disable support for the sqlite backend set WITH_SQLITE to 0.
...
...
@@ -43,6 +40,8 @@ MANPREFIX ?= ${PREFIX}/share/man
DESKTOPPREFIX
?=
${PREFIX}
/share/applications
LIBDIR
?=
${PREFIX}
/lib
INCLUDEDIR
?=
${PREFIX}
/include
DBUSINTERFACEDIR
?=
${PREFIX}
/share/dbus-1/interfaces
VIMFTPLUGINDIR
?=
${PREFIX}
/share/vim/addons/ftplugin
# plugin directory
PLUGINDIR
?=
${LIBDIR}
/zathura
...
...
@@ -53,8 +52,8 @@ LOCALEDIR ?= ${PREFIX}/share/locale
RSTTOMAN
?=
/usr/bin/rst2man
# libs
GTK_INC
?=
$(
shell
pkg-config
--cflags
gtk+-
${ZATHURA_GTK_VERSION}
.0
)
GTK_LIB
?=
$(
shell
pkg-config
--libs
gtk+-
${ZATHURA_GTK_VERSION}
.0
)
GTK_INC
?=
$(
shell
pkg-config
--cflags
gtk+-
3
.0
)
GTK_LIB
?=
$(
shell
pkg-config
--libs
gtk+-
3
.0
)
GTHREAD_INC
?=
$(
shell
pkg-config
--cflags
gthread-2.0
)
GTHREAD_LIB
?=
$(
shell
pkg-config
--libs
gthread-2.0
)
...
...
@@ -65,8 +64,8 @@ GMODULE_LIB ?= $(shell pkg-config --libs gmodule-no-export-2.0)
GLIB_INC
?=
$(
shell
pkg-config
--cflags
glib-2.0
)
GLIB_LIB
?=
$(
shell
pkg-config
--libs
glib-2.0
)
GIRARA_INC
?=
$(
shell
pkg-config
--cflags
girara-gtk
${ZATHURA_GTK_VERSION}
)
GIRARA_LIB
?=
$(
shell
pkg-config
--libs
girara-gtk
${ZATHURA_GTK_VERSION}
)
GIRARA_INC
?=
$(
shell
pkg-config
--cflags
girara-gtk
3
)
GIRARA_LIB
?=
$(
shell
pkg-config
--libs
girara-gtk
3
)
ifneq
(${WITH_SQLITE},0)
SQLITE_INC
?=
$(
shell
pkg-config
--cflags
sqlite3
)
...
...
content-type.c
0 → 100644
View file @
a7b3d73f
/* See LICENSE file for license and copyright information */
#define _BSD_SOURCE
#define _XOPEN_SOURCE 700
#include "content-type.h"
#include "macros.h"
#include <girara/utils.h>
#ifdef WITH_MAGIC
#include <magic.h>
#else
#include <sys/types.h>
#include <sys/wait.h>
#endif
#include <stdio.h>
#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
;
#ifdef WITH_MAGIC
static
const
char
*
guess_type_magic
(
const
char
*
path
)
{
const
char
*
mime_type
=
NULL
;
/* creat magic cookie */
const
int
flags
=
MAGIC_MIME_TYPE
|
MAGIC_SYMLINK
|
MAGIC_NO_CHECK_APPTYPE
|
MAGIC_NO_CHECK_CDF
|
MAGIC_NO_CHECK_ELF
|
MAGIC_NO_CHECK_ENCODING
;
magic_t
magic
=
magic_open
(
flags
);
if
(
magic
==
NULL
)
{
girara_debug
(
"failed creating the magic cookie"
);
goto
cleanup
;
}
/* ... and load mime database */
if
(
magic_load
(
magic
,
NULL
)
<
0
)
{
girara_debug
(
"failed loading the magic database: %s"
,
magic_error
(
magic
));
goto
cleanup
;
}
/* 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
;
}
/* dup so we own the memory */
mime_type
=
g_strdup
(
mime_type
);
girara_debug
(
"magic detected filetype: %s"
,
mime_type
);
cleanup:
if
(
magic
!=
NULL
)
{
magic_close
(
magic
);
}
return
mime_type
;
}
static
const
char
*
guess_type_file
(
const
char
*
UNUSED
(
path
))
{
return
NULL
;
}
#else
static
const
char
*
guess_type_magic
(
const
char
*
UNUSED
(
path
))
{
return
NULL
;
}
static
const
char
*
guess_type_file
(
const
char
*
path
)
{
GString
*
command
=
g_string_new
(
"file -b --mime-type "
);
char
*
tmp
=
g_shell_quote
(
path
);
g_string_append
(
command
,
tmp
);
g_free
(
tmp
);
GError
*
error
=
NULL
;
char
*
out
=
NULL
;
int
ret
=
0
;
g_spawn_command_line_sync
(
command
->
str
,
&
out
,
NULL
,
&
ret
,
&
error
);
g_string_free
(
command
,
TRUE
);
if
(
error
!=
NULL
)
{
girara_warning
(
"failed to execute command: %s"
,
error
->
message
);
g_error_free
(
error
);
g_free
(
out
);
return
NULL
;
}
if
(
WEXITSTATUS
(
ret
)
!=
0
)
{
girara_warning
(
"file failed with error code: %d"
,
WEXITSTATUS
(
ret
));
g_free
(
out
);
return
NULL
;
}
g_strdelimit
(
out
,
"
\n\r
"
,
'\0'
);
return
out
;
}
#endif
static
const
char
*
guess_type_glib
(
const
char
*
path
)
{
gboolean
uncertain
=
FALSE
;
const
char
*
content_type
=
g_content_type_guess
(
path
,
NULL
,
0
,
&
uncertain
);
if
(
content_type
==
NULL
)
{
girara_debug
(
"g_content_type failed
\n
"
);
}
else
{
if
(
uncertain
==
FALSE
)
{
girara_debug
(
"g_content_type detected filetype: %s"
,
content_type
);
return
content_type
;
}
girara_debug
(
"g_content_type is uncertain, guess: %s"
,
content_type
);
}
FILE
*
f
=
fopen
(
path
,
"rb"
);
if
(
f
==
NULL
)
{
return
NULL
;
}
const
int
fd
=
fileno
(
f
);
guchar
*
content
=
NULL
;
size_t
length
=
0u
;
ssize_t
bytes_read
=
-
1
;
while
(
uncertain
==
TRUE
&&
length
<
GT_MAX_READ
&&
bytes_read
!=
0
)
{
g_free
((
void
*
)
content_type
);
content_type
=
NULL
;
guchar
*
temp_content
=
g_try_realloc
(
content
,
length
+
BUFSIZ
);
if
(
temp_content
==
NULL
)
{
break
;
}
content
=
temp_content
;
bytes_read
=
read
(
fd
,
content
+
length
,
BUFSIZ
);
if
(
bytes_read
==
-
1
)
{
break
;
}
length
+=
bytes_read
;
content_type
=
g_content_type_guess
(
NULL
,
content
,
length
,
&
uncertain
);
girara_debug
(
"new guess: %s uncertain: %d, read: %zu"
,
content_type
,
uncertain
,
length
);
}
fclose
(
f
);
g_free
(
content
);
if
(
uncertain
==
FALSE
)
{
return
content_type
;
}
g_free
((
void
*
)
content_type
);
return
NULL
;
}
const
char
*
guess_content_type
(
const
char
*
path
)
{
/* try libmagic first */
const
char
*
content_type
=
guess_type_magic
(
path
);
if
(
content_type
!=
NULL
)
{
return
content_type
;
}
/* else fallback to g_content_type_guess method */
content_type
=
guess_type_glib
(
path
);
if
(
content_type
!=
NULL
)
{
return
content_type
;
}
/* and if libmagic is not available, try file as last resort */
return
guess_type_file
(
path
);
}
content-type.h
0 → 100644
View file @
a7b3d73f
/* See LICENSE file for license and copyright information */
#ifndef ZATHURA_CONTENT_TYPE_H
#define ZATHURA_CONTENT_TYPE_H
const
char
*
guess_content_type
(
const
char
*
path
);
#endif
data/org.pwmt.zathura.xml
0 → 100644
View file @
a7b3d73f
<!DOCTYPE node PUBLIC '-//freedesktop//DTD D-BUS Object Introspection 1.0//EN'
'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd'>
<node>
<interface
name=
'org.pwmt.zathura'
>
<!-- Open a document in a running zathura instance. -->
<method
name=
'OpenDocument'
>
<arg
type=
's'
name=
'path'
direction=
'in'
/>
<arg
type=
's'
name=
'password'
direction=
'in'
/>
<arg
type=
'i'
name=
'page'
direction=
'in'
/>
<arg
type=
'b'
name=
'return'
direction=
'out'
/>
</method>
<!-- Close open document. -->
<method
name=
'CloseDocument'
>
<arg
type=
'b'
name=
'return'
direction=
'out'
/>
</method>
<!-- Go to a specific page . -->
<method
name=
'GotoPage'
>
<arg
type=
'u'
name=
'page'
direction=
'in'
/>
<arg
type=
'b'
name=
'return'
direction=
'out'
/>
</method>
<!-- Go to a page and highlight rectangles there. -->
<method
name=
'HighlightRects'
>
<arg
type=
'u'
name=
'page'
direction=
'in'
/>
<arg
type=
'a(dddd)'
name=
'rectangles'
direction=
'in'
/>
<arg
type=
'a(udddd)'
name=
'secondary_rectangles'
direction=
'in'
/>
<arg
type=
'b'
name=
'return'
direction=
'out'
/>
</method>
<property
type=
's'
name=
'filename'
access=
'read'
/>
<property
type=
'u'
name=
'pagenumber'
access=
'read'
/>
<property
type=
'u'
name=
'numberofpages'
access=
'read'
/>
</interface>
</node>
data/tex_zathurasynctex.vim
0 → 100644
View file @
a7b3d73f
" See LICENSE file for license and copyright information
" This is a sample plugin that can be used for synctex forward synchronization.
" It currently uses latexsuite to obtain the file name of the document. If you
" are not using latexsuite, it should be enough to adopt the calculation of
" 'output' accordingly.
" avoid re-execution
if
exists
(
"b:did_zathura_synctex_plugin"
)
||
!
exists
(
"*Tex_GetMainFileName"
)
finish
endif
let
b:did_zathura_synctex_plugin
=
1
function
!
Zathura_SyncTexForward
()
let
source
=
expand
(
"%:p"
)
let
input
=
shellescape
(
line
(
"."
).
":"
.
col
(
"."
).
":"
.
source
)
let
output
=
Tex_GetMainFileName
(
":p:r"
).
".pdf"
let
execstr
=
"zathura --synctex-forward="
.
input
.
" "
.
shellescape
(
output
)
silent
call
system
(
execstr
)
endfunction
nmap
<
buffer
>
<
Leader
>
f
:
call
Zathura_SyncTexForward
()<
Enter
>
database-plain.c
View file @
a7b3d73f
...
...
@@ -14,6 +14,7 @@
#include <girara/input-history.h>
#include "database-plain.h"
#include "utils.h"
#define BOOKMARKS "bookmarks"
#define HISTORY "history"
...
...
@@ -47,6 +48,7 @@ G_DEFINE_TYPE_WITH_CODE(ZathuraPlainDatabase, zathura_plaindatabase, G_TYPE_OBJE
G_IMPLEMENT_INTERFACE
(
ZATHURA_TYPE_DATABASE
,
zathura_database_interface_init
)
G_IMPLEMENT_INTERFACE
(
GIRARA_TYPE_INPUT_HISTORY_IO
,
io_interface_init
))
static
void
plain_dispose
(
GObject
*
object
);
static
void
plain_finalize
(
GObject
*
object
);
static
bool
plain_add_bookmark
(
zathura_database_t
*
db
,
const
char
*
file
,
zathura_bookmark_t
*
bookmark
);
static
bool
plain_remove_bookmark
(
zathura_database_t
*
db
,
const
char
*
file
,
const
char
*
id
);
...
...
@@ -128,6 +130,7 @@ zathura_plaindatabase_class_init(ZathuraPlainDatabaseClass* class)
/* override methods */
GObjectClass
*
object_class
=
G_OBJECT_CLASS
(
class
);
object_class
->
dispose
=
plain_dispose
;
object_class
->
finalize
=
plain_finalize
;
object_class
->
set_property
=
plain_set_property
;
...
...
@@ -281,6 +284,18 @@ plain_set_property(GObject* object, guint prop_id, const GValue* value, GParamSp
}
}
static
void
plain_dispose
(
GObject
*
object
)
{
ZathuraPlainDatabase
*
db
=
ZATHURA_PLAINDATABASE
(
object
);
zathura_plaindatabase_private_t
*
priv
=
ZATHURA_PLAINDATABASE_GET_PRIVATE
(
db
);
g_clear_object
(
&
priv
->
bookmark_monitor
);
g_clear_object
(
&
priv
->
history_monitor
);
G_OBJECT_CLASS
(
zathura_plaindatabase_parent_class
)
->
dispose
(
object
);
}
static
void
plain_finalize
(
GObject
*
object
)
{
...
...
@@ -290,10 +305,6 @@ plain_finalize(GObject* object)
/* bookmarks */
g_free
(
priv
->
bookmark_path
);
if
(
priv
->
bookmark_monitor
!=
NULL
)
{
g_object_unref
(
priv
->
bookmark_monitor
);
}
if
(
priv
->
bookmarks
!=
NULL
)
{
g_key_file_free
(
priv
->
bookmarks
);