aboutsummaryrefslogtreecommitdiffstats
path: root/Rpmdrake/edit_urpm_sources.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-02-21 14:24:34 +0000
committerThierry Vignaud <tv@mandriva.org>2008-02-21 14:24:34 +0000
commit86478a9966b8dcf5cb7557dca5cfca355ab7d207 (patch)
treee0c672f91ec498bccb715551be23cd2dbddb8a4b /Rpmdrake/edit_urpm_sources.pm
parent07e6e00b91a64bf968f5c06885372704d2ff182c (diff)
downloadrpmdrake-86478a9966b8dcf5cb7557dca5cfca355ab7d207.tar
rpmdrake-86478a9966b8dcf5cb7557dca5cfca355ab7d207.tar.gz
rpmdrake-86478a9966b8dcf5cb7557dca5cfca355ab7d207.tar.bz2
rpmdrake-86478a9966b8dcf5cb7557dca5cfca355ab7d207.tar.xz
rpmdrake-86478a9966b8dcf5cb7557dca5cfca355ab7d207.zip
(options_callback) make all global options use combo boxes & simplify code
Diffstat (limited to 'Rpmdrake/edit_urpm_sources.pm')
-rw-r--r--Rpmdrake/edit_urpm_sources.pm31
1 files changed, 15 insertions, 16 deletions
diff --git a/Rpmdrake/edit_urpm_sources.pm b/Rpmdrake/edit_urpm_sources.pm
index 97dd573a..4e672f59 100644
--- a/Rpmdrake/edit_urpm_sources.pm
+++ b/Rpmdrake/edit_urpm_sources.pm
@@ -319,13 +319,10 @@ really want to replace it?"), yesno => 1) or return 0;
sub options_callback() {
my $w = ugtk2->new(N("Global options for package installation"), grab => 1, center => 1, transient => $::main_window);
local $::main_window = $w->{real_window};
- my @verif_radio_infos = (
- { name => N("always"), value => 1 },
- { name => N("never"), value => 0 },
- );
- my @verif_radio = gtkradio($verif_radio_infos[$urpm->{options}{'verify-rpm'} ? 0 : 1]{name}, map { $_->{name} } @verif_radio_infos);
+ my %verif = (0 => N("never"), 1 => N("always"));
+ my $verify_rpm = $urpm->{global_config}{'verify-rpm'};
my @avail_downloaders = urpm::download::available_ftp_http_downloaders();
- my @downl_radio = gtkradio($urpm->{options}{downloader} || $avail_downloaders[0], @avail_downloaders);
+ my $downloader = $urpm->{global_config}{downloader} || $avail_downloaders[0];
my %xml_info_policies = (
'never' => N("Never"),
'on-demand' => N("On-demand"),
@@ -337,8 +334,16 @@ sub options_callback() {
$w->{window},
gtkpack(
gtknew('VBox', spacing => 5),
- gtknew('HBox', children_loose => [ gtknew('Label', text => N("Verify RPMs to be installed:")), @verif_radio ]),
- gtknew('HBox', children_loose => [ gtknew('Label', text => N("Download program to use:")), @downl_radio ]),
+ gtknew('HBox', children_loose => [ gtknew('Label', text => N("Verify RPMs to be installed:")),
+ gtknew('ComboBox', list => [ keys %verif ], text_ref => \$verify_rpm,
+ format => sub { $verif{$_[0]} || $_[0] },
+ )
+ ]),
+ gtknew('HBox', children_loose => [ gtknew('Label', text => N("Download program to use:")),
+ gtknew('ComboBox', list => \@avail_downloaders, text_ref => \$downloader,
+ format => sub { $verif{$_[0]} || $_[0] },
+ )
+ ]),
gtknew('HBox',
children_loose =>
[ gtknew('Label', text => N("XML metada download policy:")),
@@ -371,14 +376,8 @@ sub options_callback() {
gtknew('Button', text => N("Cancel"), clicked => sub { Gtk2->main_quit }),
gtksignal_connect(
gtknew('Button', text => N("Ok")), clicked => sub {
- foreach my $i (0 .. $#verif_radio) {
- $verif_radio[$i]->get_active
- and $urpm->{global_config}{'verify-rpm'} = $verif_radio_infos[$i]{value};
- }
- foreach my $i (0 .. $#downl_radio) {
- $downl_radio[$i]->get_active
- and $urpm->{global_config}{downloader} = $avail_downloaders[$i];
- }
+ $urpm->{global_config}{'verify-rpm'} = $verify_rpm;
+ $urpm->{global_config}{downloader} = $downloader;
$something_changed = 1;
urpm::media::write_config($urpm);
$urpm = fast_open_urpmi_db();