diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index 830027aad..94e87c69a 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -210,7 +210,9 @@ public class ProgressView : Gtk.Box { } private void fake_status (Distinst.Step step) { + unowned var log_helper = LogHelper.get_default (); for (var percent = 0; percent <= 100; percent++) { + log_helper.log_func (INFO, "I'm faking it!"); Distinst.Status status = Distinst.Status () { step = step, percent = percent diff --git a/src/Widgets/Terminal.vala b/src/Widgets/Terminal.vala index d27e5fd7e..344e2ed25 100644 --- a/src/Widgets/Terminal.vala +++ b/src/Widgets/Terminal.vala @@ -17,12 +17,13 @@ * Authored by: Michael Aaron Murphy */ -public class Installer.Terminal : Gtk.ScrolledWindow { +public class Installer.Terminal : Gtk.Box { public signal void toggled (bool active); public Gtk.TextBuffer buffer { get; construct; } private Gtk.TextView view; private double prev_upper_adj = 0; + private Gtk.ScrolledWindow scrolled_window; public string log { owned get { @@ -46,23 +47,29 @@ public class Installer.Terminal : Gtk.ScrolledWindow { }; view.get_style_context ().remove_class (Gtk.STYLE_CLASS_VIEW); - hscrollbar_policy = Gtk.PolicyType.NEVER; - hexpand = true; - vexpand = true; - min_content_height = 120; - add (view); - get_style_context ().add_class (Granite.STYLE_CLASS_TERMINAL); + scrolled_window = new Gtk.ScrolledWindow (null, null) { + child = view, + hexpand = true, + vexpand = true, + hscrollbar_policy = NEVER, + min_content_height = 120 + }; + scrolled_window.get_style_context ().add_class (Granite.STYLE_CLASS_TERMINAL); + + add (scrolled_window); - view.size_allocate.connect (() => attempt_scroll ()); + Idle.add (() => { + attempt_scroll (); + return GLib.Source.CONTINUE; + }); } public void attempt_scroll () { - var adj = vadjustment; - + var adj = scrolled_window.vadjustment; var units_from_end = prev_upper_adj - adj.page_size - adj.value; - var view_size_difference = adj.upper - prev_upper_adj; - if (view_size_difference < 0) { - view_size_difference = 0; + + if (adj.upper - prev_upper_adj <= 0) { + return; } if (prev_upper_adj <= adj.page_size || units_from_end <= 50) {