From 6a845868e1d54b46df737953dce31a8bad355c9e Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 28 Jan 2004 11:37:27 +0000 Subject: create add_modify_remove_sensitive() and use it so that "Modify" and "Remove" are non sensitive when the initial list is empty --- perl-install/interactive/gtk.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index 9476d78de..4e3d2666c 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -356,9 +356,15 @@ sub add_modify_remove_action { ${$e->{val}} = $e->{list}[0]; } ugtk2::gtk_set_treelist($treelist, [ map { may_apply($e->{format}, $_) } @{$e->{list}} ]); + + add_modify_remove_sensitive($buttons, $e); + 1; +} + +sub add_modify_remove_sensitive { + my ($buttons, $e) = @_; $_->{button}->set_sensitive(@{$e->{list}} != ()) foreach grep { member($_->{kind}, 'modify', 'remove') } @$buttons; - 1; } sub ask_fromW { @@ -482,6 +488,8 @@ sub ask_fromW { foreach my $button (@buttons) { $button->{button}->signal_connect(clicked => sub { $do_action->($button) }); } + add_modify_remove_sensitive(\@buttons, $e); + $real_w = gtkpack_(Gtk2::HBox->new(0,0), 1, create_scrolled_window($w), 0, gtkpack__(Gtk2::VBox->new(0,0), map { $_->{button} } @buttons)); -- cgit v1.2.1