summaryrefslogtreecommitdiffstats
path: root/perl-install/interactive
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-03-03 21:14:51 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-03-03 21:14:51 +0000
commit2e4e1e142c254e7c503360ce4954e2d8de402d66 (patch)
treee4f827c73f5b9b5eea3d10bf5dc0ed2ad240efc2 /perl-install/interactive
parentc4d02fb42223a3cefaaf2d6d81cb13322a262d50 (diff)
downloaddrakx-backup-do-not-use-2e4e1e142c254e7c503360ce4954e2d8de402d66.tar
drakx-backup-do-not-use-2e4e1e142c254e7c503360ce4954e2d8de402d66.tar.gz
drakx-backup-do-not-use-2e4e1e142c254e7c503360ce4954e2d8de402d66.tar.bz2
drakx-backup-do-not-use-2e4e1e142c254e7c503360ce4954e2d8de402d66.tar.xz
drakx-backup-do-not-use-2e4e1e142c254e7c503360ce4954e2d8de402d66.zip
a few treeview/list fixes:
- when selecting a value, scroll it like in treeview/tree - use saved_default_val dirty hackery to really honour default value - fix not calling $select again when trying to select an already selected value (happens when clicking or keyboard-selecting; broken, it ended up in always scrolling the selected value to the center)
Diffstat (limited to 'perl-install/interactive')
-rw-r--r--perl-install/interactive/gtk.pm15
1 files changed, 12 insertions, 3 deletions
diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm
index 1dd35e951..e5e6e5183 100644
--- a/perl-install/interactive/gtk.pm
+++ b/perl-install/interactive/gtk.pm
@@ -74,7 +74,10 @@ sub create_treeview_list {
my $textcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new(), 'text' => 0);
$list_tv->append_column($textcolumn);
- my $select = sub { $list_tv->set_cursor($_[0], $textcolumn, 0) };
+ my $select = sub {
+ $list_tv->set_cursor($_[0], undef, 0);
+ $list_tv->scroll_to_cell($_[0], undef, 1, 0.5, 0);
+ };
my ($starting_word, $start_reg) = ('', '^');
my $timeout;
@@ -134,7 +137,7 @@ sub create_treeview_list {
eval {
my $nb = find_index { $_ eq $v } @{$e->{list}};
my ($old_path) = $list_tv->get_cursor;
- if (!$old_path || $nb != $old_path) {
+ if (!$old_path || $nb != $old_path->to_string) {
$select->(my $path = Gtk2::TreePath->new_from_string($nb));
$path->free;
}
@@ -482,6 +485,7 @@ sub ask_fromW {
$size = 6;
($w, $set, $focus_w) = create_treeview_list($e, $may_go_to_next, $changed,
sub { $do_action->('Modify') if $_[1]->type =~ /^2/ });
+ $e->{saved_default_val} = ${$e->{val}};
%buttons = map {
my $action = $_;
@@ -509,7 +513,12 @@ sub ask_fromW {
($w, $set, $size) = create_treeview_tree(@para, $e->{tree_expanded});
$e->{saved_default_val} = ${$e->{val}}; #- during realization, signals will mess up the default val :(
} else {
- ($w, $set, $focus_w) = $use_boxradio ? create_boxradio(@para) : create_treeview_list(@para);
+ if ($use_boxradio) {
+ ($w, $set, $focus_w) = create_boxradio(@para);
+ } else {
+ ($w, $set, $focus_w) = create_treeview_list(@para);
+ $e->{saved_default_val} = ${$e->{val}};
+ }
}
if (@{$e->{list}} > (@$l == 1 ? 10 : 4) || $e->{add_modify_remove}) {
$has_scroll = $expand = 1;