Commit 95c85101 authored by Sebastian Ramacher's avatar Sebastian Ramacher
Browse files

Stay on the same page on :set pages-per-row (Closes: ##108)

parent 2adb2522
......@@ -97,18 +97,22 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
}
void
cb_pages_per_row_value_changed(girara_session_t* UNUSED(session), const char* UNUSED(name), girara_setting_type_t UNUSED(type), void* value, void* data)
cb_pages_per_row_value_changed(girara_session_t* session, const char* UNUSED(name), girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{
g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL);
zathura_t* zathura = session->global.data;
int pages_per_row = *(int*) value;
zathura_t* zathura = data;
if (pages_per_row < 1) {
pages_per_row = 1;
}
unsigned int current_page = zathura->document->current_page_number;
page_widget_set_mode(zathura, pages_per_row);
page_set_delayed(zathura, current_page);
}
void
......
......@@ -45,7 +45,7 @@ config_load_default(zathura_t* zathura)
int_value = 1;
girara_setting_add(gsession, "page-padding", &int_value, INT, true, "Padding between pages", NULL, NULL);
int_value = 1;
girara_setting_add(gsession, "pages-per-row", &int_value, INT, false, "Number of pages per row", cb_pages_per_row_value_changed, zathura);
girara_setting_add(gsession, "pages-per-row", &int_value, INT, false, "Number of pages per row", cb_pages_per_row_value_changed, NULL);
float_value = 40;
girara_setting_add(gsession, "scroll-step", &float_value, FLOAT, false, "Scroll step", NULL, NULL);
int_value = 10;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment