diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2003-05-22 20:34:13 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2003-05-22 20:34:13 +0000 |
commit | e44c747246bc944785e93ec8e189e9de449b49cd (patch) | |
tree | 310e346ba05ead4c9651791e33d2fa33abe46bb4 /edit-urpm-sources.pl | |
parent | 7467b3108b2231e96f3ed5bff3d7a722309d31ec (diff) | |
download | rpmdrake-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-x | edit-urpm-sources.pl | 16 |
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->(); |