From 17fb15fa0eae808c23e33022a5be7a47479cb169 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 27 Aug 2007 09:40:25 +0000 Subject: (warn_about_media) add a "Do not ask me next time" checkbox (#17697) --- Rpmdrake/pkg.pm | 6 +++++- rpmdrake.pm | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm index 8454da9f..3e112a8b 100755 --- a/Rpmdrake/pkg.pm +++ b/Rpmdrake/pkg.pm @@ -195,7 +195,11 @@ sub warn_about_media { N("I need to contact the mirror to get latest update packages. Please check that your network is currently running. -Is it ok to continue?"), yesno => 1) or myexit(-1); +Is it ok to continue?"), yesno => 1, + widget => gtknew('CheckButton', text => N("Do not ask me next time"), + active_ref => \$::rpmdrake_options{'no-confirmation'} + )) or myexit(-1); + writeconf(); urpm::media::select_media($urpm, map { $_->{name} } @update_medias); update_sources($urpm, noclean => 1, banner => $::isEmbedded); } diff --git a/rpmdrake.pm b/rpmdrake.pm index a355d6bf..c4a555be 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -155,7 +155,7 @@ $ENV{HOME} = $> == 0 ? $root->[7] : $ENV{HOME} || '/root'; our $configfile = "$ENV{HOME}/.rpmdrake"; our ($already_splashed, $changelog_first_config, $max_info_in_descr, $tree_flat, $tree_mode); -our ($mandrakeupdate_wanted_categories, $offered_to_add_sources); +our ($mandrakeupdate_wanted_categories, $offered_to_add_sources, $no_confirmation); our %config = ( mandrakeupdate_wanted_categories => { var => \$mandrakeupdate_wanted_categories, default => [ qw(security) ] }, already_splashed => { var => \$already_splashed, default => [] }, @@ -164,6 +164,7 @@ our %config = ( tree_mode => { var => \$tree_mode, default => [ qw(mandrake_choices) ] }, tree_flat => { var => \$tree_flat, default => [ 0 ] }, changelog_first_config => { var => \$changelog_first_config, default => [ 0 ] }, + 'no-confirmation' => { var => \$no_confirmation, default => [ 0 ] }, ); sub readconf() { @@ -171,10 +172,14 @@ sub readconf() { foreach my $l (cat_($configfile)) { $l =~ /^\Q$_\E (.*)/ and ${$config{$_}{var}} = [ split ' ', $1 ] foreach keys %config; } + # special case: + $::rpmdrake_options{'no-confirmation'} = $no_confirmation->[0] if !defined $::rpmdrake_options{'no-confirmation'}; } sub writeconf() { unlink $configfile; + # special case: + $no_confirmation->[0] = $::rpmdrake_options{'no-confirmation'}; output $configfile, map { "$_ " . (ref ${$config{$_}{var}} ? join(' ', @${$config{$_}{var}}) : ()) . "\n" } keys %config; } -- cgit v1.2.1