mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-03-03 17:44:39 +01:00
fix page_set call in cb_index_row_activated
This commit is contained in:
parent
88e31c0c24
commit
72ebb3bc13
2 changed files with 19 additions and 2 deletions
19
callbacks.c
19
callbacks.c
|
@ -91,6 +91,20 @@ cb_pages_per_row_value_changed(girara_session_t* UNUSED(session), girara_setting
|
|||
page_view_set_mode(zathura, pages_per_row);
|
||||
}
|
||||
|
||||
typedef struct page_set_delayed_s {
|
||||
zathura_t* zathura;
|
||||
unsigned int page;
|
||||
} page_set_delayed_t;
|
||||
|
||||
static gboolean
|
||||
page_set_delayed(gpointer data) {
|
||||
page_set_delayed_t* p = data;
|
||||
page_set(p->zathura, p->page);
|
||||
|
||||
g_free(p);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
|
||||
GtkTreeViewColumn* UNUSED(column), zathura_t* zathura)
|
||||
|
@ -114,8 +128,11 @@ cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
|
|||
}
|
||||
|
||||
if (index_element->type == ZATHURA_LINK_TO_PAGE) {
|
||||
page_set(zathura, index_element->target.page_number);
|
||||
sc_toggle_index(zathura->ui.session, NULL, 0);
|
||||
page_set_delayed_t* p = g_malloc(sizeof(page_set_delayed_t));
|
||||
p->zathura = zathura;
|
||||
p->page = index_element->target.page_number;
|
||||
g_idle_add(page_set_delayed, p);
|
||||
} else if (index_element->type == ZATHURA_LINK_EXTERNAL) {
|
||||
// TODO
|
||||
}
|
||||
|
|
|
@ -405,7 +405,7 @@ document_close(zathura_t* zathura)
|
|||
bool
|
||||
page_set(zathura_t* zathura, unsigned int page_id)
|
||||
{
|
||||
if (!zathura->document || !zathura->document->pages) {
|
||||
if (zathura == NULL || zathura->document == NULL || zathura->document->pages == NULL) {
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue