Updated page_set function

This commit is contained in:
Moritz Lipp 2011-04-27 20:32:57 +02:00
parent 4763624dab
commit 40ae60ea42
2 changed files with 9 additions and 9 deletions

View file

@ -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;

View file

@ -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;