From 9889950be82d852f04fdc7cfbe274a3701a69ced Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Fri, 23 Dec 2011 18:48:33 +0100 Subject: [PATCH] gtk-tpdfv: Added _get_n_pages() and _get_current_page(). --- src/gtk-tpdfv.c | 24 ++++++++++++++++++++++++ src/gtk-tpdfv.h | 9 +++++++++ 2 files changed, 33 insertions(+) diff --git a/src/gtk-tpdfv.c b/src/gtk-tpdfv.c index 082872b..3ebbfab 100644 --- a/src/gtk-tpdfv.c +++ b/src/gtk-tpdfv.c @@ -358,6 +358,30 @@ gtk_tpdfv_reload(GtkWidget *widget) do_redraw(widget); } /* gtk_tpdfv_reload */ +int +gtk_tpdfv_get_n_pages(GtkWidget *widget) +{ + gtk_tpdfv_t *pdf; + + if (! widget) + return -1; + + pdf = GTK_TPDFV_GET_PRIVATE(widget); + return pdf->total_pages; +} /* gtk_tpdfv_get_n_pages */ + +int +gtk_tpdfv_get_current_page(GtkWidget *widget) +{ + gtk_tpdfv_t *pdf; + + if (! widget) + return -1; + + pdf = GTK_TPDFV_GET_PRIVATE(widget); + return pdf->current_page_no; +} /* gtk_tpdfv_get_current_page */ + void gtk_tpdfv_page_up(GtkWidget *widget) { diff --git a/src/gtk-tpdfv.h b/src/gtk-tpdfv.h index 9dd48f8..e354bd3 100644 --- a/src/gtk-tpdfv.h +++ b/src/gtk-tpdfv.h @@ -72,6 +72,15 @@ gtk_tpdfv_new(const char *filename); void gtk_tpdfv_reload(GtkWidget *widget); +/* + * gtk_tpdfv_get_n_pages, gtk_tpdfv_get_current_page: + * Get the total number of pages or the current page number. + */ +int +gtk_tpdfv_get_n_pages(GtkWidget *widget); +int +gtk_tpdfv_get_current_page(GtkWidget *widget); + /* * gtk_tpdfv_page_up, gtk_tpdfv_page_down, * gtk_tpdfv_first_page, gtk_tpdfv_last_page: -- 2.30.2