From ac3a9376ff3f253e55795fa833383eb72553a925 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 19 Sep 2005 11:11:35 +0000 Subject: titi's patch is wrong, the ->set_cursor being not done when selecting and exiting window on the event (ie double clicking on the entry) we really would need to do things more cleanly (i know on TextView ->scroll_to_mark works better than ->scroll_to_cell) --- perl-install/interactive/gtk.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index 32dc2e87a..e024fc54f 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -82,8 +82,9 @@ sub create_treeview_list { $list_tv->append_column($textcolumn); my $select = sub { - $list_tv->set_cursor($_[0], undef, 0); - $list_tv->scroll_to_cell($_[0], undef, 1, 0.5, 0); + my ($path) = @_; + $list_tv->set_cursor($path, undef, 0); + Glib::Timeout->add(100, sub { $list_tv->scroll_to_cell($path, undef, 1, 0.5, 0); 0 }); }; my ($starting_word, $start_reg) = ('', '^'); @@ -143,7 +144,7 @@ sub create_treeview_list { my $nb = find_index { $_ eq $v } @{$e->{list}}; my ($old_path) = $list_tv->get_cursor; if (!$old_path || $nb != $old_path->to_string) { - Glib::Timeout->add(100, sub { $select->(Gtk2::TreePath->new_from_string($nb)); 0 }); + $select->(Gtk2::TreePath->new_from_string($nb)); } undef $old_path if $old_path; }; -- cgit v1.2.1