Commit 9fe03f72 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Allow page-padding to be changed.

parent 66bc63f5
......@@ -40,6 +40,20 @@ cb_color_change(girara_session_t* session, const char* name,
render_all(zathura);
}
static void
cb_page_padding_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 val = *(int*) value;
gtk_table_set_row_spacings(GTK_TABLE(zathura->ui.page_widget), val);
gtk_table_set_col_spacings(GTK_TABLE(zathura->ui.page_widget), val);
}
void
config_load_default(zathura_t* zathura)
{
......@@ -70,7 +84,7 @@ config_load_default(zathura_t* zathura)
int_value = 10;
girara_setting_add(gsession, "zoom-step", &int_value, INT, false, _("Zoom step"), NULL, NULL);
int_value = 1;
girara_setting_add(gsession, "page-padding", &int_value, INT, true, _("Padding between pages"), NULL, NULL);
girara_setting_add(gsession, "page-padding", &int_value, INT, false, _("Padding between pages"), cb_page_padding_changed, 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, NULL);
float_value = 40;
......
......@@ -450,11 +450,13 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
gdouble view_size = gtk_adjustment_get_page_size(adjustment);
gdouble value = gtk_adjustment_get_value(adjustment);
gdouble max = gtk_adjustment_get_upper(adjustment) - view_size;
unsigned int padding = zathura->global.page_padding;
zathura->global.update_page_number = true;
float scroll_step = 40;
girara_setting_get(session, "scroll-step", &scroll_step);
int padding = 1;
girara_setting_get(session, "page-padding", &padding);
gdouble new_value;
switch(argument->n) {
......
......@@ -227,12 +227,12 @@ zathura_init(int argc, char* argv[])
/* signals */
g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "destroy", G_CALLBACK(cb_destroy), zathura);
/* save page padding */
zathura->global.page_padding = 1;
girara_setting_get(zathura->ui.session, "page-padding", &zathura->global.page_padding);
/* set page padding */
int page_padding = 1;
girara_setting_get(zathura->ui.session, "page-padding", &page_padding);
gtk_table_set_row_spacings(GTK_TABLE(zathura->ui.page_widget), zathura->global.page_padding);
gtk_table_set_col_spacings(GTK_TABLE(zathura->ui.page_widget), zathura->global.page_padding);
gtk_table_set_row_spacings(GTK_TABLE(zathura->ui.page_widget), page_padding);
gtk_table_set_col_spacings(GTK_TABLE(zathura->ui.page_widget), page_padding);
/* database */
char* database = NULL;
......
Markdown is supported
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