use the new document functions for the jumplist

And get rid of explicit gtk calls to the adjustment
This commit is contained in:
Abdo Roig-Maranges 2013-10-22 23:14:51 +02:00
parent 6ca81e3716
commit 4a75efd4f2
2 changed files with 12 additions and 15 deletions

View file

@ -648,10 +648,9 @@ sc_jumplist(girara_session_t* session, girara_argument_t* argument,
return true; return true;
} }
GtkAdjustment* hadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(session->gtk.view)); double x = zathura_document_get_position_x(zathura->document);
GtkAdjustment* vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(session->gtk.view)); double y = zathura_document_get_position_y(zathura->document);
double x = zathura_adjustment_get_ratio(hadj);
double y = zathura_adjustment_get_ratio(vadj);
zathura_jump_t* jump = NULL; zathura_jump_t* jump = NULL;
zathura_jump_t* prev_jump = zathura_jumplist_current(zathura); zathura_jump_t* prev_jump = zathura_jumplist_current(zathura);
bool go_to_current = false; bool go_to_current = false;
@ -691,11 +690,9 @@ sc_jumplist(girara_session_t* session, girara_argument_t* argument,
} }
if (jump != NULL) { if (jump != NULL) {
zathura_adjustment_set_value_from_ratio(hadj, jump->x); page_set(zathura, jump->page);
zathura_adjustment_set_value_from_ratio(vadj, jump->y); position_set(zathura, jump->x, jump->y);
zathura_document_set_current_page_number(zathura->document, jump->page); }
statusbar_page_number_update(zathura);
}
return false; return false;
} }

View file

@ -1426,12 +1426,12 @@ zathura_jumplist_trim(zathura_t* zathura)
void void
zathura_jumplist_add(zathura_t* zathura) zathura_jumplist_add(zathura_t* zathura)
{ {
g_return_if_fail(zathura != NULL && zathura->jumplist.list != NULL); g_return_if_fail(zathura != NULL && zathura->document != NULL && zathura->jumplist.list != NULL);
zathura_jumplist_hide_inputbar(zathura); zathura_jumplist_hide_inputbar(zathura);
unsigned int pagenum = zathura_document_get_current_page_number(zathura->document); unsigned int pagenum = zathura_document_get_current_page_number(zathura->document);
double x = zathura_adjustment_get_ratio(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view))); double x = zathura_document_get_position_x(zathura->document);
double y = zathura_adjustment_get_ratio(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view))); double y = zathura_document_get_position_y(zathura->document);
if (zathura->jumplist.size != 0) { if (zathura->jumplist.size != 0) {
zathura_jumplist_reset_current(zathura); zathura_jumplist_reset_current(zathura);
@ -1480,7 +1480,7 @@ zathura_jumplist_load(zathura_t* zathura, const char* file)
static void static void
zathura_jumplist_save(zathura_t* zathura) zathura_jumplist_save(zathura_t* zathura)
{ {
g_return_if_fail(zathura != NULL); g_return_if_fail(zathura != NULL && zathura->document != NULL);
zathura_jump_t* cur = zathura_jumplist_current(zathura); zathura_jump_t* cur = zathura_jumplist_current(zathura);
@ -1488,7 +1488,7 @@ zathura_jumplist_save(zathura_t* zathura)
if (cur) { if (cur) {
cur->page = pagenum; cur->page = pagenum;
cur->x = zathura_adjustment_get_ratio(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view))); cur->x = zathura_document_get_position_x(zathura->document);
cur->y = zathura_adjustment_get_ratio(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view))); cur->y = zathura_document_get_position_y(zathura->document);
} }
} }