qulogic/talkatu

Merged in default (pull request #27)

2019-07-23, Gary Kramlich
c4b07dfd0db9
Merged in default (pull request #27)

Add API to page up/down in the history widget.

Approved-by: Elliott Sales de Andrade
--- a/talkatu/talkatuhistory.c Mon Jul 22 07:32:37 2019 +0000
+++ b/talkatu/talkatuhistory.c Tue Jul 23 00:06:29 2019 +0000
@@ -88,3 +88,44 @@
NULL
));
}
+
+/**
+ * talkatu_history_page_up:
+ * @history: The #TalkatuHistory instance.
+ *
+ * Scrolls @history up one page.
+ */
+void
+talkatu_history_page_up(TalkatuHistory *history) {
+ GtkAdjustment *adjustment = NULL;
+ double value = 0.0;
+
+ g_return_if_fail(TALKATU_IS_HISTORY(history));
+
+ adjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(history));
+
+ value = gtk_adjustment_get_value(adjustment);
+ value -= gtk_adjustment_get_page_increment(adjustment);
+ gtk_adjustment_set_value(adjustment, value);
+}
+
+/**
+ * talkatu_history_page_down:
+ * @history: The #TalkatuHistory instance.
+ *
+ * Scrolls @history down one page.
+ */
+void
+talkatu_history_page_down(TalkatuHistory *history) {
+ GtkAdjustment *adjustment = NULL;
+ double value = 0.0;
+
+ g_return_if_fail(TALKATU_IS_HISTORY(history));
+
+ adjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(history));
+
+ value = gtk_adjustment_get_value(adjustment);
+ value += gtk_adjustment_get_page_increment(adjustment);
+ gtk_adjustment_set_value(adjustment, value);
+}
+
--- a/talkatu/talkatuhistory.h Mon Jul 22 07:32:37 2019 +0000
+++ b/talkatu/talkatuhistory.h Tue Jul 23 00:06:29 2019 +0000
@@ -38,6 +38,9 @@
GtkWidget *talkatu_history_new(void);
+void talkatu_history_page_up(TalkatuHistory *history);
+void talkatu_history_page_down(TalkatuHistory *history);
+
G_END_DECLS
#endif /* TALKATU_HISTORY_H */