Commit 4a75efd4 authored by Abdo Roig-Maranges's avatar Abdo Roig-Maranges
Browse files

use the new document functions for the jumplist

And get rid of explicit gtk calls to the adjustment
parent 6ca81e37
......@@ -648,10 +648,9 @@ sc_jumplist(girara_session_t* session, girara_argument_t* argument,
return true;
}
GtkAdjustment* hadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));
GtkAdjustment* vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));
double x = zathura_adjustment_get_ratio(hadj);
double y = zathura_adjustment_get_ratio(vadj);
double x = zathura_document_get_position_x(zathura->document);
double y = zathura_document_get_position_y(zathura->document);
zathura_jump_t* jump = NULL;
zathura_jump_t* prev_jump = zathura_jumplist_current(zathura);
bool go_to_current = false;
......@@ -691,11 +690,9 @@ sc_jumplist(girara_session_t* session, girara_argument_t* argument,
}
if (jump != NULL) {
zathura_adjustment_set_value_from_ratio(hadj, jump->x);
zathura_adjustment_set_value_from_ratio(vadj, jump->y);
zathura_document_set_current_page_number(zathura->document, jump->page);
statusbar_page_number_update(zathura);
}
page_set(zathura, jump->page);
position_set(zathura, jump->x, jump->y);
}
return false;
}
......
......@@ -1426,12 +1426,12 @@ zathura_jumplist_trim(zathura_t* zathura)
void
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);
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 y = zathura_adjustment_get_ratio(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)));
double x = zathura_document_get_position_x(zathura->document);
double y = zathura_document_get_position_y(zathura->document);
if (zathura->jumplist.size != 0) {
zathura_jumplist_reset_current(zathura);
......@@ -1480,7 +1480,7 @@ zathura_jumplist_load(zathura_t* zathura, const char* file)
static void
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);
......@@ -1488,7 +1488,7 @@ zathura_jumplist_save(zathura_t* zathura)
if (cur) {
cur->page = pagenum;
cur->x = zathura_adjustment_get_ratio(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)));
cur->y = zathura_adjustment_get_ratio(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)));
cur->x = zathura_document_get_position_x(zathura->document);
cur->y = zathura_document_get_position_y(zathura->document);
}
}
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