diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-02-27 22:06:12 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-02-27 22:06:12 +0000 |
commit | 0c05477402161629b48af5278c8fedfb53f4e882 (patch) | |
tree | 239b872273ab4d3161c41d9c914779da97648e1a /perl-install/interactive | |
parent | ff7edea0ae4bd9d7c2312f7668d35d2da04932df (diff) | |
download | drakx-0c05477402161629b48af5278c8fedfb53f4e882.tar drakx-0c05477402161629b48af5278c8fedfb53f4e882.tar.gz drakx-0c05477402161629b48af5278c8fedfb53f4e882.tar.bz2 drakx-0c05477402161629b48af5278c8fedfb53f4e882.tar.xz drakx-0c05477402161629b48af5278c8fedfb53f4e882.zip |
workaround gtk suckiness (set_text in a combo generates two 'change' signals, one when removing the whole, one for inserting the replacement..)
Diffstat (limited to 'perl-install/interactive')
-rw-r--r-- | perl-install/interactive/gtk.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index 867f34b92..1dd35e951 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -530,6 +530,13 @@ sub ask_fromW { $w->set_popdown_strings(@formatted_list); ($real_w, $w) = ($w, $w->entry); + + #- FIXME workaround gtk suckiness (set_text generates two 'change' signals, one when removing the whole, one for inserting the replacement..) + my $idle; + $w->signal_connect(changed => sub { + $idle ||= Gtk2->idle_add(sub { undef $idle; $changed->(); 0 }); + }); + $set = sub { my $s = may_apply($e->{format}, $_[0]); $w->set_text($s) if $s ne $w->get_text && $_[0] ne $w->get_text; @@ -545,13 +552,13 @@ sub ask_fromW { $width = $l[@l / 16]; # take the third octile (think quartile) } else { $w = Gtk2::Entry->new; + $w->signal_connect(changed => $changed); $w->signal_connect(focus_in_event => sub { $w->select_region(0, -1) }); $w->signal_connect(focus_out_event => sub { $w->select_region(0, 0) }); $set = sub { $w->set_text($_[0]) if $_[0] ne $w->get_text }; $get = sub { $w->get_text }; } $w->signal_connect(key_press_event => $may_go_to_next); - $w->signal_connect(changed => $changed); $w->set_visibility(0) if $e->{hidden}; } $w->signal_connect(focus_out_event => sub { |