+/* Helper function: If the adjustment is at its maximum value, stop paging */
+static void
+check_paging(GtkAdjustment *adj, winid_t win)
+{
+ double page_size, upper, value;
+ g_object_get(adj,
+ "page-size", &page_size,
+ "upper", &upper,
+ "value", &value,
+ NULL);
+ if(value + PAGER_FUZZINESS >= upper - page_size && win->currently_paging)
+ stop_paging(win);
+}
+
+void
+pager_on_clicked(GtkButton *pager, winid_t win)
+{
+ GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(win->scrolledwindow) );
+ double upper = gtk_adjustment_get_upper(adj);
+ gtk_adjustment_set_value(adj, upper);
+ check_paging(adj, win);
+ /* Give the focus back to the text view */
+ gtk_widget_grab_focus(win->widget);
+}
+