summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-08-31 16:02:14 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-08-31 16:02:14 +0000
commit56391bbfee030c761865d93b8694ecba108579b9 (patch)
tree91fe7818a37afb5d68b751b9f9367c1c209a0e75
parentfd771f8a0ff1cbdcfdb0640206cf927251c899be (diff)
downloaddrakx-56391bbfee030c761865d93b8694ecba108579b9.tar
drakx-56391bbfee030c761865d93b8694ecba108579b9.tar.gz
drakx-56391bbfee030c761865d93b8694ecba108579b9.tar.bz2
drakx-56391bbfee030c761865d93b8694ecba108579b9.tar.xz
drakx-56391bbfee030c761865d93b8694ecba108579b9.zip
use "to_bottom" functionality from mygtk2 (note that scroll_to_iter is no good for this, scroll_to_mark is better (cf gtk's doc))
-rw-r--r--perl-install/ugtk2.pm12
1 files changed, 4 insertions, 8 deletions
diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm
index 13c83c786..407aa223b 100644
--- a/perl-install/ugtk2.pm
+++ b/perl-install/ugtk2.pm
@@ -1303,7 +1303,7 @@ sub gtk_set_treelist {
sub gtk_TextView_get_log {
- my ($log_w, $log_scroll, $command, $filter_output, $when_command_is_over) = @_;
+ my ($log_w, $command, $filter_output, $when_command_is_over) = @_;
my $pid = open(my $F, "$command |") or return;
fcntl($F, c::F_SETFL(), c::O_NONBLOCK()) or die "can not fcntl F_SETFL: $!";
@@ -1314,17 +1314,13 @@ sub gtk_TextView_get_log {
$pid = $gtk_buffer = ''; #- ensure $gtk_buffer is valid when its value is non-null
});
- my ($prev_scroll, $want_scroll_down) = (0, 1);
Glib::Timeout->add(100, sub {
if ($gtk_buffer) {
my $end = $gtk_buffer->get_end_iter;
while (defined (my $s = <$F>)) {
$gtk_buffer->insert($end, $filter_output->($s));
}
- my $new_scroll = $log_scroll->get_vadjustment->get_value;
- $want_scroll_down &&= $new_scroll >= $prev_scroll;
- $prev_scroll = $new_scroll;
- $log_w->scroll_to_iter($end, 0, 0, 0, 0) if $want_scroll_down;
+ $log_w->{to_bottom}->();
}
if (waitpid($pid, c::WNOHANG()) > 0) {
#- we do not call $when_command_is_over if $gtk_buffer does not exist anymore
@@ -1343,8 +1339,8 @@ sub gtk_new_TextView_get_log {
my ($command, $filter_output, $when_command_is_over) = @_;
my $log_w = gtknew('TextView', editable => 0);
- my $log_scroll = gtknew('ScrolledWindow', child => $log_w); #- $log_scroll is a frame, not a ScrolledWindow, so giving $log_scroll->child
- my $pid = gtk_TextView_get_log($log_w, $log_scroll->child, $command, $filter_output, $when_command_is_over) or return;
+ my $log_scroll = gtknew('ScrolledWindow', child => $log_w, to_bottom => 1);
+ my $pid = gtk_TextView_get_log($log_w, $command, $filter_output, $when_command_is_over) or return;
$log_scroll, $pid;
}