mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 11:26:01 +01:00
Add setting abort-clear-search and clear search results on abort if set.
This commit is contained in:
parent
1e1b55de57
commit
d24ad831b8
2 changed files with 8 additions and 0 deletions
2
config.c
2
config.c
|
@ -140,6 +140,8 @@ config_load_default(zathura_t* zathura)
|
|||
girara_setting_add(gsession, "open-first-page", &bool_value, BOOLEAN, false, _("Always open on first page"), NULL, NULL);
|
||||
bool_value = false;
|
||||
girara_setting_add(gsession, "nohlsearch", &bool_value, BOOLEAN, false, _("Highlight search results"), cb_nohlsearch_changed, NULL);
|
||||
bool_value = true;
|
||||
girara_setting_add(gsession, "abort-clear-search", &bool_value, BOOLEAN, false, _("Clear search results on abort"), NULL, NULL);
|
||||
|
||||
/* define default shortcuts */
|
||||
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, NULL, sc_abort, 0, 0, NULL);
|
||||
|
|
|
@ -26,6 +26,9 @@ sc_abort(girara_session_t* session, girara_argument_t* UNUSED(argument),
|
|||
g_return_val_if_fail(session->global.data != NULL, false);
|
||||
zathura_t* zathura = session->global.data;
|
||||
|
||||
bool clear_search = true;
|
||||
girara_setting_get(session, "abort-clear-search", &clear_search);
|
||||
|
||||
if (zathura->document != NULL) {
|
||||
unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document);
|
||||
for (unsigned int page_id = 0; page_id < number_of_pages; ++page_id) {
|
||||
|
@ -35,6 +38,9 @@ sc_abort(girara_session_t* session, girara_argument_t* UNUSED(argument),
|
|||
}
|
||||
|
||||
g_object_set(zathura_page_get_widget(zathura, page), "draw-links", FALSE, NULL);
|
||||
if (clear_search) {
|
||||
g_object_set(zathura_page_get_widget(zathura, page), "search-results", NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue