mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-01 06:46:01 +01:00
Display current page number in statusbar
This commit is contained in:
parent
1ba891658c
commit
4763624dab
3 changed files with 33 additions and 11 deletions
5
render.c
5
render.c
|
@ -239,9 +239,14 @@ page_expose_event(GtkWidget* widget, GdkEventExpose* event, gpointer data)
|
||||||
|
|
||||||
/* render real page */
|
/* render real page */
|
||||||
render_page(page->document->zathura->sync.render_thread, page);
|
render_page(page->document->zathura->sync.render_thread, page);
|
||||||
|
|
||||||
|
/* update statusbar */
|
||||||
}
|
}
|
||||||
cairo_destroy(cairo);
|
cairo_destroy(cairo);
|
||||||
|
|
||||||
|
page->document->current_page_number = page->number;
|
||||||
|
statusbar_page_number_update(page->document->zathura);
|
||||||
|
|
||||||
g_static_mutex_unlock(&(page->lock));
|
g_static_mutex_unlock(&(page->lock));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
17
zathura.c
17
zathura.c
|
@ -318,10 +318,7 @@ page_set(zathura_t* zathura, unsigned int page_id)
|
||||||
|
|
||||||
/* update page number */
|
/* update page number */
|
||||||
zathura->document->current_page_number = page_id;
|
zathura->document->current_page_number = page_id;
|
||||||
|
statusbar_page_number_update(zathura);
|
||||||
char* page_number = g_strdup_printf("[%d/%d]", page_id + 1, zathura->document->number_of_pages);
|
|
||||||
girara_statusbar_item_set_text(zathura->ui.session, zathura->ui.statusbar.page_number, page_number);
|
|
||||||
g_free(page_number);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -330,6 +327,18 @@ error_out:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
statusbar_page_number_update(zathura_t* zathura)
|
||||||
|
{
|
||||||
|
if (zathura == NULL || zathura->ui.statusbar.page_number == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* page_number_text = g_strdup_printf("[%d/%d]", zathura->document->current_page_number + 1, zathura->document->number_of_pages);
|
||||||
|
girara_statusbar_item_set_text(zathura->ui.session, zathura->ui.statusbar.page_number, page_number_text);
|
||||||
|
g_free(page_number_text);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
page_view_set_mode(zathura_t* zathura, unsigned int pages_per_row)
|
page_view_set_mode(zathura_t* zathura, unsigned int pages_per_row)
|
||||||
{
|
{
|
||||||
|
|
22
zathura.h
22
zathura.h
|
@ -78,21 +78,21 @@ typedef struct zathura_s
|
||||||
*
|
*
|
||||||
* @param argc Number of arguments
|
* @param argc Number of arguments
|
||||||
* @param argv Values of arguments
|
* @param argv Values of arguments
|
||||||
* @return Zathura zathura object or NULL if zathura could not been initialized
|
* @return zathura session object or NULL if zathura could not been initialized
|
||||||
*/
|
*/
|
||||||
zathura_t* zathura_init(int argc, char* argv[]);
|
zathura_t* zathura_init(int argc, char* argv[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free zathura zathura
|
* Free zathura session
|
||||||
*
|
*
|
||||||
* @param zathura The zathura zathura
|
* @param zathura The zathura session
|
||||||
*/
|
*/
|
||||||
void zathura_free(zathura_t* zathura);
|
void zathura_free(zathura_t* zathura);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a file
|
* Opens a file
|
||||||
*
|
*
|
||||||
* @param zathura The zathura zathura
|
* @param zathura The zathura session
|
||||||
* @param path The path to the file
|
* @param path The path to the file
|
||||||
* @param password The password of the file
|
* @param password The password of the file
|
||||||
*
|
*
|
||||||
|
@ -103,7 +103,7 @@ bool document_open(zathura_t* zathura, const char* path, const char* password);
|
||||||
/**
|
/**
|
||||||
* Closes the current opened document
|
* Closes the current opened document
|
||||||
*
|
*
|
||||||
* @param zathura The zathura zathura
|
* @param zathura The zathura session
|
||||||
* @return If no error occured true, otherwise false, is returned.
|
* @return If no error occured true, otherwise false, is returned.
|
||||||
*/
|
*/
|
||||||
bool document_close(zathura_t* zathura);
|
bool document_close(zathura_t* zathura);
|
||||||
|
@ -111,7 +111,7 @@ bool document_close(zathura_t* zathura);
|
||||||
/**
|
/**
|
||||||
* Opens the page with the given number
|
* Opens the page with the given number
|
||||||
*
|
*
|
||||||
* @param zathura The zathura zathura
|
* @param zathura The zathura session
|
||||||
* @return If no error occured true, otherwise false, is returned.
|
* @return If no error occured true, otherwise false, is returned.
|
||||||
*/
|
*/
|
||||||
bool page_set(zathura_t* zathura, unsigned int page_id);
|
bool page_set(zathura_t* zathura, unsigned int page_id);
|
||||||
|
@ -119,9 +119,17 @@ bool page_set(zathura_t* zathura, unsigned int page_id);
|
||||||
/**
|
/**
|
||||||
* Builds the box structure to show the rendered pages
|
* Builds the box structure to show the rendered pages
|
||||||
*
|
*
|
||||||
* @param zathura The zathura zathura
|
* @param zathura The zathura session
|
||||||
* @param pages_per_row Number of shown pages per row
|
* @param pages_per_row Number of shown pages per row
|
||||||
*/
|
*/
|
||||||
void page_view_set_mode(zathura_t* zathura, unsigned int pages_per_row);
|
void page_view_set_mode(zathura_t* zathura, unsigned int pages_per_row);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the page number in the statusbar. Note that 1 will be added to the
|
||||||
|
* displayed number
|
||||||
|
*
|
||||||
|
* @param zathura The zathura session
|
||||||
|
*/
|
||||||
|
void statusbar_page_number_update(zathura_t* zathura);
|
||||||
|
|
||||||
#endif // ZATHURA_H
|
#endif // ZATHURA_H
|
||||||
|
|
Loading…
Reference in a new issue