mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-29 18:24:56 +01:00
Merge branch 'develop' of pwmt.org:zathura into develop
This commit is contained in:
commit
0e2e9d912b
6 changed files with 75 additions and 18 deletions
1
AUTHORS
1
AUTHORS
|
@ -6,6 +6,7 @@ Sebastian Ramacher <s.ramacher@gmx.at>
|
|||
Other contributors are (in alphabetical order):
|
||||
|
||||
Pavel Borzenkov <pavel.borzenkov@gmail.com>
|
||||
Géraud Le Falher <daureg@gmail.com>
|
||||
Ivan Sichmann Freitas <ivansichfreitas@gmail.com>
|
||||
Felix Herrmann <felix@herrmann-koenigsberg.de>
|
||||
int3 <jezreel@gmail.com>
|
||||
|
|
4
Makefile
4
Makefile
|
@ -145,8 +145,12 @@ endif
|
|||
install-manpages: build-manpages
|
||||
$(ECHO) installing manual pages
|
||||
$(QUIET)mkdir -p ${DESTDIR}${MANPREFIX}/man1 ${DESTDIR}${MANPREFIX}/man5
|
||||
ifneq "$(wildcard ${PROJECT}.1)" ""
|
||||
$(QUIET)install -m 644 ${PROJECT}.1 ${DESTDIR}${MANPREFIX}/man1
|
||||
endif
|
||||
ifneq "$(wildcard ${PROJECT}rc.5)" ""
|
||||
$(QUIET)install -m 644 ${PROJECT}rc.5 ${DESTDIR}${MANPREFIX}/man5
|
||||
endif
|
||||
|
||||
install-headers: ${PROJECT}.pc
|
||||
$(ECHO) installing header files
|
||||
|
|
48
document.c
48
document.c
|
@ -26,6 +26,9 @@
|
|||
#include <girara/session.h>
|
||||
#include <girara/settings.h>
|
||||
|
||||
/** Read a most GT_MAX_READ bytes before falling back to file. */
|
||||
static const size_t GT_MAX_READ = 1 << 16;
|
||||
|
||||
/**
|
||||
* Register document plugin
|
||||
*/
|
||||
|
@ -185,7 +188,9 @@ guess_type(const char* path)
|
|||
return content_type;
|
||||
}
|
||||
|
||||
FILE* f = fopen(path, "r");
|
||||
girara_debug("g_content_type is uncertain, guess: %s\n", content_type);
|
||||
|
||||
FILE* f = fopen(path, "rb");
|
||||
if (f == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -193,7 +198,7 @@ guess_type(const char* path)
|
|||
const int fd = fileno(f);
|
||||
guchar* content = NULL;
|
||||
size_t length = 0u;
|
||||
while (uncertain == TRUE) {
|
||||
while (uncertain == TRUE && length < GT_MAX_READ) {
|
||||
g_free((void*)content_type);
|
||||
content_type = NULL;
|
||||
|
||||
|
@ -205,16 +210,45 @@ guess_type(const char* path)
|
|||
|
||||
length += r;
|
||||
content_type = g_content_type_guess(NULL, content, length, &uncertain);
|
||||
girara_debug("new guess: %s uncertain: %d, read: %zu\n", content_type, uncertain, length);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
if (uncertain == TRUE) {
|
||||
g_free((void*)content_type);
|
||||
content_type = NULL;
|
||||
g_free(content);
|
||||
if (uncertain == FALSE) {
|
||||
return content_type;
|
||||
}
|
||||
|
||||
g_free(content);
|
||||
return content_type;
|
||||
g_free((void*)content_type);
|
||||
content_type = NULL;
|
||||
|
||||
girara_debug("falling back to file");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
zathura_document_t*
|
||||
|
|
|
@ -706,7 +706,7 @@ cb_menu_image_copy(GtkMenuItem* item, ZathuraPage* page)
|
|||
int width = cairo_image_surface_get_width(surface);
|
||||
int height = cairo_image_surface_get_height(surface);
|
||||
|
||||
GdkPixmap* pixmap = gdk_pixmap_new(GTK_WIDGET(item)->window, width, height, -1);
|
||||
GdkPixmap* pixmap = gdk_pixmap_new(gtk_widget_get_window(GTK_WIDGET(item)), width, height, -1);
|
||||
cairo_t* cairo = gdk_cairo_create(pixmap);
|
||||
|
||||
cairo_set_source_surface(cairo, surface, 0, 0);
|
||||
|
|
24
po/de.po
24
po/de.po
|
@ -4,7 +4,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: zathura 0.1.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2012-03-20 00:55+0100\n"
|
||||
"POT-Creation-Date: 2012-03-23 19:24+0100\n"
|
||||
"PO-Revision-Date: 2012-03-05 17:26+0100\n"
|
||||
"Last-Translator: Sebastian Ramacher <s.ramacher@gmx.at>\n"
|
||||
"Language-Team: pwmt.org <mail@pwmt.org>\n"
|
||||
|
@ -176,7 +176,7 @@ msgstr "Zeige Ordner an"
|
|||
|
||||
#: ../config.c:120
|
||||
msgid "Always open on first page"
|
||||
msgstr ""
|
||||
msgstr "Öffne Dokument immer auf der ersten Seite"
|
||||
|
||||
#. define default inputbar commands
|
||||
#: ../config.c:240
|
||||
|
@ -223,19 +223,23 @@ msgstr "Speichere Dokument (und überschreibe bestehende)"
|
|||
msgid "Save attachments"
|
||||
msgstr "Speichere Anhänge"
|
||||
|
||||
#: ../document.c:373 ../document.c:397 ../document.c:416 ../document.c:438
|
||||
#: ../document.c:457 ../document.c:479 ../document.c:498 ../document.c:541
|
||||
#: ../document.c:561 ../document.c:584 ../document.c:613 ../document.c:642
|
||||
#: ../document.c:666 ../document.c:687 ../document.c:708
|
||||
#: ../document.c:439 ../document.c:463 ../document.c:482 ../document.c:504
|
||||
#: ../document.c:523 ../document.c:545 ../document.c:564 ../document.c:607
|
||||
#: ../document.c:627 ../document.c:650 ../document.c:679 ../document.c:708
|
||||
#: ../document.c:732 ../document.c:753 ../document.c:774
|
||||
#, c-format
|
||||
msgid "%s not implemented"
|
||||
msgstr "%s ist nicht implementiert."
|
||||
|
||||
#: ../page-widget.c:555
|
||||
#: ../page-widget.c:570
|
||||
#, c-format
|
||||
msgid "Copied selected text to clipbard: %s"
|
||||
msgstr "Der gewählte Text wurde in die Zwischenablage kopiert: %s"
|
||||
|
||||
#: ../page-widget.c:662
|
||||
msgid "Copy image"
|
||||
msgstr "Bild kopieren"
|
||||
|
||||
#: ../shortcuts.c:726
|
||||
msgid "This document does not contain any index"
|
||||
msgstr "Dieses Dokument beinhaltet kein Inhaltsverzeichnis."
|
||||
|
@ -260,6 +264,10 @@ msgstr "Pfad zum Pluginverzeichnis"
|
|||
msgid "Fork into the background"
|
||||
msgstr "Forkt den Prozess in den Hintergrund"
|
||||
|
||||
#: ../zathura.c:225 ../zathura.c:600
|
||||
#: ../zathura.c:60
|
||||
msgid "Log level (debug, info, warning, error)"
|
||||
msgstr ""
|
||||
|
||||
#: ../zathura.c:226 ../zathura.c:601
|
||||
msgid "[No name]"
|
||||
msgstr ""
|
||||
|
|
14
zathura.c
14
zathura.c
|
@ -48,7 +48,7 @@ zathura_init(int argc, char* argv[])
|
|||
Window embed = 0;
|
||||
#endif
|
||||
|
||||
gchar* config_dir = NULL, *data_dir = NULL, *plugin_path = NULL;
|
||||
gchar* config_dir = NULL, *data_dir = NULL, *plugin_path = NULL, *loglevel = NULL;
|
||||
bool forkback = false;
|
||||
GOptionEntry entries[] =
|
||||
{
|
||||
|
@ -56,7 +56,8 @@ zathura_init(int argc, char* argv[])
|
|||
{ "config-dir", 'c', 0, G_OPTION_ARG_FILENAME, &config_dir, _("Path to the config directory"), "path" },
|
||||
{ "data-dir", 'd', 0, G_OPTION_ARG_FILENAME, &data_dir, _("Path to the data directory"), "path" },
|
||||
{ "plugins-dir", 'p', 0, G_OPTION_ARG_STRING, &plugin_path, _("Path to the directories containing plugins"), "path" },
|
||||
{ "fork", '\0', 0, G_OPTION_ARG_NONE, &forkback, _("Fork into the background") , NULL },
|
||||
{ "fork", '\0', 0, G_OPTION_ARG_NONE, &forkback, _("Fork into the background"), NULL },
|
||||
{ "debug", 'l', 0, G_OPTION_ARG_STRING, &loglevel, _("Log level (debug, info, warning, error)"), "level" },
|
||||
{ NULL, '\0', 0, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
@ -86,6 +87,15 @@ zathura_init(int argc, char* argv[])
|
|||
setsid();
|
||||
}
|
||||
|
||||
/* Set log level. */
|
||||
if (loglevel == NULL || g_strcmp0(loglevel, "info") == 0) {
|
||||
girara_set_debug_level(GIRARA_INFO);
|
||||
} else if (g_strcmp0(loglevel, "warning") == 0) {
|
||||
girara_set_debug_level(GIRARA_WARNING);
|
||||
} else if (g_strcmp0(loglevel, "error") == 0) {
|
||||
girara_set_debug_level(GIRARA_ERROR);
|
||||
}
|
||||
|
||||
zathura_t* zathura = g_malloc0(sizeof(zathura_t));
|
||||
|
||||
/* plugins */
|
||||
|
|
Loading…
Reference in a new issue