diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-01-11 17:44:18 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-01-11 17:44:18 +0000 |
commit | b32096510ceca74e36ad973e73cf4527f305d3a8 (patch) | |
tree | 23631cc694e73a3b944e1cf8556c108a50157019 /edit-urpm-sources.pl | |
parent | 2ff99e1dd0e4ccac3a4c88686775686b5b9e418d (diff) | |
download | rpmdrake-b32096510ceca74e36ad973e73cf4527f305d3a8.tar rpmdrake-b32096510ceca74e36ad973e73cf4527f305d3a8.tar.gz rpmdrake-b32096510ceca74e36ad973e73cf4527f305d3a8.tar.bz2 rpmdrake-b32096510ceca74e36ad973e73cf4527f305d3a8.tar.xz rpmdrake-b32096510ceca74e36ad973e73cf4527f305d3a8.zip |
Work in progress in the software media manager -- requalify the "Add..." button
to add the sources for the current distribution, and rename the old "Add..."
button to "Add custom..."
Diffstat (limited to 'edit-urpm-sources.pl')
-rwxr-xr-x | edit-urpm-sources.pl | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/edit-urpm-sources.pl b/edit-urpm-sources.pl index 38355f67..690402c8 100755 --- a/edit-urpm-sources.pl +++ b/edit-urpm-sources.pl @@ -26,6 +26,7 @@ use lib qw(/usr/lib/libDrakX); use common; use rpmdrake; use URPM::Signature; +use MDK::Common qw/max/; BEGIN { eval { require ugtk2; ugtk2->import(qw(:all)) }; @@ -59,6 +60,35 @@ sub remove_row { $model->remove($iter); } +sub easy_add_callback { + my $m = choose_mirror(message => +N("This will attempt to install all official sources corresponding to your +distribution (%s). + +I need to contact the Mandrakesoft website to get the mirror list. +Please check that your network is currently running. + +Is it ok to continue?", $rpmdrake::mandrake_release) + ) or return 0; + my $wait = wait_msg(N("Please wait, adding media...")); + my $url = make_url_mirror_dist($m); + my $medium_name; + if ($rpmdrake::mandrake_release =~ /(\d+\.\d+) \((\w+)\)/) { + $medium_name = $2 . $1 . '-'; + } else { + $medium_name = 'distrib'; + } + #- ensure a unique medium name + my $initial_number = 1 + max map { $_->{name} =~ /\(\Q$medium_name\E(\d+)\b/ ? $1 : 0 } @{$urpm->{media}}; + add_medium_and_check( + $urpm, + { nolock => 1, distrib => 1 }, + $medium_name, $url, probe_with => 'synthesis', initial_number => $initial_number, + ); + remove_wait_msg($wait); + return 1; +} + sub add_callback { my $w = ugtk2->new(N("Add a medium"), grab => 1, center => 1, transient => $mainw->{rwindow}); my %radios_infos = (local => { name => N("Local files"), url => N("Path:"), dirsel => 1 }, @@ -925,6 +955,10 @@ sub mainwindow { ), gtksignal_connect( Gtk2::Button->new(but(N("Add..."))), + clicked => sub { easy_add_callback() and $reread_media->() }, + ), + gtksignal_connect( + Gtk2::Button->new(but(N("Add custom..."))), clicked => sub { add_callback() and $reread_media->() }, ), gtksignal_connect( |