Commit f8bc1302 authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'develop'

parents 09315c6b 1999c355
...@@ -17,3 +17,6 @@ Johannes Meng <j@jmeng.de> ...@@ -17,3 +17,6 @@ Johannes Meng <j@jmeng.de>
J. Commelin <jcommeli@math.leidenuniv.nl> J. Commelin <jcommeli@math.leidenuniv.nl>
Julian Orth <ju.orth@googlemail.com> Julian Orth <ju.orth@googlemail.com>
Roland Schatz <roland.schatz@students.jku.at> Roland Schatz <roland.schatz@students.jku.at>
Abdó Roig-Maranges <abdo.roig@gmail.com>
Benoît Knecht <benoit.knecht@gmail.com>
Rob Cornish <jrmcornish@gmail.com>
...@@ -78,8 +78,11 @@ clean: ...@@ -78,8 +78,11 @@ clean:
${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc doc version.h \ ${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc doc version.h \
*gcda *gcno $(PROJECT).info gcov *.tmp \ *gcda *gcno $(PROJECT).info gcov *.tmp \
girara-version-check girara-version-check
$(QUIET)make -C tests clean ifneq "$(wildcard ${RSTTOMAN})" ""
$(QUIET)make -C po clean $(QUIET)rm -f zathura.1 zathurarc.5
endif
$(QUIET)$(MAKE) -C tests clean
$(QUIET)$(MAKE) -C po clean
${PROJECT}-debug: ${DOBJECTS} ${PROJECT}-debug: ${DOBJECTS}
$(ECHO) CC -o $@ $(ECHO) CC -o $@
...@@ -141,7 +144,8 @@ update-po: ...@@ -141,7 +144,8 @@ update-po:
ifneq "$(wildcard ${RSTTOMAN})" "" ifneq "$(wildcard ${RSTTOMAN})" ""
%.1 %.5: config.mk %.1 %.5: config.mk
$(QUIET)sed "s/VERSION/${VERSION}/g" < $@.rst > $@.tmp $(QUIET)sed "s/VERSION/${VERSION}/g" < $@.rst > $@.tmp
$(QUIET)${RSTTOMAN} $@.tmp > $@ $(QUIET)${RSTTOMAN} $@.tmp > $@.out.tmp
$(QUIET)mv $@.out.tmp $@
$(QUIET)rm $@.tmp $(QUIET)rm $@.tmp
${PROJECT}.1: ${PROJECT}.1.rst ${PROJECT}.1: ${PROJECT}.1.rst
......
zathura - a document viewer zathura - a document viewer
-------------------- ===========================
zathura is a highly customizable and functional document viewer based on the zathura is a highly customizable and functional document viewer based on the
girara user interface library and several document libraries. girara user interface library and several document libraries.
Requirements Requirements
------------ ------------
gtk2 (>= 2.18.6) gtk2 (>= 2.28)
girara girara
sqlite3 (>= 3.5.9) sqlite3 (>= 3.5.9)
check (for tests) check (for tests)
intltool intltool
python-docutils (for man pages)
Please note that you need to have a working pkg-config installation and that the Please note that you need to have a working pkg-config installation and that the
Makefile is only compatible with GNU make. If you don't have a working Makefile is only compatible with GNU make. If you don't have a working
......
...@@ -87,7 +87,8 @@ zathura_bookmark_free(zathura_bookmark_t* bookmark) ...@@ -87,7 +87,8 @@ zathura_bookmark_free(zathura_bookmark_t* bookmark)
} }
bool bool
zathura_bookmarks_load(zathura_t* zathura, const gchar* file) { zathura_bookmarks_load(zathura_t* zathura, const gchar* file)
{
g_return_val_if_fail(zathura, false); g_return_val_if_fail(zathura, false);
g_return_val_if_fail(file, false); g_return_val_if_fail(file, false);
......
...@@ -58,20 +58,23 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi ...@@ -58,20 +58,23 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
GtkAdjustment* view_vadjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)); GtkAdjustment* view_vadjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
GtkAdjustment* view_hadjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)); GtkAdjustment* view_hadjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
GdkRectangle view_rect; /* current adjustment values */
/* get current adjustment values */ GdkRectangle view_rect = {
view_rect.y = 0; .x = 0,
view_rect.height = gtk_adjustment_get_page_size(view_vadjustment); .y = 0,
view_rect.x = 0; .width = gtk_adjustment_get_page_size(view_hadjustment),
view_rect.width = gtk_adjustment_get_page_size(view_hadjustment); .height = gtk_adjustment_get_page_size(view_vadjustment)
};
int page_padding = 1; int page_padding = 1;
girara_setting_get(zathura->ui.session, "page-padding", &page_padding); girara_setting_get(zathura->ui.session, "page-padding", &page_padding);
GdkRectangle center; GdkRectangle center = {
center.x = (view_rect.width + 1) / 2; .x = (view_rect.width + 1) / 2,
center.y = (view_rect.height + 1) / 2; .y = (view_rect.height + 1) / 2,
center.height = center.width = (2 * page_padding) + 1; .width = (2 * page_padding) + 1,
.height = (2 * page_padding) + 1
};
unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document); unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document);
double scale = zathura_document_get_scale(zathura->document); double scale = zathura_document_get_scale(zathura->document);
...@@ -81,12 +84,13 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi ...@@ -81,12 +84,13 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
for (unsigned int page_id = 0; page_id < number_of_pages; page_id++) { for (unsigned int page_id = 0; page_id < number_of_pages; page_id++) {
zathura_page_t* page = zathura_document_get_page(zathura->document, page_id); zathura_page_t* page = zathura_document_get_page(zathura->document, page_id);
GdkRectangle page_rect; GdkRectangle page_rect = {
.width = zathura_page_get_width(page) * scale,
.height = zathura_page_get_height(page) * scale
};
GtkWidget* page_widget = zathura_page_get_widget(zathura, page); GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
gtk_widget_translate_coordinates(page_widget, gtk_widget_translate_coordinates(page_widget,
zathura->ui.session->gtk.view, 0, 0, &page_rect.x, &page_rect.y); zathura->ui.session->gtk.view, 0, 0, &page_rect.x, &page_rect.y);
page_rect.width = zathura_page_get_width(page) * scale;
page_rect.height = zathura_page_get_height(page) * scale;
if (gdk_rectangle_intersect(&view_rect, &page_rect, NULL) == TRUE) { if (gdk_rectangle_intersect(&view_rect, &page_rect, NULL) == TRUE) {
zathura_page_set_visibility(page, true); zathura_page_set_visibility(page, true);
...@@ -156,7 +160,7 @@ cb_first_page_column_value_changed(girara_session_t* session, const char* UNUSED ...@@ -156,7 +160,7 @@ cb_first_page_column_value_changed(girara_session_t* session, const char* UNUSED
void void
cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path, cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
GtkTreeViewColumn* UNUSED(column), void* data) GtkTreeViewColumn* UNUSED(column), void* data)
{ {
zathura_t* zathura = data; zathura_t* zathura = data;
if (tree_view == NULL || zathura == NULL || zathura->ui.session == NULL) { if (tree_view == NULL || zathura == NULL || zathura->ui.session == NULL) {
...@@ -177,14 +181,24 @@ cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path, ...@@ -177,14 +181,24 @@ cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
} }
sc_toggle_index(zathura->ui.session, NULL, NULL, 0); sc_toggle_index(zathura->ui.session, NULL, NULL, 0);
/* zathura_jumplist_save is called when entering index mode */
zathura_link_evaluate(zathura, index_element->link); zathura_link_evaluate(zathura, index_element->link);
zathura_jumplist_add(zathura);
} }
g_object_unref(model); g_object_unref(model);
} }
bool typedef enum zathura_link_action_e
cb_sc_follow(GtkEntry* entry, girara_session_t* session) {
ZATHURA_LINK_ACTION_FOLLOW,
ZATHURA_LINK_ACTION_DISPLAY
} zathura_link_action_t;
static bool
handle_link(GtkEntry* entry, girara_session_t* session,
zathura_link_action_t action)
{ {
g_return_val_if_fail(session != NULL, FALSE); g_return_val_if_fail(session != NULL, FALSE);
g_return_val_if_fail(session->global.data != NULL, FALSE); g_return_val_if_fail(session->global.data != NULL, FALSE);
...@@ -221,9 +235,19 @@ cb_sc_follow(GtkEntry* entry, girara_session_t* session) ...@@ -221,9 +235,19 @@ cb_sc_follow(GtkEntry* entry, girara_session_t* session)
if (eval == true) { if (eval == true) {
zathura_link_t* link = zathura_page_widget_link_get(ZATHURA_PAGE(page_widget), index); zathura_link_t* link = zathura_page_widget_link_get(ZATHURA_PAGE(page_widget), index);
if (link != NULL) { if (link != NULL) {
zathura_link_evaluate(zathura, link);
invalid_index = false; invalid_index = false;
switch (action) {
case ZATHURA_LINK_ACTION_FOLLOW:
zathura_jumplist_save(zathura);
zathura_link_evaluate(zathura, link);
zathura_jumplist_add(zathura);
break;
case ZATHURA_LINK_ACTION_DISPLAY:
zathura_link_display(zathura, link);
break;
}
} }
} }
} }
...@@ -237,6 +261,18 @@ cb_sc_follow(GtkEntry* entry, girara_session_t* session) ...@@ -237,6 +261,18 @@ cb_sc_follow(GtkEntry* entry, girara_session_t* session)
return (eval == TRUE) ? TRUE : FALSE; return (eval == TRUE) ? TRUE : FALSE;
} }
bool
cb_sc_follow(GtkEntry* entry, girara_session_t* session)
{
return handle_link(entry, session, ZATHURA_LINK_ACTION_FOLLOW);
}
bool
cb_sc_display_link(GtkEntry* entry, girara_session_t* session)
{
return handle_link(entry, session, ZATHURA_LINK_ACTION_DISPLAY);
}
void void
cb_file_monitor(GFileMonitor* monitor, GFile* file, GFile* UNUSED(other_file), GFileMonitorEvent event, girara_session_t* session) cb_file_monitor(GFileMonitor* monitor, GFile* file, GFile* UNUSED(other_file), GFileMonitorEvent event, girara_session_t* session)
{ {
...@@ -263,13 +299,13 @@ password_dialog(gpointer data) ...@@ -263,13 +299,13 @@ password_dialog(gpointer data)
if (dialog != NULL) { if (dialog != NULL) {
girara_dialog( girara_dialog(
dialog->zathura->ui.session, dialog->zathura->ui.session,
"Incorrect password. Enter password:", "Incorrect password. Enter password:",
true, true,
NULL, NULL,
(girara_callback_inputbar_activate_t) cb_password_dialog, (girara_callback_inputbar_activate_t) cb_password_dialog,
dialog dialog
); );
} }
return FALSE; return FALSE;
...@@ -317,8 +353,8 @@ cb_password_dialog(GtkEntry* entry, zathura_password_dialog_info_t* dialog) ...@@ -317,8 +353,8 @@ cb_password_dialog(GtkEntry* entry, zathura_password_dialog_info_t* dialog)
error_free: error_free:
g_free(dialog->path); g_free(dialog->path);
free(dialog); free(dialog);
error_ret: error_ret:
...@@ -349,7 +385,7 @@ cb_view_resized(GtkWidget* UNUSED(widget), GtkAllocation* allocation, zathura_t* ...@@ -349,7 +385,7 @@ cb_view_resized(GtkWidget* UNUSED(widget), GtkAllocation* allocation, zathura_t*
void void
cb_setting_recolor_change(girara_session_t* session, const char* name, cb_setting_recolor_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -367,7 +403,7 @@ cb_setting_recolor_change(girara_session_t* session, const char* name, ...@@ -367,7 +403,7 @@ cb_setting_recolor_change(girara_session_t* session, const char* name,
void void
cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name, cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -404,7 +440,9 @@ cb_unknown_command(girara_session_t* session, const char* input) ...@@ -404,7 +440,9 @@ cb_unknown_command(girara_session_t* session, const char* input)
} }
} }
zathura_jumplist_save(zathura);
page_set(zathura, atoi(input) - 1); page_set(zathura, atoi(input) - 1);
zathura_jumplist_add(zathura);
return true; return true;
} }
...@@ -80,6 +80,15 @@ void cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path, ...@@ -80,6 +80,15 @@ void cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
*/ */
bool cb_sc_follow(GtkEntry* entry, girara_session_t* session); bool cb_sc_follow(GtkEntry* entry, girara_session_t* session);
/**
* Called when input has been passed to the sc_display_link dialog
*
* @param entry The dialog inputbar
* @param session The girara session
* @return true if no error occured and the event has been handled
*/
bool cb_sc_display_link(GtkEntry* entry, girara_session_t* session);
/** /**
* Emitted when file has been changed * Emitted when file has been changed
* *
......
...@@ -165,15 +165,15 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list)) ...@@ -165,15 +165,15 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list))
GString* string = g_string_new(NULL); GString* string = g_string_new(NULL);
GIRARA_LIST_FOREACH(information, zathura_document_information_entry_t*, iter, entry) GIRARA_LIST_FOREACH(information, zathura_document_information_entry_t*, iter, entry)
if (entry != NULL) { if (entry != NULL) {
for (unsigned int i = 0; i < LENGTH(meta_fields); i++) { for (unsigned int i = 0; i < LENGTH(meta_fields); i++) {
if (meta_fields[i].field == entry->type) { if (meta_fields[i].field == entry->type) {
char* text = g_strdup_printf("<b>%s:</b> %s\n", meta_fields[i].name, entry->value); char* text = g_strdup_printf("<b>%s:</b> %s\n", meta_fields[i].name, entry->value);
g_string_append(string, text); g_string_append(string, text);
g_free(text); g_free(text);
}
} }
} }
}
GIRARA_LIST_FOREACH_END(information, zathura_document_information_entry_t*, iter, entry); GIRARA_LIST_FOREACH_END(information, zathura_document_information_entry_t*, iter, entry);
if (strlen(string->str) > 0) { if (strlen(string->str) > 0) {
...@@ -190,7 +190,7 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list)) ...@@ -190,7 +190,7 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list))
bool bool
cmd_help(girara_session_t* UNUSED(session), girara_list_t* cmd_help(girara_session_t* UNUSED(session), girara_list_t*
UNUSED(argument_list)) UNUSED(argument_list))
{ {
return true; return true;
} }
...@@ -340,6 +340,8 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu ...@@ -340,6 +340,8 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
bool firsthit = true; bool firsthit = true;
zathura_error_t error = ZATHURA_ERROR_OK; zathura_error_t error = ZATHURA_ERROR_OK;
/* set search direction */
zathura->global.search_direction = argument->n;
unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document); unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document);
unsigned int current_page_number = zathura_document_get_current_page_number(zathura->document); unsigned int current_page_number = zathura_document_get_current_page_number(zathura->document);
...@@ -363,7 +365,10 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu ...@@ -363,7 +365,10 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
GtkWidget* page_widget = zathura_page_get_widget(zathura, page); GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
g_object_set(page_widget, "draw-links", FALSE, NULL); g_object_set(page_widget, "draw-links", FALSE, NULL);
render_lock(zathura->sync.render_thread);
girara_list_t* result = zathura_page_search_text(page, input, &error); girara_list_t* result = zathura_page_search_text(page, input, &error);
render_unlock(zathura->sync.render_thread);
if (result == NULL || girara_list_size(result) == 0) { if (result == NULL || girara_list_size(result) == 0) {
girara_list_free(result); girara_list_free(result);
g_object_set(page_widget, "search-results", NULL, NULL); g_object_set(page_widget, "search-results", NULL, NULL);
...@@ -380,7 +385,12 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu ...@@ -380,7 +385,12 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
if (page_id != 0) { if (page_id != 0) {
page_set_delayed(zathura, zathura_page_get_index(page)); page_set_delayed(zathura, zathura_page_get_index(page));
} }
g_object_set(page_widget, "search-current", 0, NULL); if (argument->n == BACKWARD) {
/* start at bottom hit in page */
g_object_set(page_widget, "search-current", girara_list_size(result) - 1, NULL);
} else {
g_object_set(page_widget, "search-current", 0, NULL);
}
firsthit = false; firsthit = false;
} }
} }
...@@ -423,7 +433,7 @@ cmd_export(girara_session_t* session, girara_list_t* argument_list) ...@@ -423,7 +433,7 @@ cmd_export(girara_session_t* session, girara_list_t* argument_list)
} else { } else {
girara_notify(session, GIRARA_INFO, _("Wrote attachment '%s' to '%s'."), file_identifier, export_path); girara_notify(session, GIRARA_INFO, _("Wrote attachment '%s' to '%s'."), file_identifier, export_path);
} }
/* image */ /* image */
} else if (strncmp(file_identifier, "image-p", strlen("image-p")) == 0 && strlen(file_identifier) >= 10) { } else if (strncmp(file_identifier, "image-p", strlen("image-p")) == 0 && strlen(file_identifier) >= 10) {
/* parse page id */ /* parse page id */
const char* input = file_identifier + strlen("image-p"); const char* input = file_identifier + strlen("image-p");
...@@ -476,7 +486,7 @@ image_error: ...@@ -476,7 +486,7 @@ image_error:
girara_notify(session, GIRARA_ERROR, _("Unknown image '%s'."), file_identifier); girara_notify(session, GIRARA_ERROR, _("Unknown image '%s'."), file_identifier);
goto error_ret; goto error_ret;
/* unknown */ /* unknown */
} else { } else {
girara_notify(session, GIRARA_ERROR, _("Unknown attachment or image '%s'."), file_identifier); girara_notify(session, GIRARA_ERROR, _("Unknown attachment or image '%s'."), file_identifier);
} }
...@@ -499,10 +509,10 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list) ...@@ -499,10 +509,10 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list)
const char* path = zathura_document_get_path(zathura->document); const char* path = zathura_document_get_path(zathura->document);
GIRARA_LIST_FOREACH(argument_list, char*, iter, value) GIRARA_LIST_FOREACH(argument_list, char*, iter, value)
char* r = NULL; char* r = NULL;
if ((r = replace_substring(value, "$FILE", path)) != NULL) { if ((r = replace_substring(value, "$FILE", path)) != NULL) {
girara_list_iterator_set(iter, r); girara_list_iterator_set(iter, r);
} }
GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value); GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value);
} }
...@@ -550,9 +560,9 @@ cmd_version(girara_session_t* session, girara_list_t* UNUSED(argument_list)) ...@@ -550,9 +560,9 @@ cmd_version(girara_session_t* session, girara_list_t* UNUSED(argument_list))
zathura_t* zathura = session->global.data; zathura_t* zathura = session->global.data;
char* string = zathura_get_version_string(zathura, true); char* string = zathura_get_version_string(zathura, true);
if (string == NULL) { if (string == NULL) {
return false; return false;
} }
/* display information */ /* display information */
girara_notify(session, GIRARA_INFO, "%s", string); girara_notify(session, GIRARA_INFO, "%s", string);
......
...@@ -32,7 +32,7 @@ compare_case_insensitive(const char* str1, const char* str2) ...@@ -32,7 +32,7 @@ compare_case_insensitive(const char* str1, const char* str2)
static girara_list_t* static girara_list_t*
list_files(zathura_t* zathura, const char* current_path, const char* current_file, list_files(zathura_t* zathura, const char* current_path, const char* current_file,
unsigned int current_file_length, bool is_dir, bool check_file_ext) unsigned int current_file_length, bool is_dir, bool check_file_ext)
{ {
if (zathura == NULL || zathura->ui.session == NULL || current_path == NULL) { if (zathura == NULL || zathura->ui.session == NULL || current_path == NULL) {
return NULL; return NULL;
...@@ -45,7 +45,7 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil ...@@ -45,7 +45,7 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil
} }
girara_list_t* res = girara_sorted_list_new2((girara_compare_function_t)compare_case_insensitive, girara_list_t* res = girara_sorted_list_new2((girara_compare_function_t)compare_case_insensitive,
(girara_free_function_t)g_free); (girara_free_function_t)g_free);
bool show_hidden = false; bool show_hidden = false;
girara_setting_get(zathura->ui.session, "show-hidden", &show_hidden); girara_setting_get(zathura->ui.session, "show-hidden", &show_hidden);
...@@ -179,7 +179,7 @@ list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext) ...@@ -179,7 +179,7 @@ list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext)
} }
GIRARA_LIST_FOREACH(names, const char*, iter, file) GIRARA_LIST_FOREACH(names, const char*, iter, file)
girara_completion_group_add_element(group, file, NULL); girara_completion_group_add_element(group, file, NULL);
GIRARA_LIST_FOREACH_END(names, const char*, iter, file); GIRARA_LIST_FOREACH_END(names, const char*, iter, file);
girara_list_free(names); girara_list_free(names);
} }
...@@ -246,11 +246,11 @@ cc_bookmarks(girara_session_t* session, const char* input) ...@@ -246,11 +246,11 @@ cc_bookmarks(girara_session_t* session, const char* input)
const size_t input_length = strlen(input); const size_t input_length = strlen(input);
GIRARA_LIST_FOREACH(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark) GIRARA_LIST_FOREACH(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark)
if (input_length <= strlen(bookmark->id) && !strncmp(input, bookmark->id, input_length)) { if (input_length <= strlen(bookmark->id) && !strncmp(input, bookmark->id, input_length)) {
gchar* paged = g_strdup_printf(_("Page %d"), bookmark->page); gchar* paged = g_strdup_printf(_("Page %d"), bookmark->page);
girara_completion_group_add_element(group, bookmark->id, paged); girara_completion_group_add_element(group, bookmark->id, paged);
g_free(paged); g_free(paged);
} }
GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark); GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark);
girara_completion_add_group(completion, group); girara_completion_add_group(completion, group);
...@@ -302,12 +302,12 @@ cc_export(girara_session_t* session, const char* input) ...@@ -302,12 +302,12 @@ cc_export(girara_session_t* session, const char* input)
bool added = false; bool added = false;
GIRARA_LIST_FOREACH(attachments, const char*, iter, attachment) GIRARA_LIST_FOREACH(attachments, const char*, iter, attachment)
if (input_length <= strlen(attachment) && !strncmp(input, attachment, input_length)) { if (input_length <= strlen(attachment) && !strncmp(input, attachment, input_length)) {
char* attachment_string = g_strdup_printf("attachment-%s", attachment); char* attachment_string = g_strdup_printf("attachment-%s", attachment);
girara_completion_group_add_element(attachment_group, attachment_string, NULL); girara_completion_group_add_element(attachment_group, attachment_string, NULL);
g_free(attachment_string); g_free(attachment_string);
added = true; added = true;
} }
GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark); GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark);
if (added == true) { if (added == true) {
...@@ -339,12 +339,12 @@ cc_export(girara_session_t* session, const char* input) ...@@ -339,12 +339,12 @@ cc_export(girara_session_t* session, const char* input)
if (images != NULL) { if (images != NULL) {
unsigned int image_number = 1; unsigned int image_number = 1;
GIRARA_LIST_FOREACH(images, zathura_image_t*, iter, UNUSED(image)) GIRARA_LIST_FOREACH(images, zathura_image_t*, iter, UNUSED(image))
char* image_string = g_strdup_printf("image-p%d-%d", page_id + 1, image_number); char* image_string = g_strdup_printf("image-p%d-%d", page_id + 1, image_number);
girara_completion_group_add_element(image_group, image_string, NULL); girara_completion_group_add_element(image_group, image_string, NULL);
g_free(image_string); g_free(image_string);
added = true; added = true;
image_number++; image_number++;
GIRARA_LIST_FOREACH_END(images, zathura_image_t*, iter, image); GIRARA_LIST_FOREACH_END(images, zathura_image_t*, iter, image);
girara_list_free(images); girara_list_free(images);
} }
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
ZATHURA_VERSION_MAJOR = 0 ZATHURA_VERSION_MAJOR = 0
ZATHURA_VERSION_MINOR = 2 ZATHURA_VERSION_MINOR = 2
ZATHURA_VERSION_REV = 1 ZATHURA_VERSION_REV = 2
# If the API changes, the API version and the ABI version have to be bumped. # If the API changes, the API version and the ABI version have to be bumped.
ZATHURA_API_VERSION = 2 ZATHURA_API_VERSION = 2
# If the ABI breaks for any reason, this has to be bumped. # If the ABI breaks for any reason, this has to be bumped.
...@@ -16,7 +16,7 @@ ZATHURA_GTK_VERSION ?= 2 ...@@ -16,7 +16,7 @@ ZATHURA_GTK_VERSION ?= 2
# minimum required zathura version # minimum required zathura version
# If you want to disable the check, set GIRARA_VERSION_CHECK to 0. # If you want to disable the check, set GIRARA_VERSION_CHECK to 0.
GIRARA_MIN_VERSION = 0.1.4 GIRARA_MIN_VERSION = 0.1.5
GIRARA_VERSION_CHECK ?= $(shell pkg-config --atleast-version=$(GIRARA_MIN_VERSION) girara-gtk${ZATHURA_GTK_VERSION}; echo $$?) GIRARA_VERSION_CHECK ?= $(shell pkg-config --atleast-version=$(GIRARA_MIN_VERSION) girara-gtk${ZATHURA_GTK_VERSION}; echo $$?)
# database # database
......
...@@ -39,28 +39,28 @@ ...@@ -39,28 +39,28 @@
static void zathura_database_interface_init(ZathuraDatabaseInterface* iface); static void zathura_database_interface_init(ZathuraDatabaseInterface* iface);
G_DEFINE_TYPE_WITH_CODE(ZathuraPlainDatabase, zathura_plaindatabase, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE(ZathuraPlainDatabase, zathura_plaindatabase, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE(ZATHURA_TYPE_DATABASE, zathura_database_interface_init)) G_IMPLEMENT_INTERFACE(ZATHURA_TYPE_DATABASE, zathura_database_interface_init))
static void plain_finalize(GObject* object); static void plain_finalize(GObject* object);
static bool plain_add_bookmark(zathura_database_t* db, const char* file, static bool plain_add_bookmark(zathura_database_t* db, const char* file,
zathura_bookmark_t* bookmark); zathura_bookmark_t* bookmark);
static bool plain_remove_bookmark(zathura_database_t* db, const char* file, static bool plain_remove_bookmark(zathura_database_t* db, const char* file,
const char* id); const char* id);
static girara_list_t* plain_load_bookmarks(zathura_database_t* db, static girara_list_t* plain_load_bookmarks(zathura_database_t* db,
const char* file); const char* file);
static bool plain_set_fileinfo(zathura_database_t* db, const char* file, static bool plain_set_fileinfo(zathura_database_t* db, const char* file,
zathura_fileinfo_t* file_info); zathura_fileinfo_t* file_info);
static bool plain_get_fileinfo(zathura_database_t* db, const char* file, static bool plain_get_fileinfo(zathura_database_t* db, const char* file,
zathura_fileinfo_t* file_info); zathura_fileinfo_t* file_info);
static void plain_set_property(GObject* object, guint prop_id, static void plain_set_property(GObject* object, guint prop_id,
const GValue* value, GParamSpec* pspec); const GValue* value, GParamSpec* pspec);
/* forward declaration */ /* forward declaration */
static bool zathura_db_check_file(const char* path); static bool zathura_db_check_file(const char* path);
static GKeyFile* zathura_db_read_key_file_from_file(const char* path); static GKeyFile* zathura_db_read_key_file_from_file(const char* path);
static void zathura_db_write_key_file_to_file(const char* file, GKeyFile* key_file); static void zathura_db_write_key_file_to_file(const char* file, GKeyFile* key_file);
static void cb_zathura_db_watch_file(GFileMonitor* monitor, GFile* file, GFile* static void cb_zathura_db_watch_file(GFileMonitor* monitor, GFile* file, GFile*
other_file, GFileMonitorEvent event, zathura_database_t* database); other_file, GFileMonitorEvent event, zathura_database_t* database);
typedef struct zathura_plaindatabase_private_s { typedef struct zathura_plaindatabase_private_s {
char* bookmark_path; char* bookmark_path;
...@@ -75,8 +75,7 @@ typedef struct zathura_plaindatabase_private_s { ...@@ -75,8 +75,7 @@ typedef struct zathura_plaindatabase_private_s {
#define ZATHURA_PLAINDATABASE_GET_PRIVATE(obj) \ #define ZATHURA_PLAINDATABASE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_PLAINDATABASE, zathura_plaindatabase_private_t)) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_PLAINDATABASE, zathura_plaindatabase_private_t))
enum enum {
{
PROP_0, PROP_0,
PROP_PATH PROP_PATH
}; };
...@@ -118,8 +117,8 @@ zathura_plaindatabase_class_init(ZathuraPlainDatabaseClass* class) ...@@ -118,8 +117,8 @@ zathura_plaindatabase_class_init(ZathuraPlainDatabaseClass* class)
object_class->set_property = plain_set_property; object_class->set_property = plain_set_property;
g_object_class_install_property(object_class, PROP_PATH, g_object_class_install_property(object_class, PROP_PATH,
g_param_spec_string("path", "path", "path to directory where the bookmarks and history are locates", g_param_spec_string("path", "path", "path to directory where the bookmarks and history are locates",
NULL, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));