Advance the pager to the end when clicked
authorPhilip Chimento <philip.chimento@gmail.com>
Sun, 16 Sep 2012 13:35:02 +0000 (15:35 +0200)
committerPhilip Chimento <philip.chimento@gmail.com>
Sun, 16 Sep 2012 13:35:02 +0000 (15:35 +0200)
If you click on the pager button, then it should advance to the
end and stop paging.

libchimara/pager.c
libchimara/pager.h
libchimara/window.c

index 652a70dd411fe7948bd35a76623eefc795937f91..c0c76a05bf4a09cc3e822779fdd8f49fc9bc5feb 100644 (file)
@@ -59,6 +59,14 @@ stop_paging(winid_t win)
        g_signal_handler_block(win->widget, win->pager_keypress_handler);
 }
 
+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);
+}
+
 /* When the user scrolls up in a textbuffer, start paging. */
 void
 pager_after_adjustment_changed(GtkAdjustment *adj, winid_t win)
@@ -71,9 +79,6 @@ pager_after_adjustment_changed(GtkAdjustment *adj, winid_t win)
                start_paging(win);
        else if(scroll_distance == 0 && win->currently_paging)
                stop_paging(win);
-       
-       /* Refresh the widget so that any extra "more" prompts disappear */
-       gtk_widget_queue_draw(win->widget);
 }
 
 /* Handle key press events in the textview while paging is active */
index 9bcbb6344c6ec22d466cead72f935972016b9197..4e7bbf0cfa1b9ec1d1d7f9189d45ab6609db635e 100644 (file)
@@ -5,7 +5,7 @@
 #include "glk.h"
 #include "window.h"
 
-G_GNUC_INTERNAL gboolean pager_on_draw(GtkTextView *textview, cairo_t *cr, winid_t win);
+G_GNUC_INTERNAL void pager_on_clicked(GtkButton *pager, winid_t win);
 G_GNUC_INTERNAL gboolean pager_on_key_press_event(GtkTextView *textview, GdkEventKey *event, winid_t win);
 G_GNUC_INTERNAL void pager_after_adjustment_changed(GtkAdjustment *adj, winid_t win);
 G_GNUC_INTERNAL void pager_after_size_allocate(GtkTextView *textview, GdkRectangle *allocation, winid_t win);
index e302a1eedc06201a79dbf87f40815499db9e169f..9ebde933fe10e9e21d47e3a0d0225aab508cecdb 100644 (file)
@@ -581,6 +581,7 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype,
                        g_signal_handler_block(textview, win->pager_keypress_handler);
                        GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolledwindow));
                        win->pager_adjustment_handler = g_signal_connect_after(adj, "value-changed", G_CALLBACK(pager_after_adjustment_changed), win);
+                       g_signal_connect(pager, "clicked", G_CALLBACK(pager_on_clicked), win);
 
                        /* Char and line input */
                        win->char_input_keypress_handler = g_signal_connect( textview, "key-press-event", G_CALLBACK(on_char_input_key_press_event), win );