aboutsummaryrefslogtreecommitdiffstats
path: root/edit-urpm-sources.pl
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-05-22 20:34:13 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-05-22 20:34:13 +0000
commite44c747246bc944785e93ec8e189e9de449b49cd (patch)
tree310e346ba05ead4c9651791e33d2fa33abe46bb4 /edit-urpm-sources.pl
parent7467b3108b2231e96f3ed5bff3d7a722309d31ec (diff)
downloadrpmdrake-e44c747246bc944785e93ec8e189e9de449b49cd.tar
rpmdrake-e44c747246bc944785e93ec8e189e9de449b49cd.tar.gz
rpmdrake-e44c747246bc944785e93ec8e189e9de449b49cd.tar.bz2
rpmdrake-e44c747246bc944785e93ec8e189e9de449b49cd.tar.xz
rpmdrake-e44c747246bc944785e93ec8e189e9de449b49cd.zip
let medias be reorderable in the medias editor
Diffstat (limited to 'edit-urpm-sources.pl')
-rwxr-xr-xedit-urpm-sources.pl16
1 files changed, 16 insertions, 0 deletions
diff --git a/edit-urpm-sources.pl b/edit-urpm-sources.pl
index 5850b108..c9f9abbe 100755
--- a/edit-urpm-sources.pl
+++ b/edit-urpm-sources.pl
@@ -250,6 +250,20 @@ sub mainwindow {
$list_tv = Gtk2::TreeView->new_with_model($list);
$list_tv->get_selection->set_mode('browse');
$list_tv->set_rules_hint(1);
+ $list_tv->set_reorderable(1);
+
+ my $reorder_ok = 1;
+ $list->signal_connect(row_deleted => sub {
+ my ($model) = @_;
+ my @medias;
+ $model->foreach(sub {
+ my (undef, $path) = @_;
+ my $name = $model->get($path, 1);
+ push @medias, find { $_->{name} eq $name } @{$urpm->{media}};
+ 0;
+ }, undef);
+ @{$urpm->{media}} = @medias;
+ });
$list_tv->append_column(Gtk2::TreeViewColumn->new_with_attributes(N("Enabled?"), my $tr = Gtk2::CellRendererToggle->new, 'active' => 0));
$list_tv->append_column(Gtk2::TreeViewColumn->new_with_attributes(N("Media"), Gtk2::CellRendererText->new, 'text' => 1));
@@ -263,10 +277,12 @@ sub mainwindow {
});
my $reread_media = sub {
+ $reorder_ok = 0;
$urpm = urpm->new;
$urpm->read_config;
$list->clear;
$list->append_set([ 0 => !$_->{ignore}, 1 => $_->{name} ])->free foreach @{$urpm->{media}};
+ $reorder_ok = 1;
};
$reread_media->();