mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-13 07:03:45 +01:00
Added function to switch view
This commit is contained in:
parent
1d59480faa
commit
9cf5ec8e06
16
zathura.c
16
zathura.c
@ -186,6 +186,7 @@ void notify(int, char*);
|
|||||||
void update_status();
|
void update_status();
|
||||||
void setCompletionRowColor(GtkBox*, int, int);
|
void setCompletionRowColor(GtkBox*, int, int);
|
||||||
void set_page(int);
|
void set_page(int);
|
||||||
|
void switch_view(GtkWidget*);
|
||||||
GtkEventBox* createCompletionRow(GtkBox*, char*, char*, gboolean);
|
GtkEventBox* createCompletionRow(GtkBox*, char*, char*, gboolean);
|
||||||
|
|
||||||
/* thread declaration */
|
/* thread declaration */
|
||||||
@ -561,6 +562,16 @@ set_page(int page)
|
|||||||
Zathura.State.pages = g_strdup_printf("[%i/%i]", page + 1, Zathura.PDF.number_of_pages);
|
Zathura.State.pages = g_strdup_printf("[%i/%i]", page + 1, Zathura.PDF.number_of_pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
switch_view(GtkWidget* widget)
|
||||||
|
{
|
||||||
|
GtkWidget* current = gtk_bin_get_child(GTK_BIN(Zathura.UI.view));
|
||||||
|
if(current)
|
||||||
|
gtk_container_remove(GTK_CONTAINER(Zathura.UI.view), current);
|
||||||
|
|
||||||
|
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(Zathura.UI.view), widget);
|
||||||
|
}
|
||||||
|
|
||||||
/* thread implementation */
|
/* thread implementation */
|
||||||
void*
|
void*
|
||||||
render(void* parameter)
|
render(void* parameter)
|
||||||
@ -570,10 +581,7 @@ render(void* parameter)
|
|||||||
|
|
||||||
int page;
|
int page;
|
||||||
for(page = 0; page < Zathura.PDF.number_of_pages; page++)
|
for(page = 0; page < Zathura.PDF.number_of_pages; page++)
|
||||||
{
|
|
||||||
printf("%d\n", page);
|
|
||||||
draw(page);
|
draw(page);
|
||||||
}
|
|
||||||
|
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
@ -633,7 +641,7 @@ sc_navigate(Argument* argument)
|
|||||||
new_page = (new_page + number_of_pages - 1) % number_of_pages;
|
new_page = (new_page + number_of_pages - 1) % number_of_pages;
|
||||||
|
|
||||||
set_page(new_page);
|
set_page(new_page);
|
||||||
|
switch_view(Zathura.PDF.pages[new_page]->drawing_area);
|
||||||
update_status();
|
update_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user