From 67025e7bfe767d0943245f4395666af296b3bf74 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 1 Mar 2007 15:45:45 +0000 Subject: adapt to multiple selection: disable "edit" button if there's more than one selected row --- Rpmdrake/edit_urpm_sources.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Rpmdrake/edit_urpm_sources.pm') diff --git a/Rpmdrake/edit_urpm_sources.pm b/Rpmdrake/edit_urpm_sources.pm index 79319e77..e0c4fb7e 100755 --- a/Rpmdrake/edit_urpm_sources.pm +++ b/Rpmdrake/edit_urpm_sources.pm @@ -895,10 +895,16 @@ sub mainwindow() { $list_tv->get_selection->set_mode('multiple'); my ($dw_button, $edit_button, $up_button, $update_button); $list_tv->get_selection->signal_connect(changed => sub { - my ($model, $iter) = $_[0]->get_selected; - $_ and $_->set_sensitive(defined $iter) foreach $remove_button, $edit_button; - return if !$iter; - my $curr_path = $model->get_path($iter); + my ($selection) = @_; + my @rows = $selection->get_selected_rows; + my $model = $list; + # we can delete several medium at a time: + $remove_button and $remove_button->set_sensitive($#rows != -1); + # we can only edit/move one item at a time: + $_ and $_->set_sensitive($#rows == 0) foreach $up_button, $dw_button, $edit_button; + return if !$#rows == 0; + + my $curr_path = $rows[0]; my $first_path = $model->get_path($model->get_iter_first); $up_button->set_sensitive($first_path && $first_path->compare($curr_path)); -- cgit v1.2.1