From b78be80d138076471cdfdc2c4edab4a3af6241b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0abata?= Date: Mon, 21 Dec 2015 16:57:59 +0100 Subject: [PATCH 01/29] Build even without SyncTeX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit synctex_editor is used no matter whether we're building WITH_SYNCTEX or not. This fixes a build failure when WITH_SYNCTEX isn't defined. Signed-off-by: Petr Ĺ abata --- zathura/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/zathura/main.c b/zathura/main.c index 060382a..1c5b73e 100644 --- a/zathura/main.c +++ b/zathura/main.c @@ -135,10 +135,8 @@ main(int argc, char* argv[]) gchar* plugin_path = NULL; gchar* loglevel = NULL; gchar* password = NULL; -#ifdef WITH_SYNCTEX gchar* synctex_editor = NULL; gchar* synctex_fwd = NULL; -#endif gchar* mode = NULL; bool forkback = false; bool print_version = false; From 9bfc58216e7d7e9b001f80084b3551973709d092 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Mon, 21 Dec 2015 18:51:30 +0100 Subject: [PATCH 02/29] Fix build of tests Signed-off-by: Sebastian Ramacher --- tests/test_document.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_document.c b/tests/test_document.c index c5aea4a..75b401d 100644 --- a/tests/test_document.c +++ b/tests/test_document.c @@ -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() From f7b174f8219c8a2b65ed33114acf077e3cdabb17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sat, 2 Jan 2016 03:15:17 +0100 Subject: [PATCH 03/29] fix typo in man page --- doc/man/zathurarc.5.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/man/zathurarc.5.rst b/doc/man/zathurarc.5.rst index 45a9bbb..d52c875 100644 --- a/doc/man/zathurarc.5.rst +++ b/doc/man/zathurarc.5.rst @@ -454,8 +454,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 From 3dd360a27dd8a06be07d25ab817a6d7596b4b0d2 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Sat, 9 Jan 2016 15:01:51 +0100 Subject: [PATCH 04/29] Fail if pid is given but there is something wrong with the given pid Signed-off-by: Sebastian Ramacher --- zathura/dbus-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zathura/dbus-interface.c b/zathura/dbus-interface.c index e2560f6..1a89261 100644 --- a/zathura/dbus-interface.c +++ b/zathura/dbus-interface.c @@ -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( From d0c191515397e8d0a85ab049a9c6b2b7fed3a81a Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Sat, 9 Jan 2016 15:08:04 +0100 Subject: [PATCH 05/29] Update synctex documentation Signed-off-by: Sebastian Ramacher --- doc/man/_options.txt | 8 +++++++- doc/man/_synctex.txt | 4 ++-- doc/man/_synopsis.txt | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/man/_options.txt b/doc/man/_options.txt index 89a6be6..0ebbf14 100644 --- a/doc/man/_options.txt +++ b/doc/man/_options.txt @@ -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 diff --git a/doc/man/_synctex.txt b/doc/man/_synctex.txt index 70db6ad..dfa5dc8 100644 --- a/doc/man/_synctex.txt +++ b/doc/man/_synctex.txt @@ -1,6 +1,6 @@ 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 diff --git a/doc/man/_synopsis.txt b/doc/man/_synopsis.txt index c4e918d..9311e9d 100644 --- a/doc/man/_synopsis.txt +++ b/doc/man/_synopsis.txt @@ -1,2 +1,3 @@ zathura [-e XID] [-c PATH] [-d PATH] [-p PATH] [-w PASSWORD] [-P NUMBER] -[--fork] [-l LEVEL] [-s] [-x CMD] [--synctex-forward INPUT] +[--fork] [-l LEVEL] [-s] [-x CMD] [--synctex-forward INPUT] [--synctex-pid PID] + From f1d027e6566cb40cfaacd8057508a2f8ce29c57e Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Sat, 9 Jan 2016 15:11:48 +0100 Subject: [PATCH 06/29] Exit without failure if instance found Signed-off-by: Sebastian Ramacher --- zathura/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/zathura/main.c b/zathura/main.c index 1c5b73e..e30d34d 100644 --- a/zathura/main.c +++ b/zathura/main.c @@ -194,9 +194,13 @@ main(int argc, char* argv[]) } const int ret = run_synctex_forward(synctex_fwd, argv[1], synctex_pid); - if (ret != 0) { - /* Error or instance found */ - return ret; + if (ret > 0) { + /* Instance found. */ + return 0; + } + else if (ret < 0) { + /* Error occurred. */ + return -1; } girara_debug("No instance found. Starting new one."); From aecb648374ca666b058e94e7b97e470a9b22de36 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Sat, 9 Jan 2016 15:28:10 +0100 Subject: [PATCH 07/29] Fix issues from clang-tidy Signed-off-by: Sebastian Ramacher --- zathura/zathura.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zathura/zathura.c b/zathura/zathura.c index c9ec071..31080a6 100644 --- a/zathura/zathura.c +++ b/zathura/zathura.c @@ -1413,10 +1413,10 @@ adjust_view(zathura_t* zathura) if (adjust_mode == ZATHURA_ADJUST_WIDTH || (adjust_mode == ZATHURA_ADJUST_BESTFIT && page_ratio < view_ratio)) { - newscale = scale * (double)view_width / (double)document_width; + newscale *= (double)view_width / (double)document_width; } else if (adjust_mode == ZATHURA_ADJUST_BESTFIT) { - newscale = scale * (double)view_height / (double)cell_height; + newscale *= (double)view_height / (double)cell_height; } else { goto error_ret; @@ -1428,8 +1428,8 @@ adjust_view(zathura_t* zathura) zathura_document_get_cell_size(zathura->document, &new_cell_height, &new_cell_width); /* if the change in scale changes page cell dimensions by at least one pixel, render */ - if (abs(new_cell_width - cell_width) > 1 || - abs(new_cell_height - cell_height) > 1) { + if (abs((int)new_cell_width - (int)cell_width) > 1 || + abs((int)new_cell_height - (int)cell_height) > 1) { render_all(zathura); refresh_view(zathura); From fec81cf40b0a9d7aad95298d22edff6f2ac7ec77 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Fri, 15 Jan 2016 02:00:59 +0100 Subject: [PATCH 08/29] Ignore extra -- from g_option_context_parse Debian bug #811032 Signed-off-by: Sebastian Ramacher --- zathura/main.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/zathura/main.c b/zathura/main.c index e30d34d..f771289 100644 --- a/zathura/main.c +++ b/zathura/main.c @@ -213,10 +213,19 @@ main(int argc, char* argv[]) return -1; } - size_t file_idx = argc > 1 ? 1 : 0; + /* g_option_context_parse has some funny (documented) behavior: + * * for "-- a b c" you get no -- in argv + * * for "-- --" you get -- in argv twice + * * for "-- -a" you get -- in argv + * + * So if there is one -- in argv, we need to ignore it. */ + const bool has_double_dash = argc > 1 && g_strcmp0(argv[1], "--") == 0; + const int file_idx_base = has_double_dash ? 2 : 1; + + int file_idx = argc > file_idx_base ? file_idx_base : 0; /* Fork instances for other files. */ - if (print_version == false && argc > 2) { - for (int idx = 2; idx < argc; ++idx) { + if (print_version == false && argc > file_idx_base + 1) { + for (int idx = file_idx_base + 1; idx < argc; ++idx) { const pid_t pid = fork(); if (pid == 0) { /* child */ file_idx = idx; @@ -232,7 +241,7 @@ main(int argc, char* argv[]) } /* Fork into the background if the user really wants to ... */ - if (print_version == false && forkback == true && file_idx < 2) { + if (print_version == false && forkback == true && file_idx < file_idx_base + 1) { const pid_t pid = fork(); if (pid > 0) { /* parent */ return 0; From 564ae2bdd637472a097f4743d0319fc43d53d3bc Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Mon, 18 Jan 2016 12:42:05 +0100 Subject: [PATCH 09/29] Children should not fork Signed-off-by: Sebastian Ramacher --- zathura/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/zathura/main.c b/zathura/main.c index f771289..b5265a5 100644 --- a/zathura/main.c +++ b/zathura/main.c @@ -233,6 +233,7 @@ main(int argc, char* argv[]) girara_error("Could not start new process group: %s", strerror(errno)); return -1; } + break; } else if (pid < 0) { /* error */ girara_error("Could not fork: %s", strerror(errno)); return -1; From ec5268a975f4e7ac8fae268be6aaa68c084b6b01 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Wed, 20 Jan 2016 01:57:56 +0100 Subject: [PATCH 10/29] Reduce some of the #ifdef madness Signed-off-by: Sebastian Ramacher --- zathura/main.c | 68 ++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/zathura/main.c b/zathura/main.c index b5265a5..5112ea0 100644 --- a/zathura/main.c +++ b/zathura/main.c @@ -18,6 +18,10 @@ #include "synctex.h" #endif +#ifndef GDK_WINDOWING_X11 +typedef int Window; +#endif + /* Init locale */ static void init_locale(void) @@ -45,7 +49,7 @@ set_log_level(const char* loglevel) #ifdef WITH_SYNCTEX static int run_synctex_forward(const char* synctex_fwd, const char* filename, - int synctex_pid) + int synctex_pid) { GFile* file = g_file_new_for_commandline_arg(filename); if (file == NULL) { @@ -60,8 +64,8 @@ run_synctex_forward(const char* synctex_fwd, const char* filename, return -1; } - int line = 0; - int column = 0; + int line = 0; + int column = 0; char* input_file = NULL; if (synctex_parse_input(synctex_fwd, &input_file, &line, &column) == false) { girara_error("Failed to parse argument to --synctex-forward."); @@ -69,13 +73,15 @@ run_synctex_forward(const char* synctex_fwd, const char* filename, return -1; } - const int ret = zathura_dbus_synctex_position(real_path, input_file, line, column, synctex_pid); + const int ret = zathura_dbus_synctex_position(real_path, input_file, line, + column, synctex_pid); g_free(input_file); g_free(real_path); if (ret == -1) { /* D-Bus or SyncTeX failed */ - girara_error("Got no usable data from SyncTeX or D-Bus failed in some way."); + girara_error( + "Got no usable data from SyncTeX or D-Bus failed in some way."); } return ret; @@ -84,12 +90,8 @@ run_synctex_forward(const char* synctex_fwd, const char* filename, static zathura_t* init_zathura(const char* config_dir, const char* data_dir, - const char* cache_dir, const char* plugin_path, char** argv, -#ifdef GDK_WINDOWING_X11 - char* synctex_editor, Window embed) -#else - char* synctex_editor) -#endif + const char* cache_dir, const char* plugin_path, char** argv, + char* synctex_editor, Window embed) { /* create zathura session */ zathura_t* zathura = zathura_create(); @@ -114,7 +116,8 @@ init_zathura(const char* config_dir, const char* data_dir, #ifdef WITH_SYNCTEX if (synctex_editor != NULL) { - girara_setting_set(zathura->ui.session, "synctex-editor-command", synctex_editor); + girara_setting_set(zathura->ui.session, "synctex-editor-command", + synctex_editor); } #endif @@ -138,11 +141,11 @@ main(int argc, char* argv[]) gchar* synctex_editor = NULL; gchar* synctex_fwd = NULL; gchar* mode = NULL; - bool forkback = false; - bool print_version = false; - int page_number = ZATHURA_PAGE_NUMBER_UNSPECIFIED; + bool forkback = false; + bool print_version = false; + int page_number = ZATHURA_PAGE_NUMBER_UNSPECIFIED; #ifdef WITH_SYNCTEX - int synctex_pid = -1; + int synctex_pid = -1; #endif #ifdef GDK_WINDOWING_X11 Window embed = 0; @@ -189,7 +192,8 @@ main(int argc, char* argv[]) /* handle synctex forward synchronization */ if (synctex_fwd != NULL) { if (argc != 2) { - girara_error("Too many arguments or missing filename while running with --synctex-forward"); + girara_error("Too many arguments or missing filename while running with " + "--synctex-forward"); return -1; } @@ -208,7 +212,8 @@ main(int argc, char* argv[]) #endif /* check mode */ - if (mode != NULL && g_strcmp0(mode, "presentation") != 0 && g_strcmp0(mode, "fullscreen") != 0) { + if (mode != NULL && g_strcmp0(mode, "presentation") != 0 && + g_strcmp0(mode, "fullscreen") != 0) { girara_error("Invalid argument for --mode: %s", mode); return -1; } @@ -220,7 +225,7 @@ main(int argc, char* argv[]) * * So if there is one -- in argv, we need to ignore it. */ const bool has_double_dash = argc > 1 && g_strcmp0(argv[1], "--") == 0; - const int file_idx_base = has_double_dash ? 2 : 1; + const int file_idx_base = has_double_dash ? 2 : 1; int file_idx = argc > file_idx_base ? file_idx_base : 0; /* Fork instances for other files. */ @@ -230,11 +235,13 @@ main(int argc, char* argv[]) if (pid == 0) { /* child */ file_idx = idx; if (setsid() == -1) { - girara_error("Could not start new process group: %s", strerror(errno)); + girara_error("Could not start new process group: %s", + strerror(errno)); return -1; } break; - } else if (pid < 0) { /* error */ + } + else if (pid < 0) { /* error */ girara_error("Could not fork: %s", strerror(errno)); return -1; } @@ -242,11 +249,13 @@ main(int argc, char* argv[]) } /* Fork into the background if the user really wants to ... */ - if (print_version == false && forkback == true && file_idx < file_idx_base + 1) { + if (print_version == false && forkback == true && + file_idx < file_idx_base + 1) { const pid_t pid = fork(); if (pid > 0) { /* parent */ return 0; - } else if (pid < 0) { /* error */ + } + else if (pid < 0) { /* error */ girara_error("Could not fork: %s", strerror(errno)); return -1; } @@ -262,11 +271,7 @@ main(int argc, char* argv[]) /* Create zathura session */ zathura_t* zathura = init_zathura(config_dir, data_dir, cache_dir, -#ifdef GDK_WINDOWING_X11 - plugin_path, argv, synctex_editor, embed); -#else - plugin_path, argv, synctex_editor); -#endif + plugin_path, argv, synctex_editor, embed); if (zathura == NULL) { girara_error("Could not initialize zathura."); return -1; @@ -289,11 +294,8 @@ main(int argc, char* argv[]) if (page_number > 0) { --page_number; } -#ifdef WITH_SYNCTEX - document_open_idle(zathura, argv[file_idx], password, page_number, mode, synctex_fwd); -#else - document_open_idle(zathura, argv[file_idx], password, page_number, mode, NULL); -#endif + document_open_idle(zathura, argv[file_idx], password, page_number, mode, + synctex_fwd); } /* run zathura */ From 274809be4155474d3a1cbfebfeb684d34ffb6dd1 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Wed, 20 Jan 2016 02:06:09 +0100 Subject: [PATCH 11/29] Remove another #ifdef Signed-off-by: Sebastian Ramacher --- zathura/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/zathura/main.c b/zathura/main.c index 5112ea0..49f49f3 100644 --- a/zathura/main.c +++ b/zathura/main.c @@ -147,9 +147,7 @@ main(int argc, char* argv[]) #ifdef WITH_SYNCTEX int synctex_pid = -1; #endif -#ifdef GDK_WINDOWING_X11 Window embed = 0; -#endif GOptionEntry entries[] = { #ifdef GDK_WINDOWING_X11 From 2da759149ba78111b2be5f5435aa99463f148065 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Wed, 20 Jan 2016 02:21:15 +0100 Subject: [PATCH 12/29] Remove signal handler when closing Signed-off-by: Sebastian Ramacher --- zathura/zathura.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/zathura/zathura.c b/zathura/zathura.c index 31080a6..36eab75 100644 --- a/zathura/zathura.c +++ b/zathura/zathura.c @@ -93,7 +93,8 @@ zathura_create(void) } /* UI */ - if ((zathura->ui.session = girara_session_create()) == NULL) { + zathura->ui.session = girara_session_create(); + if (zathura->ui.session == NULL) { goto error_out; } @@ -326,6 +327,13 @@ zathura_free(zathura_t* zathura) document_close(zathura, false); +#ifdef G_OS_UNIX + if (zathura->signals.sigterm > 0) { + g_source_remove(zathura->signals.sigterm); + zathura->signals.sigterm = 0; + } +#endif + /* stop D-Bus */ if (zathura->dbus != NULL) { g_object_unref(zathura->dbus); @@ -870,7 +878,7 @@ document_open(zathura_t* zathura, const char* path, const char* uri, const char* } /* set up recolor info in ZathuraRenderer */ - char* recolor_dark = NULL; + char* recolor_dark = NULL; char* recolor_light = NULL; girara_setting_get(zathura->ui.session, "recolor-darkcolor", &recolor_dark); girara_setting_get(zathura->ui.session, "recolor-lightcolor", &recolor_light); From 0683b78f9de454e2343c01ab7c01550cce85e23d Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Wed, 20 Jan 2016 02:43:20 +0100 Subject: [PATCH 13/29] Factor out some code in separate functions Signed-off-by: Sebastian Ramacher --- zathura/zathura.c | 239 ++++++++++++++++++++++++++++------------------ 1 file changed, 145 insertions(+), 94 deletions(-) diff --git a/zathura/zathura.c b/zathura/zathura.c index 36eab75..70c4cd2 100644 --- a/zathura/zathura.c +++ b/zathura/zathura.c @@ -114,32 +114,27 @@ error_out: return NULL; } -bool -zathura_init(zathura_t* zathura) +static void +create_directories(zathura_t* zathura) { - if (zathura == NULL) { - return false; + static const unsigned int mode = 0711; + + if (g_mkdir_with_parents(zathura->config.config_dir, mode) == -1) { + girara_error("Could not create '%s': %s", zathura->config.config_dir, + strerror(errno)); } - /* create zathura (config/data) directory */ - if (g_mkdir_with_parents(zathura->config.config_dir, 0771) == -1) { - girara_error("Could not create '%s': %s", zathura->config.config_dir, strerror(errno)); + if (g_mkdir_with_parents(zathura->config.data_dir, mode) == -1) { + girara_error("Could not create '%s': %s", zathura->config.data_dir, + strerror(errno)); } +} - if (g_mkdir_with_parents(zathura->config.data_dir, 0771) == -1) { - girara_error("Could not create '%s': %s", zathura->config.data_dir, strerror(errno)); - } - - /* load plugins */ - zathura_plugin_manager_load(zathura->plugins.manager); - - /* configuration */ - config_load_default(zathura); - config_load_files(zathura); - - /* UI */ +static bool +init_ui(zathura_t* zathura) +{ if (girara_session_init(zathura->ui.session, "zathura") == false) { - goto error_free; + return false; } /* girara events */ @@ -147,16 +142,9 @@ zathura_init(zathura_t* zathura) zathura->ui.session->events.unknown_command = cb_unknown_command; /* zathura signals */ - zathura->signals.refresh_view = g_signal_new("refresh-view", - GTK_TYPE_WIDGET, - G_SIGNAL_RUN_LAST, - 0, - NULL, - NULL, - g_cclosure_marshal_generic, - G_TYPE_NONE, - 1, - G_TYPE_POINTER); + zathura->signals.refresh_view = g_signal_new( + "refresh-view", GTK_TYPE_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, + g_cclosure_marshal_generic, G_TYPE_NONE, 1, G_TYPE_POINTER); g_signal_connect(G_OBJECT(zathura->ui.session->gtk.view), "refresh-view", G_CALLBACK(cb_refresh_view), zathura); @@ -166,28 +154,29 @@ zathura_init(zathura_t* zathura) gtk_grid_set_row_homogeneous(GTK_GRID(zathura->ui.page_widget), TRUE); gtk_grid_set_column_homogeneous(GTK_GRID(zathura->ui.page_widget), TRUE); if (zathura->ui.page_widget == NULL) { - goto error_free; + return false; } - g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "size-allocate", G_CALLBACK(cb_view_resized), zathura); + g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "size-allocate", + G_CALLBACK(cb_view_resized), zathura); GtkAdjustment* hadjustment = gtk_scrolled_window_get_hadjustment( GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)); /* Connect hadjustment signals */ g_signal_connect(G_OBJECT(hadjustment), "value-changed", - G_CALLBACK(cb_view_hadjustment_value_changed), zathura); + G_CALLBACK(cb_view_hadjustment_value_changed), zathura); g_signal_connect(G_OBJECT(hadjustment), "changed", - G_CALLBACK(cb_view_hadjustment_changed), zathura); + G_CALLBACK(cb_view_hadjustment_changed), zathura); GtkAdjustment* vadjustment = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)); /* Connect vadjustment signals */ g_signal_connect(G_OBJECT(vadjustment), "value-changed", - G_CALLBACK(cb_view_vadjustment_value_changed), zathura); + G_CALLBACK(cb_view_vadjustment_value_changed), zathura); g_signal_connect(G_OBJECT(vadjustment), "changed", - G_CALLBACK(cb_view_vadjustment_changed), zathura); + G_CALLBACK(cb_view_vadjustment_changed), zathura); /* page view alignment */ gtk_widget_set_halign(zathura->ui.page_widget, GTK_ALIGN_CENTER); @@ -201,66 +190,39 @@ zathura_init(zathura_t* zathura) gtk_widget_show(zathura->ui.page_widget); /* statusbar */ - zathura->ui.statusbar.file = girara_statusbar_item_add(zathura->ui.session, TRUE, TRUE, TRUE, NULL); + zathura->ui.statusbar.file = + girara_statusbar_item_add(zathura->ui.session, TRUE, TRUE, TRUE, NULL); if (zathura->ui.statusbar.file == NULL) { - goto error_free; + return false; } - zathura->ui.statusbar.buffer = girara_statusbar_item_add(zathura->ui.session, FALSE, FALSE, FALSE, NULL); + zathura->ui.statusbar.buffer = + girara_statusbar_item_add(zathura->ui.session, FALSE, FALSE, FALSE, NULL); if (zathura->ui.statusbar.buffer == NULL) { - goto error_free; + return false; } - zathura->ui.statusbar.page_number = girara_statusbar_item_add(zathura->ui.session, FALSE, FALSE, FALSE, NULL); + zathura->ui.statusbar.page_number = + girara_statusbar_item_add(zathura->ui.session, FALSE, FALSE, FALSE, NULL); if (zathura->ui.statusbar.page_number == NULL) { - goto error_free; + return false; } - girara_statusbar_item_set_text(zathura->ui.session, zathura->ui.statusbar.file, _("[No name]")); + girara_statusbar_item_set_text(zathura->ui.session, + zathura->ui.statusbar.file, _("[No name]")); /* signals */ - g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "destroy", G_CALLBACK(cb_destroy), zathura); + g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "destroy", + G_CALLBACK(cb_destroy), zathura); - /* database */ - char* database = NULL; - girara_setting_get(zathura->ui.session, "database", &database); + return true; +} - if (g_strcmp0(database, "plain") == 0) { - girara_debug("Using plain database backend."); - zathura->database = zathura_plaindatabase_new(zathura->config.data_dir); -#ifdef WITH_SQLITE - } else if (g_strcmp0(database, "sqlite") == 0) { - girara_debug("Using sqlite database backend."); - char* tmp = g_build_filename(zathura->config.data_dir, "bookmarks.sqlite", NULL); - zathura->database = zathura_sqldatabase_new(tmp); - g_free(tmp); -#endif - } else if (g_strcmp0(database, "null") != 0) { - girara_error("Database backend '%s' is not supported.", database); - } - - if (zathura->database == NULL && g_strcmp0(database, "null") != 0) { - girara_error("Unable to initialize database. Bookmarks won't be available."); - } else { - g_object_set(G_OBJECT(zathura->ui.session->command_history), "io", zathura->database, NULL); - } - g_free(database); - - /* bookmarks */ - zathura->bookmarks.bookmarks = girara_sorted_list_new2((girara_compare_function_t) zathura_bookmarks_compare, - (girara_free_function_t) zathura_bookmark_free); - - /* jumplist */ - int jumplist_size = 20; - girara_setting_get(zathura->ui.session, "jumplist-size", &jumplist_size); - - zathura->jumplist.max_size = jumplist_size < 0 ? 0 : jumplist_size; - zathura->jumplist.list = NULL; - zathura->jumplist.size = 0; - zathura->jumplist.cur = NULL; - - /* CSS for index mode */ - GiraraTemplate* csstemplate = girara_session_get_template(zathura->ui.session); +static void +init_css(zathura_t* zathura) +{ + GiraraTemplate* csstemplate = + girara_session_get_template(zathura->ui.session); static const char* index_settings[] = { "index-fg", @@ -272,8 +234,8 @@ zathura_init(zathura_t* zathura) for (size_t s = 0; s < LENGTH(index_settings); ++s) { girara_template_add_variable(csstemplate, index_settings[s]); - char* tmp_value = NULL; - GdkRGBA rgba = { 0, 0, 0, 0 }; + char* tmp_value = NULL; + GdkRGBA rgba = {0, 0, 0, 0}; girara_setting_get(zathura->ui.session, index_settings[s], &tmp_value); if (tmp_value != NULL) { gdk_rgba_parse(&rgba, tmp_value); @@ -281,24 +243,111 @@ zathura_init(zathura_t* zathura) } char* color = gdk_rgba_to_string(&rgba); - girara_template_set_variable_value(csstemplate, - index_settings[s], color); + girara_template_set_variable_value(csstemplate, index_settings[s], color); g_free(color); } - char* css = g_strdup_printf("%s\n%s", girara_template_get_base(csstemplate), CSS_TEMPLATE_INDEX); + char* css = g_strdup_printf("%s\n%s", girara_template_get_base(csstemplate), + CSS_TEMPLATE_INDEX); girara_template_set_base(csstemplate, css); g_free(css); +} - /* Shortcut helpers */ +static void +init_database(zathura_t* zathura) +{ + char* database = NULL; + girara_setting_get(zathura->ui.session, "database", &database); + + if (g_strcmp0(database, "plain") == 0) { + girara_debug("Using plain database backend."); + zathura->database = zathura_plaindatabase_new(zathura->config.data_dir); +#ifdef WITH_SQLITE + } else if (g_strcmp0(database, "sqlite") == 0) { + girara_debug("Using sqlite database backend."); + char* tmp = + g_build_filename(zathura->config.data_dir, "bookmarks.sqlite", NULL); + zathura->database = zathura_sqldatabase_new(tmp); + g_free(tmp); +#endif + } else if (g_strcmp0(database, "null") != 0) { + girara_error("Database backend '%s' is not supported.", database); + } + + if (zathura->database == NULL && g_strcmp0(database, "null") != 0) { + girara_error( + "Unable to initialize database. Bookmarks won't be available."); + } + else { + g_object_set(G_OBJECT(zathura->ui.session->command_history), "io", + zathura->database, NULL); + } + g_free(database); +} + +static void +init_jumplist(zathura_t* zathura) +{ + int jumplist_size = 20; + girara_setting_get(zathura->ui.session, "jumplist-size", &jumplist_size); + + zathura->jumplist.max_size = jumplist_size < 0 ? 0 : jumplist_size; + zathura->jumplist.list = NULL; + zathura->jumplist.size = 0; + zathura->jumplist.cur = NULL; +} + +static void +init_shortcut_helpers(zathura_t* zathura) +{ zathura->shortcut.mouse.x = 0; zathura->shortcut.mouse.y = 0; zathura->shortcut.toggle_page_mode.pages = 2; - zathura->shortcut.toggle_presentation_mode.pages = 1; + zathura->shortcut.toggle_presentation_mode.pages = 1; zathura->shortcut.toggle_presentation_mode.first_page_column_list = NULL; - zathura->shortcut.toggle_presentation_mode.zoom = 1.0; + zathura->shortcut.toggle_presentation_mode.zoom = 1.0; +} + +bool +zathura_init(zathura_t* zathura) +{ + if (zathura == NULL) { + return false; + } + + /* create zathura (config/data) directory */ + create_directories(zathura); + + /* load plugins */ + zathura_plugin_manager_load(zathura->plugins.manager); + + /* configuration */ + config_load_default(zathura); + config_load_files(zathura); + + /* UI */ + if (!init_ui(zathura)) { + goto error_free; + } + + /* database */ + init_database(zathura); + + /* bookmarks */ + zathura->bookmarks.bookmarks = girara_sorted_list_new2( + (girara_compare_function_t)zathura_bookmarks_compare, + (girara_free_function_t)zathura_bookmark_free); + + /* jumplist */ + init_jumplist(zathura); + + /* CSS for index mode */ + init_css(zathura); + + /* Shortcut helpers */ + init_shortcut_helpers(zathura); /* Start D-Bus service */ bool dbus = true; @@ -345,7 +394,9 @@ zathura_free(zathura_t* zathura) } /* shortcut */ - g_free(zathura->shortcut.toggle_presentation_mode.first_page_column_list); + if (zathura->shortcut.toggle_presentation_mode.first_page_column_list != NULL) { + g_free(zathura->shortcut.toggle_presentation_mode.first_page_column_list); + } /* stdin support */ if (zathura->stdin_support.file != NULL) { @@ -538,9 +589,9 @@ prepare_document_open_from_stdin(const char* path) static gchar* prepare_document_open_from_gfile(GFile* source) { - gchar* file = NULL; + gchar* file = NULL; GFileIOStream* iostream = NULL; - GError* error = NULL; + GError* error = NULL; GFile *tmpfile = g_file_new_tmp("zathura.gio.XXXXXX", &iostream, &error); if (tmpfile == NULL) { From 48cf3a22e06ee7a2eafc5dc405bbd6c5b84bcb31 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Wed, 20 Jan 2016 02:43:56 +0100 Subject: [PATCH 14/29] Error out earlier Signed-off-by: Sebastian Ramacher --- zathura/zathura.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/zathura/zathura.c b/zathura/zathura.c index 70c4cd2..7665814 100644 --- a/zathura/zathura.c +++ b/zathura/zathura.c @@ -542,6 +542,11 @@ prepare_document_open_from_stdin(const char* path) return NULL; } + if (infileno == -1) { + girara_error("Can not read from file descriptor."); + return NULL; + } + GError* error = NULL; gchar* file = NULL; gint handle = g_file_open_tmp("zathura.stdin.XXXXXX", &file, &error); @@ -554,14 +559,6 @@ prepare_document_open_from_stdin(const char* path) } // read and dump to temporary file - if (infileno == -1) { - girara_error("Can not read from file descriptor."); - close(handle); - g_unlink(file); - g_free(file); - return NULL; - } - char buffer[BUFSIZ]; ssize_t count = 0; while ((count = read(infileno, buffer, BUFSIZ)) > 0) { From 241d302b0987ddd8fdb3f133b1d332e3c351715b Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Wed, 20 Jan 2016 04:11:51 +0100 Subject: [PATCH 15/29] Fix memory leak --- zathura/main.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/zathura/main.c b/zathura/main.c index 49f49f3..b81c630 100644 --- a/zathura/main.c +++ b/zathura/main.c @@ -184,6 +184,7 @@ main(int argc, char* argv[]) } g_option_context_free(context); + int ret = 0; set_log_level(loglevel); #ifdef WITH_SYNCTEX @@ -192,17 +193,20 @@ main(int argc, char* argv[]) if (argc != 2) { girara_error("Too many arguments or missing filename while running with " "--synctex-forward"); - return -1; + ret = -1; + goto free_and_ret; } - const int ret = run_synctex_forward(synctex_fwd, argv[1], synctex_pid); + ret = run_synctex_forward(synctex_fwd, argv[1], synctex_pid); if (ret > 0) { /* Instance found. */ - return 0; + ret = 0; + goto free_and_ret; } else if (ret < 0) { /* Error occurred. */ - return -1; + ret = -1; + goto free_and_ret; } girara_debug("No instance found. Starting new one."); @@ -213,7 +217,8 @@ main(int argc, char* argv[]) if (mode != NULL && g_strcmp0(mode, "presentation") != 0 && g_strcmp0(mode, "fullscreen") != 0) { girara_error("Invalid argument for --mode: %s", mode); - return -1; + ret = -1; + goto free_and_ret; } /* g_option_context_parse has some funny (documented) behavior: @@ -235,13 +240,15 @@ main(int argc, char* argv[]) if (setsid() == -1) { girara_error("Could not start new process group: %s", strerror(errno)); - return -1; + ret = -1; + goto free_and_ret; } break; } else if (pid < 0) { /* error */ girara_error("Could not fork: %s", strerror(errno)); - return -1; + ret = -1; + goto free_and_ret; } } } @@ -251,16 +258,18 @@ main(int argc, char* argv[]) file_idx < file_idx_base + 1) { const pid_t pid = fork(); if (pid > 0) { /* parent */ - return 0; + goto free_and_ret; } else if (pid < 0) { /* error */ girara_error("Could not fork: %s", strerror(errno)); - return -1; + ret = -1; + goto free_and_ret; } if (setsid() == -1) { girara_error("Could not start new process group: %s", strerror(errno)); - return -1; + ret = -1; + goto free_and_ret; } } @@ -272,7 +281,8 @@ main(int argc, char* argv[]) plugin_path, argv, synctex_editor, embed); if (zathura == NULL) { girara_error("Could not initialize zathura."); - return -1; + ret = -1; + goto free_and_ret; } /* Print version */ @@ -284,7 +294,7 @@ main(int argc, char* argv[]) } zathura_free(zathura); - return 0; + goto free_and_ret; } /* open document if passed */ @@ -302,5 +312,16 @@ main(int argc, char* argv[]) /* free zathura */ zathura_free(zathura); - return 0; +free_and_ret: + g_free(config_dir); + g_free(data_dir); + g_free(cache_dir); + g_free(plugin_path); + g_free(loglevel); + g_free(password); + g_free(synctex_editor); + g_free(synctex_fwd); + g_free(mode); + + return ret; } From d1c38a703c4161fe1690215214ec50193621b974 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Wed, 20 Jan 2016 04:12:10 +0100 Subject: [PATCH 16/29] Use GIO so we can later move the operation into the background Signed-off-by: Sebastian Ramacher --- zathura/zathura.c | 59 +++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/zathura/zathura.c b/zathura/zathura.c index 7665814..87f4adc 100644 --- a/zathura/zathura.c +++ b/zathura/zathura.c @@ -5,7 +5,6 @@ #include #include -#include #include #include @@ -21,6 +20,7 @@ #ifdef G_OS_UNIX #include +#include #endif #include "bookmarks.h" @@ -525,6 +525,7 @@ zathura_set_argv(zathura_t* zathura, char** argv) zathura->global.arguments = argv; } +#ifdef G_OS_UNIX static gchar* prepare_document_open_from_stdin(const char* path) { @@ -547,41 +548,46 @@ prepare_document_open_from_stdin(const char* path) return NULL; } - GError* error = NULL; - gchar* file = NULL; - gint handle = g_file_open_tmp("zathura.stdin.XXXXXX", &file, &error); - if (handle == -1) { + GInputStream* input_stream = g_unix_input_stream_new(infileno, false); + if (input_stream == NULL) { + girara_error("Can not read from file descriptor."); + return NULL; + + } + + GFileIOStream* iostream = NULL; + GError* error = NULL; + GFile* tmpfile = g_file_new_tmp("zathura.stdin.XXXXXX", &iostream, &error); + if (tmpfile == NULL) { if (error != NULL) { girara_error("Can not create temporary file: %s", error->message); g_error_free(error); } + g_object_unref(input_stream); return NULL; } - // read and dump to temporary file - char buffer[BUFSIZ]; - ssize_t count = 0; - while ((count = read(infileno, buffer, BUFSIZ)) > 0) { - if (write(handle, buffer, count) != count) { - girara_error("Can not write to temporary file: %s", file); - close(handle); - g_unlink(file); - g_free(file); - return NULL; + const ssize_t count = g_output_stream_splice( + g_io_stream_get_output_stream(G_IO_STREAM(iostream)), input_stream, + G_OUTPUT_STREAM_SPLICE_NONE, NULL, &error); + g_object_unref(input_stream); + g_object_unref(iostream); + if (count == -1) { + if (error != NULL) { + girara_error("Can not write to temporary file: %s", error->message); + g_error_free(error); } - } - - close(handle); - - if (count != 0) { - girara_error("Can not read from file descriptor."); - g_unlink(file); - g_free(file); + g_file_delete(tmpfile, NULL, NULL); + g_object_unref(tmpfile); return NULL; } + char* file = g_file_get_path(tmpfile); + g_object_unref(tmpfile); + return file; } +#endif static gchar* prepare_document_open_from_gfile(GFile* source) @@ -590,7 +596,7 @@ prepare_document_open_from_gfile(GFile* source) GFileIOStream* iostream = NULL; GError* error = NULL; - GFile *tmpfile = g_file_new_tmp("zathura.gio.XXXXXX", &iostream, &error); + GFile* tmpfile = g_file_new_tmp("zathura.gio.XXXXXX", &iostream, &error); if (tmpfile == NULL) { if (error != NULL) { girara_error("Can not create temporary file: %s", error->message); @@ -599,7 +605,8 @@ prepare_document_open_from_gfile(GFile* source) return NULL; } - gboolean rc = g_file_copy(source, tmpfile, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error); + gboolean rc = g_file_copy(source, tmpfile, G_FILE_COPY_OVERWRITE, NULL, NULL, + NULL, &error); if (rc == FALSE) { if (error != NULL) { girara_error("Can not copy to temporary file: %s", error->message); @@ -628,7 +635,9 @@ document_info_open(gpointer data) char* file = NULL; if (g_strcmp0(document_info->path, "-") == 0 || g_str_has_prefix(document_info->path, "/proc/self/fd/") == true) { +#ifdef G_OS_UNIX file = prepare_document_open_from_stdin(document_info->path); +#endif if (file == NULL) { girara_notify(document_info->zathura->ui.session, GIRARA_ERROR, _("Could not read file from stdin and write it to a temporary file.")); From e550ab66ee1b89b1d9439e8dc6d204f1200dcdf3 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Wed, 20 Jan 2016 13:45:46 +0100 Subject: [PATCH 17/29] Reduce amount of leaked memory by libmagic libmagic always leaks 48 bytes. Now we leak those bytes only once instead of every content type detection. Signed-off-by: Sebastian Ramacher --- zathura/content-type.c | 82 ++++++++++++++++++++++++++++++++---------- zathura/content-type.h | 19 +++++++++- zathura/document.c | 10 +++--- zathura/document.h | 6 ++-- zathura/types.h | 25 +++++++------ zathura/utils.c | 6 ++-- zathura/zathura.c | 9 ++++- zathura/zathura.h | 7 ++++ 8 files changed, 123 insertions(+), 41 deletions(-) diff --git a/zathura/content-type.c b/zathura/content-type.c index 5edcf10..9352da1 100644 --- a/zathura/content-type.c +++ b/zathura/content-type.c @@ -17,14 +17,23 @@ #include #include -/** 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 + 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 -static const char* -guess_type_magic(const char* path) { - const char* mime_type = NULL; - /* creat magic cookie */ const int flags = MAGIC_MIME_TYPE | @@ -36,31 +45,63 @@ 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; } + context->magic = magic; +#endif + + return context; +} + +void +zathura_content_type_free(zathura_content_type_context_t* context) +{ + if (context == NULL) { + return; + } + +#ifdef WITH_MAGIC + if (context->magic != NULL) { + magic_close(context->magic); + } +#endif + + 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 const 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(magic, path); + mime_type = magic_file(context->magic, path); if (mime_type == NULL) { - girara_debug("failed guessing filetype: %s", magic_error(magic)); - goto cleanup; + girara_debug("failed guessing filetype: %s", magic_error(context->magic)); + return NULL; } /* 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; } @@ -71,7 +112,9 @@ guess_type_file(const char* UNUSED(path)) } #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; } @@ -161,10 +204,11 @@ guess_type_glib(const char* path) } const char* -guess_content_type(const char* path) +zathura_content_type_guess(zathura_content_type_context_t* context, + const char* path) { /* try libmagic first */ - const char* content_type = guess_type_magic(path); + const char* content_type = guess_type_magic(context, path); if (content_type != NULL) { return content_type; } diff --git a/zathura/content-type.h b/zathura/content-type.h index fca53d1..c02d937 100644 --- a/zathura/content-type.h +++ b/zathura/content-type.h @@ -3,6 +3,22 @@ #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. @@ -10,6 +26,7 @@ * @param path file name * @return content type of path */ -const char* guess_content_type(const char* path); +const char* zathura_content_type_guess(zathura_content_type_context_t* context, + const char* path); #endif diff --git a/zathura/document.c b/zathura/document.c index fb03f65..f4563b7 100644 --- a/zathura/document.c +++ b/zathura/document.c @@ -61,10 +61,10 @@ 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; } @@ -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); diff --git a/zathura/document.h b/zathura/document.h index 6880d07..8992dab 100644 --- a/zathura/document.h +++ b/zathura/document.h @@ -11,14 +11,14 @@ /** * 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); /** diff --git a/zathura/types.h b/zathura/types.h index 380e4f7..7f8a65e 100644 --- a/zathura/types.h +++ b/zathura/types.h @@ -148,7 +148,7 @@ typedef struct zathura_image_s typedef enum zathura_link_type_e { ZATHURA_LINK_INVALID, /**< Invalid type */ - ZATHURA_LINK_NONE, /**< No action */ + ZATHURA_LINK_NONE, /**< No action */ ZATHURA_LINK_GOTO_DEST, /**< Links to a page */ ZATHURA_LINK_GOTO_REMOTE, /**< Links to a page */ ZATHURA_LINK_URI, /**< Links to an external source */ @@ -158,15 +158,15 @@ typedef enum zathura_link_type_e typedef enum zathura_link_destination_type_e { - ZATHURA_LINK_DESTINATION_UNKNOWN, - ZATHURA_LINK_DESTINATION_XYZ, - ZATHURA_LINK_DESTINATION_FIT, - ZATHURA_LINK_DESTINATION_FITH, - ZATHURA_LINK_DESTINATION_FITV, - ZATHURA_LINK_DESTINATION_FITR, - ZATHURA_LINK_DESTINATION_FITB, - ZATHURA_LINK_DESTINATION_FITBH, - ZATHURA_LINK_DESTINATION_FITBV + ZATHURA_LINK_DESTINATION_UNKNOWN, + ZATHURA_LINK_DESTINATION_XYZ, + ZATHURA_LINK_DESTINATION_FIT, + ZATHURA_LINK_DESTINATION_FITH, + ZATHURA_LINK_DESTINATION_FITV, + ZATHURA_LINK_DESTINATION_FITR, + ZATHURA_LINK_DESTINATION_FITB, + ZATHURA_LINK_DESTINATION_FITBH, + ZATHURA_LINK_DESTINATION_FITBV } zathura_link_destination_type_t; typedef struct zathura_link_target_s @@ -255,4 +255,9 @@ zathura_document_information_entry_new(zathura_document_information_type_t */ void zathura_document_information_entry_free(zathura_document_information_entry_t* entry); +/** + * Context for MIME type detection + */ +typedef struct zathura_content_type_context_s zathura_content_type_context_t; + #endif // TYPES_H diff --git a/zathura/utils.c b/zathura/utils.c index 531196c..ea5bc2b 100644 --- a/zathura/utils.c +++ b/zathura/utils.c @@ -52,12 +52,14 @@ file_valid_extension(zathura_t* zathura, const char* path) return false; } - const gchar* content_type = guess_content_type(path); + const gchar* content_type = + zathura_content_type_guess(zathura->content_type_context, path); if (content_type == NULL) { return false; } - zathura_plugin_t* plugin = zathura_plugin_manager_get_plugin(zathura->plugins.manager, content_type); + zathura_plugin_t* plugin = + zathura_plugin_manager_get_plugin(zathura->plugins.manager, content_type); g_free((void*)content_type); return (plugin == NULL) ? false : true; diff --git a/zathura/zathura.c b/zathura/zathura.c index 87f4adc..163063b 100644 --- a/zathura/zathura.c +++ b/zathura/zathura.c @@ -43,6 +43,7 @@ #include "dbus-interface.h" #include "css-definitions.h" #include "synctex.h" +#include "content-type.h" typedef struct zathura_document_info_s { zathura_t* zathura; @@ -103,6 +104,9 @@ zathura_create(void) zathura->signals.sigterm = g_unix_signal_add(SIGTERM, zathura_signal_sigterm, zathura); #endif + /* MIME type detection */ + zathura->content_type_context = zathura_content_type_new(); + zathura->ui.session->global.data = zathura; return zathura; @@ -376,6 +380,9 @@ zathura_free(zathura_t* zathura) document_close(zathura, false); + /* MIME type detection */ + zathura_content_type_free(zathura->content_type_context); + #ifdef G_OS_UNIX if (zathura->signals.sigterm > 0) { g_source_remove(zathura->signals.sigterm); @@ -760,7 +767,7 @@ document_open(zathura_t* zathura, const char* path, const char* uri, const char* gchar* file_uri = NULL; zathura_error_t error = ZATHURA_ERROR_OK; - zathura_document_t* document = zathura_document_open(zathura->plugins.manager, path, uri, password, &error); + zathura_document_t* document = zathura_document_open(zathura, path, uri, password, &error); if (document == NULL) { if (error == ZATHURA_ERROR_INVALID_PASSWORD) { diff --git a/zathura/zathura.h b/zathura/zathura.h index e536b56..66b3744 100644 --- a/zathura/zathura.h +++ b/zathura/zathura.h @@ -6,7 +6,9 @@ #include #include #include +#ifdef GDK_WINDOWING_X11 #include +#endif #include "macros.h" #include "types.h" @@ -222,6 +224,11 @@ struct zathura_s double zoom; } toggle_presentation_mode; } shortcut; + + /** + * Context for MIME type detection + */ + zathura_content_type_context_t* content_type_context; }; /** From dd67476912da7ac1ecbbe2bc4636518e52a135cf Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Wed, 20 Jan 2016 15:13:27 +0100 Subject: [PATCH 18/29] Do not mention help It's not implemented. Signed-off-by: Sebastian Ramacher --- doc/man/_commands.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/man/_commands.txt b/doc/man/_commands.txt index b7acbd4..114ef2a 100644 --- a/doc/man/_commands.txt +++ b/doc/man/_commands.txt @@ -16,9 +16,6 @@ exec info Show document information -help - Show help page - open Open a document From 8946015219148258b47908d26e853ff5ebba0b90 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Wed, 20 Jan 2016 15:25:08 +0100 Subject: [PATCH 19/29] Fix return type Signed-off-by: Sebastian Ramacher --- zathura/content-type.c | 20 +++++++++----------- zathura/content-type.h | 6 +++--- zathura/document.c | 4 ++-- zathura/utils.c | 8 +++----- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/zathura/content-type.c b/zathura/content-type.c index 9352da1..3440973 100644 --- a/zathura/content-type.c +++ b/zathura/content-type.c @@ -82,7 +82,7 @@ zathura_content_type_free(zathura_content_type_context_t* context) static const size_t GT_MAX_READ = 1 << 16; #ifdef WITH_MAGIC -static const char* +static char* guess_type_magic(zathura_content_type_context_t* context, const char* path) { if (context == NULL || context->magic == NULL) { @@ -97,15 +97,13 @@ guess_type_magic(zathura_content_type_context_t* context, const char* path) girara_debug("failed guessing filetype: %s", magic_error(context->magic)); return NULL; } - /* dup so we own the memory */ - mime_type = g_strdup(mime_type); - 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; @@ -118,7 +116,7 @@ guess_type_magic(zathura_content_type_context_t* UNUSED(context), return NULL; } -static const char* +static char* guess_type_file(const char* path) { GString* command = g_string_new("file -b --mime-type "); @@ -149,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 { @@ -203,12 +201,12 @@ guess_type_glib(const char* path) return NULL; } -const char* +char* zathura_content_type_guess(zathura_content_type_context_t* context, const char* path) { /* try libmagic first */ - const char* content_type = guess_type_magic(context, path); + char* content_type = guess_type_magic(context, path); if (content_type != NULL) { return content_type; } diff --git a/zathura/content-type.h b/zathura/content-type.h index c02d937..9bd367d 100644 --- a/zathura/content-type.h +++ b/zathura/content-type.h @@ -24,9 +24,9 @@ void zathura_content_type_free(zathura_content_type_context_t* context); * 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* zathura_content_type_guess(zathura_content_type_context_t* context, - const char* path); +char* zathura_content_type_guess(zathura_content_type_context_t* context, + const char* path); #endif diff --git a/zathura/document.c b/zathura/document.c index f4563b7..7ed9acb 100644 --- a/zathura/document.c +++ b/zathura/document.c @@ -70,7 +70,7 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* uri, 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; @@ -106,7 +106,7 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* uri, goto error_free; } - g_free((void*)content_type); + g_free(content_type); content_type = NULL; document = g_try_malloc0(sizeof(zathura_document_t)); diff --git a/zathura/utils.c b/zathura/utils.c index ea5bc2b..d99a461 100644 --- a/zathura/utils.c +++ b/zathura/utils.c @@ -52,15 +52,13 @@ file_valid_extension(zathura_t* zathura, const char* path) return false; } - const gchar* content_type = - zathura_content_type_guess(zathura->content_type_context, path); + char* content_type = zathura_content_type_guess(zathura->content_type_context, path); if (content_type == NULL) { return false; } - zathura_plugin_t* plugin = - zathura_plugin_manager_get_plugin(zathura->plugins.manager, content_type); - g_free((void*)content_type); + zathura_plugin_t* plugin = zathura_plugin_manager_get_plugin(zathura->plugins.manager, content_type); + g_free(content_type); return (plugin == NULL) ? false : true; } From 80a0ae9f18436b63b49105cc69a2dc4f08b607b1 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Sat, 30 Jan 2016 12:06:12 +0100 Subject: [PATCH 20/29] Fix some spelling mistakes Signed-off-by: Sebastian Ramacher --- zathura/callbacks.h | 6 ++--- zathura/commands.h | 36 +++++++++++++++--------------- zathura/completion.h | 6 ++--- zathura/document.h | 18 +++++++-------- zathura/marks.h | 8 +++---- zathura/page-widget.h | 2 +- zathura/page.h | 32 +++++++++++++------------- zathura/plugin.h | 2 +- zathura/render.h | 4 ++-- zathura/shortcuts.h | 52 +++++++++++++++++++++---------------------- zathura/types.h | 10 ++++----- zathura/utils.h | 4 ++-- zathura/zathura.h | 12 +++++----- 13 files changed, 96 insertions(+), 96 deletions(-) diff --git a/zathura/callbacks.h b/zathura/callbacks.h index 148ed71..eb41db9 100644 --- a/zathura/callbacks.h +++ b/zathura/callbacks.h @@ -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); diff --git a/zathura/commands.h b/zathura/commands.h index 1327068..6d65f06 100644 --- a/zathura/commands.h +++ b/zathura/commands.h @@ -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); diff --git a/zathura/completion.h b/zathura/completion.h index 6d17868..14e8460 100644 --- a/zathura/completion.h +++ b/zathura/completion.h @@ -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); diff --git a/zathura/document.h b/zathura/document.h index 8992dab..3118f30 100644 --- a/zathura/document.h +++ b/zathura/document.h @@ -25,7 +25,7 @@ zathura_document_t* zathura_document_open(zathura_t* zathura, * 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 + * error occurred * @return List of attachments */ girara_list_t* zathura_document_attachments_get(zathura_document_t* document, zathura_error_t* error); @@ -343,7 +343,7 @@ girara_list_t* zathura_document_attachments_get(zathura_document_t* document, za * @param document The document objects * @param attachment name of the attachment * @param file the target filename - * @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_attachment_save(zathura_document_t* document, const char* attachment, const char* file); @@ -353,8 +353,8 @@ zathura_error_t zathura_document_attachment_save(zathura_document_t* document, c * * @param document The zathura document * @param error Set to an error value (see \ref zathura_error_t) if an - * error occured - * @return List of document information entries or NULL if information could not be retreived + * error occurred + * @return List of document information entries or NULL if information could not be retrieved */ girara_list_t* zathura_document_get_information(zathura_document_t* document, zathura_error_t* error); diff --git a/zathura/marks.h b/zathura/marks.h index b821f52..64d3329 100644 --- a/zathura/marks.h +++ b/zathura/marks.h @@ -16,7 +16,7 @@ typedef struct zathura_mark_s zathura_mark_t; * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_mark_add(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -28,7 +28,7 @@ bool sc_mark_add(girara_session_t* session, girara_argument_t* argument, * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_mark_evaluate(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -38,7 +38,7 @@ bool sc_mark_evaluate(girara_session_t* session, girara_argument_t* argument, * * @param session The girara session * @param argument_list Argument list - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool cmd_marks_add(girara_session_t* session, girara_list_t* argument_list); @@ -47,7 +47,7 @@ bool cmd_marks_add(girara_session_t* session, girara_list_t* argument_list); * * @param session The girara session * @param argument_list Argument list - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool cmd_marks_delete(girara_session_t* session, girara_list_t* argument_list); diff --git a/zathura/page-widget.h b/zathura/page-widget.h index 30e99c7..d18c63f 100644 --- a/zathura/page-widget.h +++ b/zathura/page-widget.h @@ -75,7 +75,7 @@ void zathura_page_widget_clear_rectangles(ZathuraPage* widget); * * @param widget the widget * @param index Index of the link - * @return Link object or NULL if an error occured + * @return Link object or NULL if an error occurred */ zathura_link_t* zathura_page_widget_link_get(ZathuraPage* widget, unsigned int index); /** diff --git a/zathura/page.h b/zathura/page.h index dbac902..d8f260e 100644 --- a/zathura/page.h +++ b/zathura/page.h @@ -14,7 +14,7 @@ * @param document The document * @param index Page number * @param error Optional error - * @return Page object or NULL if an error occured + * @return Page object or NULL if an error occurred */ zathura_page_t* zathura_page_new(zathura_document_t* document, unsigned int index, zathura_error_t* error); @@ -23,7 +23,7 @@ zathura_page_t* zathura_page_new(zathura_document_t* document, unsigned int * Frees the page object * * @param page The page object - * @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_page_free(zathura_page_t* page); @@ -33,7 +33,7 @@ zathura_error_t zathura_page_free(zathura_page_t* page); * * @param page The page object * @return The associated document - * @return NULL if an error occured + * @return NULL if an error occurred */ zathura_document_t* zathura_page_get_document(zathura_page_t* page); @@ -50,7 +50,7 @@ unsigned int zathura_page_get_index(zathura_page_t* page); * * @param page The page object * @return Width of the page - * @return -1 If an error occured + * @return -1 If an error occurred */ double zathura_page_get_width(zathura_page_t* page); @@ -67,7 +67,7 @@ void zathura_page_set_width(zathura_page_t* page, double width); * * @param page The page object * @return Height of the page - * @return -1 If an error occured + * @return -1 If an error occurred */ double zathura_page_get_height(zathura_page_t* page); @@ -118,7 +118,7 @@ void zathura_page_set_data(zathura_page_t* page, void* data); * @param page The page object * @param text Search item * @param error Set to an error value (see \ref zathura_error_t) if an - * error occured + * error occurred * @return List of results */ girara_list_t* zathura_page_search_text(zathura_page_t* page, const char* text, zathura_error_t* error); @@ -128,7 +128,7 @@ girara_list_t* zathura_page_search_text(zathura_page_t* page, const char* text, * * @param page The page object * @param error Set to an error value (see \ref zathura_error_t) if an - * error occured + * error occurred * @return List of links */ girara_list_t* zathura_page_links_get(zathura_page_t* page, zathura_error_t* error); @@ -137,7 +137,7 @@ girara_list_t* zathura_page_links_get(zathura_page_t* page, zathura_error_t* err * Free page links * * @param list List of links - * @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_page_links_free(girara_list_t* list); @@ -147,7 +147,7 @@ zathura_error_t zathura_page_links_free(girara_list_t* list); * * @param page The page object * @param error Set to an error value (see \ref zathura_error_t) if an - * error occured + * error occurred * @return List of form fields */ girara_list_t* zathura_page_form_fields_get(zathura_page_t* page, zathura_error_t* error); @@ -156,7 +156,7 @@ girara_list_t* zathura_page_form_fields_get(zathura_page_t* page, zathura_error_ * Free list of form fields * * @param list List of form fields - * @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_page_form_fields_free(girara_list_t* list); @@ -166,8 +166,8 @@ zathura_error_t zathura_page_form_fields_free(girara_list_t* list); * * @param page Page * @param error Set to an error value (see \ref zathura_error_t) if an - * error occured - * @return List of images or NULL if an error occured + * error occurred + * @return List of images or NULL if an error occurred */ girara_list_t* zathura_page_images_get(zathura_page_t* page, zathura_error_t* error); @@ -177,8 +177,8 @@ girara_list_t* zathura_page_images_get(zathura_page_t* page, zathura_error_t* er * @param page Page * @param image Image identifier * @param error Set to an error value (see \ref zathura_error_t) if an - * error occured - * @return The cairo image surface or NULL if an error occured + * error occurred + * @return The cairo image surface or NULL if an error occurred */ cairo_surface_t* zathura_page_image_get_cairo(zathura_page_t* page, zathura_image_t* image, zathura_error_t* error); @@ -187,7 +187,7 @@ cairo_surface_t* zathura_page_image_get_cairo(zathura_page_t* page, zathura_imag * @param page Page * @param rectangle Selection * @param error Set to an error value (see \ref zathura_error_t) if an error - * occured + * occurred * @return The selected text (needs to be deallocated with g_free) */ char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, zathura_error_t* error); @@ -198,7 +198,7 @@ char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, * @param page The page object * @param cairo Cairo object * @param printing render for printing - * @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_page_render(zathura_page_t* page, cairo_t* cairo, bool printing); diff --git a/zathura/plugin.h b/zathura/plugin.h index 799159f..5578ee1 100644 --- a/zathura/plugin.h +++ b/zathura/plugin.h @@ -27,7 +27,7 @@ typedef struct zathura_plugin_version_s { /** * Creates a new instance of the plugin manager * - * @return A plugin manager object or NULL if an error occured + * @return A plugin manager object or NULL if an error occurred */ zathura_plugin_manager_t* zathura_plugin_manager_new(void); diff --git a/zathura/render.h b/zathura/render.h index f832cf9..c250e27 100644 --- a/zathura/render.h +++ b/zathura/render.h @@ -55,7 +55,7 @@ bool zathura_renderer_recolor_enabled(ZathuraRenderer* renderer); /** * Enable/disable recoloring. * @param renderer a renderer object - * @param enable wheter to enable or disable recoloring + * @param enable whether to enable or disable recoloring */ void zathura_renderer_enable_recolor(ZathuraRenderer* renderer, bool enable); /** @@ -67,7 +67,7 @@ bool zathura_renderer_recolor_hue_enabled(ZathuraRenderer* renderer); /** * Enable/disable preservation of hue while recoloring. * @param renderer a renderer object - * @param enable wheter to enable or disable hue preservation + * @param enable whether to enable or disable hue preservation */ void zathura_renderer_enable_recolor_hue(ZathuraRenderer* renderer, bool enable); diff --git a/zathura/shortcuts.h b/zathura/shortcuts.h index 7fce02f..dc3c30f 100644 --- a/zathura/shortcuts.h +++ b/zathura/shortcuts.h @@ -12,7 +12,7 @@ * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_abort(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -23,7 +23,7 @@ bool sc_abort(girara_session_t* session, girara_argument_t* argument, girara_eve * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_adjust_window(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -34,7 +34,7 @@ bool sc_adjust_window(girara_session_t* session, girara_argument_t* argument, gi * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_change_mode(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -45,7 +45,7 @@ bool sc_change_mode(girara_session_t* session, girara_argument_t* argument, gira * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_display_link(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -56,8 +56,8 @@ bool sc_display_link(girara_session_t* session, girara_argument_t* argument, gir * @param argument The argument * @param event Girara event * @param t Number of executions - * @return true No error occured - * @return false An error occured (abort execution) + * @return true No error occurred + * @return false An error occurred (abort execution) */ bool sc_focus_inputbar(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -68,7 +68,7 @@ bool sc_focus_inputbar(girara_session_t* session, girara_argument_t* argument, g * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_follow(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -79,7 +79,7 @@ bool sc_follow(girara_session_t* session, girara_argument_t* argument, girara_ev * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_goto(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -90,7 +90,7 @@ bool sc_goto(girara_session_t* session, girara_argument_t* argument, girara_even * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_mouse_scroll(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -101,7 +101,7 @@ bool sc_mouse_scroll(girara_session_t* session, girara_argument_t* argument, gir * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_mouse_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -112,7 +112,7 @@ bool sc_mouse_zoom(girara_session_t* session, girara_argument_t* argument, girar * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_navigate(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -123,7 +123,7 @@ bool sc_navigate(girara_session_t* session, girara_argument_t* argument, girara_ * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_print(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -134,7 +134,7 @@ bool sc_print(girara_session_t* session, girara_argument_t* argument, girara_eve * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_recolor(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -145,7 +145,7 @@ bool sc_recolor(girara_session_t* session, girara_argument_t* argument, girara_e * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_reload(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -156,7 +156,7 @@ bool sc_reload(girara_session_t* session, girara_argument_t* argument, girara_ev * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_rotate(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -167,7 +167,7 @@ bool sc_rotate(girara_session_t* session, girara_argument_t* argument, girara_ev * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_scroll(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -178,7 +178,7 @@ bool sc_scroll(girara_session_t* session, girara_argument_t* argument, girara_ev * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_jumplist(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -189,7 +189,7 @@ bool sc_jumplist(girara_session_t* session, girara_argument_t* argument, girara_ * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_bisect(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -200,7 +200,7 @@ bool sc_bisect(girara_session_t* session, girara_argument_t* argument, girara_ev * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_search(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -211,7 +211,7 @@ bool sc_search(girara_session_t* session, girara_argument_t* argument, girara_ev * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_navigate_index(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -222,7 +222,7 @@ bool sc_navigate_index(girara_session_t* session, girara_argument_t* argument, g * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_toggle_index(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -233,7 +233,7 @@ bool sc_toggle_index(girara_session_t* session, girara_argument_t* argument, gir * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_toggle_page_mode(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -244,7 +244,7 @@ bool sc_toggle_page_mode(girara_session_t* session, girara_argument_t* argument, * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_toggle_fullscreen(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -255,7 +255,7 @@ bool sc_toggle_fullscreen(girara_session_t* session, girara_argument_t* argument * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_toggle_presentation(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -266,7 +266,7 @@ bool sc_toggle_presentation(girara_session_t* session, girara_argument_t* argume * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_quit(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); @@ -277,7 +277,7 @@ bool sc_quit(girara_session_t* session, girara_argument_t* argument, girara_even * @param argument The used argument * @param event Girara event * @param t Number of executions - * @return true if no error occured otherwise false + * @return true if no error occurred otherwise false */ bool sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t); diff --git a/zathura/types.h b/zathura/types.h index 7f8a65e..de87eaa 100644 --- a/zathura/types.h +++ b/zathura/types.h @@ -45,8 +45,8 @@ typedef struct zathura_dbus_s ZathuraDbus; */ typedef enum zathura_plugin_error_e { - ZATHURA_ERROR_OK, /**< No error occured */ - ZATHURA_ERROR_UNKNOWN, /**< An unknown error occured */ + ZATHURA_ERROR_OK, /**< No error occurred */ + ZATHURA_ERROR_UNKNOWN, /**< An unknown error occurred */ ZATHURA_ERROR_OUT_OF_MEMORY, /**< Out of memory */ ZATHURA_ERROR_NOT_IMPLEMENTED, /**< The called function has not been implemented */ ZATHURA_ERROR_INVALID_ARGUMENTS, /**< Invalid arguments have been passed */ @@ -109,7 +109,7 @@ typedef enum zathura_adjust_mode_e * * @param width Width of the image stored in the buffer * @param height Height of the image stored in the buffer - * @return Image buffer or NULL if an error occured + * @return Image buffer or NULL if an error occurred */ zathura_image_buffer_t* zathura_image_buffer_create(unsigned int width, unsigned int height); @@ -232,7 +232,7 @@ void zathura_index_element_free(zathura_index_element_t* index); * Creates a list that should be used to store \ref * zathura_document_information_entry_t entries * - * @return A list or NULL if an error occured + * @return A list or NULL if an error occurred */ girara_list_t* zathura_document_information_entry_list_new(); @@ -242,7 +242,7 @@ girara_list_t* zathura_document_information_entry_list_new(); * @param type The type * @param value The value * - * @return A new entry or NULL if an error occured + * @return A new entry or NULL if an error occurred */ zathura_document_information_entry_t* zathura_document_information_entry_new(zathura_document_information_type_t diff --git a/zathura/utils.h b/zathura/utils.h index a1902f0..c30d3f9 100644 --- a/zathura/utils.h +++ b/zathura/utils.h @@ -28,7 +28,7 @@ typedef struct page_offset_s bool file_valid_extension(zathura_t* zathura, const char* path); /** - * Generates the document index based upon the list retreived from the document + * Generates the document index based upon the list retrieved from the document * object. * * @param model The tree model @@ -64,7 +64,7 @@ zathura_rectangle_t recalc_rectangle(zathura_page_t* page, zathura_rectangle_t r * @param zathura The zathura instance * @param page The page object * @return The page widget of the page - * @return NULL if an error occured + * @return NULL if an error occurred */ GtkWidget* zathura_page_get_widget(zathura_t* zathura, zathura_page_t* page); diff --git a/zathura/zathura.h b/zathura/zathura.h index 66b3744..904b938 100644 --- a/zathura/zathura.h +++ b/zathura/zathura.h @@ -311,7 +311,7 @@ void zathura_set_argv(zathura_t* zathura, char** argv); * @param password The password of the file * @param page_number Open given page number * - * @return If no error occured true, otherwise false, is returned. + * @return If no error occurred true, otherwise false, is returned. */ bool document_open(zathura_t* zathura, const char* path, const char* uri, const char* password, int page_number); @@ -324,7 +324,7 @@ bool document_open(zathura_t* zathura, const char* path, const char* uri, const * @param password The password of the file * @param synctex Open at the given SyncTeX string * - * @return If no error occured true, otherwise false, is returned. + * @return If no error occurred true, otherwise false, is returned. */ bool document_open_synctex(zathura_t* zathura, const char* path, const char* uri, const char* password, const char* synctex); @@ -350,7 +350,7 @@ void document_open_idle(zathura_t* zathura, const char* path, * @param path The path * @param overwrite Overwrite existing file * - * @return If no error occured true, otherwise false, is returned. + * @return If no error occurred true, otherwise false, is returned. */ bool document_save(zathura_t* zathura, const char* path, bool overwrite); @@ -359,7 +359,7 @@ bool document_save(zathura_t* zathura, const char* path, bool overwrite); * * @param zathura The zathura session * @param keep_monitor Set to true if monitor should be kept (sc_reload) - * @return If no error occured true, otherwise false, is returned. + * @return If no error occurred true, otherwise false, is returned. */ bool document_close(zathura_t* zathura, bool keep_monitor); @@ -368,7 +368,7 @@ bool document_close(zathura_t* zathura, bool keep_monitor); * * @param zathura The zathura session * @param page_id The id of the page that should be set - * @return If no error occured true, otherwise false, is returned. + * @return If no error occurred true, otherwise false, is returned. */ bool page_set(zathura_t* zathura, unsigned int page_id); @@ -378,7 +378,7 @@ bool page_set(zathura_t* zathura, unsigned int page_id); * @param zathura Zathura session * @param position_x X coordinate * @param position_y Y coordinate - * @return If no error occured true, otherwise false, is returned. + * @return If no error occurred true, otherwise false, is returned. */ bool position_set(zathura_t* zathura, double position_x, double position_y); From ec615d562f3a0ec14387717091c4ec4df7f06c4c Mon Sep 17 00:00:00 2001 From: Louisvh Date: Fri, 5 Feb 2016 04:05:13 +0100 Subject: [PATCH 21/29] Removed unnecessary ifdef, fixed compiler warning If WITH_SYNCTEX is not defined, synctex_editor will always be NULL, so the ifdef is not needed. This gets rid of the "unused variable" warning when compiling without synctex. --- zathura/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/zathura/main.c b/zathura/main.c index b81c630..2671e4c 100644 --- a/zathura/main.c +++ b/zathura/main.c @@ -114,12 +114,10 @@ init_zathura(const char* config_dir, const char* data_dir, return NULL; } -#ifdef WITH_SYNCTEX if (synctex_editor != NULL) { girara_setting_set(zathura->ui.session, "synctex-editor-command", synctex_editor); } -#endif return zathura; } From 9af0064fe2a04a6385b6d4bc52160b0f110de1bd Mon Sep 17 00:00:00 2001 From: Louisvh Date: Fri, 5 Feb 2016 04:18:56 +0100 Subject: [PATCH 22/29] Added quickmark functions to bindable shortcuts. `mark_add` and `mark_evaluate` are now available as rebindable shortcuts. Also added an entry in the zathurarc.5 manpage. --- doc/man/zathurarc.5.rst | 7 +++++++ zathura/config.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/doc/man/zathurarc.5.rst b/doc/man/zathurarc.5.rst index d52c875..c70f524 100644 --- a/doc/man/zathurarc.5.rst +++ b/doc/man/zathurarc.5.rst @@ -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 diff --git a/zathura/config.c b/zathura/config.c index 626f495..f0037ec 100644 --- a/zathura/config.c +++ b/zathura/config.c @@ -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); From 17fcde2ec036a7fdd6d0cb4886a0876948ab6fc9 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Fri, 5 Feb 2016 10:55:05 +0100 Subject: [PATCH 23/29] Fix typo Signed-off-by: Sebastian Ramacher --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index c7bdc22..55f43aa 100644 --- a/README +++ b/README @@ -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) From 963b986982edbe1378c7181c36b86649911f8177 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Mon, 8 Feb 2016 22:30:34 +0100 Subject: [PATCH 24/29] Make sure direcotires exist Signed-off-by: Sebastian Ramacher --- doc/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 28b8f2d..c28150d 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -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 From 5007167abfe074105f8da7c20b2a4efb43bf8ebd Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Mon, 8 Feb 2016 22:41:05 +0100 Subject: [PATCH 25/29] Remove an extra space Signed-off-by: Sebastian Ramacher --- doc/usage/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/usage/index.rst b/doc/usage/index.rst index d24096f..a1e1e64 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -5,4 +5,4 @@ Usage :maxdepth: 2 :numbered: - commands + commands From 5b320756975cebc98431f11b2ed07bf745f0460d Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Mon, 8 Feb 2016 22:44:22 +0100 Subject: [PATCH 26/29] Fix dependencies Signed-off-by: Sebastian Ramacher --- doc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index c28150d..7e36b9d 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -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 From daa5443098bb23d73e143655666fa25578e2a433 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Mon, 8 Feb 2016 22:50:47 +0100 Subject: [PATCH 27/29] Fix POTFILES.in generation Signed-off-by: Sebastian Ramacher --- po/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/Makefile b/po/Makefile index cebea0e..2d60065 100644 --- a/po/Makefile +++ b/po/Makefile @@ -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 $@ From cc03b079d24ea004654596d5ff40de28f18d853c Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Tue, 9 Feb 2016 01:54:48 +0100 Subject: [PATCH 28/29] Update LICENSE file --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index ccbeea4..2244d16 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -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 From c085f8b40ee8e196621dc89a06ba9cae5d608349 Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Sun, 14 Feb 2016 23:52:38 +0100 Subject: [PATCH 29/29] Version 0.3.5 --- config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.mk b/config.mk index 96c4009..d529e79 100644 --- a/config.mk +++ b/config.mk @@ -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.