[gnome-builder] testui: make sure scrollbar is wired to terminal



commit e98a351dcfd950a398f58aa6fd4cb35303c82179
Author: Christian Hergert <chergert redhat com>
Date:   Fri Apr 26 14:14:11 2019 -0700

    testui: make sure scrollbar is wired to terminal
    
    This was somehow missed when porting from IdeTerminalPage.
    
    Related #895

 src/plugins/testui/gbp-test-output-panel.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/testui/gbp-test-output-panel.c b/src/plugins/testui/gbp-test-output-panel.c
index 62cecc3df..5896a835a 100644
--- a/src/plugins/testui/gbp-test-output-panel.c
+++ b/src/plugins/testui/gbp-test-output-panel.c
@@ -29,8 +29,9 @@
 
 struct _GbpTestOutputPanel
 {
-  IdePane      parent_instance;
-  IdeTerminal *terminal;
+  IdePane       parent_instance;
+  IdeTerminal  *terminal;
+  GtkScrollbar *scrollbar;
 };
 
 G_DEFINE_TYPE (GbpTestOutputPanel, gbp_test_output_panel, IDE_TYPE_PANE)
@@ -41,6 +42,7 @@ gbp_test_output_panel_class_init (GbpTestOutputPanelClass *klass)
   GtkWidgetClass *widget_class = (GtkWidgetClass*)klass;
 
   gtk_widget_class_set_template_from_resource (widget_class, "/plugins/testui/gbp-test-output-panel.ui");
+  gtk_widget_class_bind_template_child (widget_class, GbpTestOutputPanel, scrollbar);
   gtk_widget_class_bind_template_child (widget_class, GbpTestOutputPanel, terminal);
 }
 
@@ -121,11 +123,12 @@ gbp_testui_output_panel_clear_activate (GSimpleAction *action,
 static void
 gbp_test_output_panel_init (GbpTestOutputPanel *self)
 {
-  g_autoptr(GSimpleActionGroup) actions = NULL;
   static const GActionEntry entries[] = {
     { "clear", gbp_testui_output_panel_clear_activate },
     { "save", gbp_testui_output_panel_save_in_file },
   };
+  g_autoptr(GSimpleActionGroup) actions = NULL;
+  GtkAdjustment *vadj;
 
   gtk_widget_init_template (GTK_WIDGET(self));
 
@@ -135,6 +138,9 @@ gbp_test_output_panel_init (GbpTestOutputPanel *self)
   actions = g_simple_action_group_new ();
   g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS (entries), self);
   gtk_widget_insert_action_group (GTK_WIDGET (self), "test-output", G_ACTION_GROUP (actions));
+
+  vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (self->terminal));
+  gtk_range_set_adjustment (GTK_RANGE (self->scrollbar), vadj);
 }
 
 GtkWidget *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]