aboutsummaryrefslogtreecommitdiffstats
path: root/Rpmdrake/edit_urpm_sources.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-02-21 14:25:12 +0000
committerThierry Vignaud <tv@mandriva.org>2008-02-21 14:25:12 +0000
commit03b6b0e9765ef36255718350c8430192ff5f8ddf (patch)
tree8520e9e6cc4265c3e348413eb5fb1be39be71a80 /Rpmdrake/edit_urpm_sources.pm
parent472f9405bb5314cab4c72acd73bd61d1bb8dd137 (diff)
downloadrpmdrake-03b6b0e9765ef36255718350c8430192ff5f8ddf.tar
rpmdrake-03b6b0e9765ef36255718350c8430192ff5f8ddf.tar.gz
rpmdrake-03b6b0e9765ef36255718350c8430192ff5f8ddf.tar.bz2
rpmdrake-03b6b0e9765ef36255718350c8430192ff5f8ddf.tar.xz
rpmdrake-03b6b0e9765ef36255718350c8430192ff5f8ddf.zip
(edit_parallel) factorize more duplicated initialization
Diffstat (limited to 'Rpmdrake/edit_urpm_sources.pm')
-rw-r--r--Rpmdrake/edit_urpm_sources.pm20
1 files changed, 10 insertions, 10 deletions
diff --git a/Rpmdrake/edit_urpm_sources.pm b/Rpmdrake/edit_urpm_sources.pm
index 1ee810ad..8c5ad385 100644
--- a/Rpmdrake/edit_urpm_sources.pm
+++ b/Rpmdrake/edit_urpm_sources.pm
@@ -646,11 +646,16 @@ sub edit_parallel {
local $::main_window = $w->{real_window};
my $name_entry;
- my $medias_ls = Gtk2::ListStore->new("Glib::String");
- my $medias = Gtk2::TreeView->new_with_model($medias_ls);
- $medias->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0));
- $medias->set_headers_visible(0);
- $medias->get_selection->set_mode('browse');
+ my ($medias_ls, $hosts_ls) = (Gtk2::ListStore->new("Glib::String"), Gtk2::ListStore->new("Glib::String"));
+
+ my ($medias, $hosts) = map {
+ my $list = Gtk2::TreeView->new_with_model($_);
+ $list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0));
+ $list->set_headers_visible(0);
+ $list->get_selection->set_mode('browse');
+ $list;
+ } $medias_ls, $hosts_ls;
+
$medias_ls->append_set([ 0 => $_ ]) foreach @{$edited->{medias}};
my $add_media = sub {
@@ -687,11 +692,6 @@ sub edit_parallel {
}
};
- my $hosts_ls = Gtk2::ListStore->new("Glib::String");
- my $hosts = Gtk2::TreeView->new_with_model($hosts_ls);
- $hosts->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0));
- $hosts->set_headers_visible(0);
- $hosts->get_selection->set_mode('browse');
my $hosts_list;
if ($edited->{protocol} eq 'ssh') { $hosts_list = [ split /:/, $edited->{command} ] }
elsif ($edited->{protocol} eq 'ka-run') { push @$hosts_list, $1 while $edited->{command} =~ /-m (\S+)/g }