From: Philip Chimento Date: Sun, 16 Sep 2012 13:35:02 +0000 (+0200) Subject: Advance the pager to the end when clicked X-Git-Tag: v0.9~5^2~3 X-Git-Url: https://git.stderr.nl/gitweb?p=projects%2Fchimara%2Fchimara.git;a=commitdiff_plain;h=9d047029eec65619c096da63056ed71721f027eb Advance the pager to the end when clicked If you click on the pager button, then it should advance to the end and stop paging. --- diff --git a/libchimara/pager.c b/libchimara/pager.c index 652a70d..c0c76a0 100644 --- a/libchimara/pager.c +++ b/libchimara/pager.c @@ -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 */ diff --git a/libchimara/pager.h b/libchimara/pager.h index 9bcbb63..4e7bbf0 100644 --- a/libchimara/pager.h +++ b/libchimara/pager.h @@ -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); diff --git a/libchimara/window.c b/libchimara/window.c index e302a1e..9ebde93 100644 --- a/libchimara/window.c +++ b/libchimara/window.c @@ -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 );