Commit 40ae60ea authored by Moritz Lipp's avatar Moritz Lipp
Browse files

Updated page_set function

parent 4763624d
......@@ -94,14 +94,7 @@ sc_goto(girara_session_t* session, girara_argument_t* argument, unsigned int t)
return true;
}
unsigned int number_of_pages = zathura->document->number_of_pages;
if (t > 0 && t <= number_of_pages) {
// TODO: Calculate offset
/*GtkAdjustment* adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->UI.session->gtk.view));*/
/*unsigned int offset = zathura->document->pages[t - 1]->offset * zathura->document->scale;*/
/*gtk_adjustment_set_value(adjustment, offset);*/
}
page_set(zathura, t - 1);
}
return false;
......
......@@ -313,8 +313,15 @@ page_set(zathura_t* zathura, unsigned int page_id)
goto error_out;
}
page_offset_t* offset = page_calculate_offset(page);
if (offset == NULL) {
goto error_out;
}
GtkAdjustment* view_vadjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
cb_view_vadjustment_value_changed(view_vadjustment, zathura);
GtkAdjustment* view_hadjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
gtk_adjustment_set_value(view_hadjustment, offset->x);
gtk_adjustment_set_value(view_vadjustment, offset->y);
/* update page number */
zathura->document->current_page_number = page_id;
......
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