summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-08-08 23:45:02 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-08-08 23:45:02 +0000
commita3f578efbce1bc645499611f0f1cc13c996f3275 (patch)
treece010f553215da7109f4597540ff8c329cc6416e
parentf7b7767b21f34f99a5b245db1314bd060ced9009 (diff)
downloaddrakx-backup-do-not-use-a3f578efbce1bc645499611f0f1cc13c996f3275.tar
drakx-backup-do-not-use-a3f578efbce1bc645499611f0f1cc13c996f3275.tar.gz
drakx-backup-do-not-use-a3f578efbce1bc645499611f0f1cc13c996f3275.tar.bz2
drakx-backup-do-not-use-a3f578efbce1bc645499611f0f1cc13c996f3275.tar.xz
drakx-backup-do-not-use-a3f578efbce1bc645499611f0f1cc13c996f3275.zip
simplify code through Gtk2::ComboBox->new_with_strings()
-rwxr-xr-xperl-install/standalone/drakTermServ4
-rwxr-xr-xperl-install/standalone/drakbackup44
-rwxr-xr-xperl-install/standalone/drakboot13
-rwxr-xr-xperl-install/standalone/drakfloppy8
-rwxr-xr-xperl-install/standalone/drakperm9
-rwxr-xr-xperl-install/standalone/draksec5
6 files changed, 23 insertions, 60 deletions
diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ
index 9cdb728fe..a0cb72103 100755
--- a/perl-install/standalone/drakTermServ
+++ b/perl-install/standalone/drakTermServ
@@ -715,8 +715,8 @@ sub make_nbi() {
update_list($list_model);
- my $combo_default_kernel = Gtk2::ComboBox->new_text;
- $combo_default_kernel->set_popdown_strings(N("Default kernel version"), map { bootloader::vmlinuz2version($_) } @kernels);
+ my $combo_default_kernel = Gtk2::ComboBox->new_with_strings([ N("Default kernel version"),
+ map { bootloader::vmlinuz2version($_) } @kernels ]);
$combo_default_kernel->set_active(0);
$combo_default_kernel->entry->signal_connect('changed', sub {
my $default_kernel = $combo_default_kernel->entry->get_text;
diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup
index 4ad814ea7..d9cf6a4c2 100755
--- a/perl-install/standalone/drakbackup
+++ b/perl-install/standalone/drakbackup
@@ -1748,15 +1748,9 @@ sub advanced_where_cd {
$dev_codes{$cd_devices{$key}{rec_dev}} = $key;
}
- my $combo_where_cd_device = Gtk2::ComboBox->new_text;
- if (keys %cd_devices) {
- $combo_where_cd_device->set_popdown_strings('', sort keys %dev_codes);
- } else {
- $combo_where_cd_device->set_popdown_strings(@no_devices);
- }
+ my $combo_where_cd_device = Gtk2::ComboBox->new_with_strings(%cd_devices ? [ sort keys %dev_codes ] : \@no_devices);
- my $combo_where_cd_time = Gtk2::ComboBox->new_text;
- $combo_where_cd_time->set_popdown_strings("650 MB", "700 MB", "750 MB", "800 MB", "4.7 GB");
+ my $combo_where_cd_time = Gtk2::ComboBox->new_with_strings([ "650 MB", "700 MB", "750 MB", "800 MB", "4.7 GB" ]);
gtkpack($advanced_box,
$box_where_cd = gtkpack_(new Gtk2::VBox(0, 6),
@@ -1859,12 +1853,7 @@ sub advanced_where_tape {
#- look for tape devices;
get_tape_info();
- my $combo_where_tape_device = Gtk2::ComboBox->new_text;
- if (@tape_devices) {
- $combo_where_tape_device->set_popdown_strings('', @tape_devices)
- } else {
- $combo_where_tape_device->set_popdown_strings(@no_devices);
- }
+ my $combo_where_tape_device = Gtk2::ComboBox->new_with_strings(@tape_devices ? \@tape_devices : \@no_devices);
my $box_where_tape;
local $_;
@@ -2064,7 +2053,7 @@ sub advanced_where() {
sub advanced_when() {
my $box_when;
my $allow_custom = $backup_daemon && $custom_cron;
- my $combo_when_space = Gtk2::ComboBox->new_text;
+ my $combo_when_space = Gtk2::ComboBox->new_with_strings([ "", N("hourly"), N("daily"), N("weekly"), N("monthly"), N("custom") ]);
my %trans = (N("hourly") => 'hourly',
N("daily") => 'daily',
N("weekly") => 'weekly',
@@ -2075,25 +2064,20 @@ sub advanced_when() {
'weekly' => N("weekly"),
'monthly' => N("monthly"),
'custom' => N("custom"));
- $combo_when_space->set_popdown_strings("", N("hourly"), N("daily"), N("weekly"), N("monthly"), N("custom"));
set_help_tip($combo_when_space, 'when_space');
#- custom setup - let user specify month, day of month, day of week, hour, minute
- my $combo_month_when = Gtk2::ComboBox->new_text;
my @months = ("*", N("January"), N("February"), N("March"),
N("April"), N("May"), N("June"), N("July"), N("August"), N("September"),
N("October"), N("November"), N("December"));
- $combo_month_when->set_popdown_strings(@months);
- my $combo_day_when = Gtk2::ComboBox->new_text;
- $combo_day_when->set_popdown_strings("*", (1..31));
- my $combo_weekday_when = Gtk2::ComboBox->new_text;
+ my $combo_month_when = Gtk2::ComboBox->new_with_strings(\@months);
+ my $combo_day_when = Gtk2::ComboBox->new_with_strings([ "*", (1..31) ]);
my @weekdays = ("*", N("Sunday"), N("Monday"), N("Tuesday"),
N("Wednesday"), N("Thursday"), N("Friday"), N("Saturday"));
- $combo_weekday_when->set_popdown_strings(@weekdays);
+ my $combo_weekday_when = Gtk2::ComboBox->new_with_strings(\@weekdays);
my $combo_hour_when = Gtk2::ComboBox->new_text;
$combo_hour_when->set_popdown_strings("*", (0..23));
- my $combo_minute_when = Gtk2::ComboBox->new_text;
- $combo_minute_when->set_popdown_strings("*", (0..59));
+ my $combo_minute_when = Gtk2::ComboBox->new_with_strings([ "*", (0..59) ]);
my $entry_crontab = new Gtk2::Entry();
gtkset_editable($entry_crontab, 0);
@@ -2114,9 +2098,7 @@ sub advanced_when() {
}
#- drop down list of possible media - default to config value
- my $entry_media_type = Gtk2::ComboBox->new_text;
- $entry_media_type->set_popdown_strings(sort(@net_methods, @media_types));
- $entry_media_type->entry->set_text($conf{DAEMON_MEDIA}) if $conf{DAEMON_MEDIA};
+ my $entry_media_type = Gtk2::ComboBox->new_with_strings([ sort(@net_methods, @media_types) ], $conf{DAEMON_MEDIA});
gtkpack($advanced_box,
$box_when = gtkpack_(new Gtk2::VBox(0, 10),
@@ -2213,9 +2195,7 @@ sub combo_to_cron_string {
sub advanced_options() {
my $box_options;
- my $entry_comp_mode = Gtk2::ComboBox->new_text;
- $entry_comp_mode->set_popdown_strings("tar", "tar.gz", "tar.bz2");
- $entry_comp_mode->entry->set_text($conf{OPTION_COMP});
+ my $entry_comp_mode = Gtk2::ComboBox->new_with_strings([ "tar", "tar.gz", "tar.bz2" ], $conf{OPTION_COMP});
gtkpack($advanced_box,
$box_options = gtkpack_(new Gtk2::VBox(0, 15),
0, gtkpack_(new Gtk2::HBox(0,10),
@@ -3024,9 +3004,7 @@ sub restore_step_user() {
sub restore_step_sys() {
my $restore_step_sys;
- my $combo_restore_step_sys = Gtk2::ComboBox->new_text;
- $combo_restore_step_sys->set_popdown_strings(@sys_backuped);
- $combo_restore_step_sys->entry->set_text($restore_step_sys_date);
+ my $combo_restore_step_sys = Gtk2::ComboBox->new_with_strings(\@sys_backuped, $restore_step_sys_date);
gtkpack($advanced_box,
$restore_step_sys = gtkpack_(new Gtk2::VBox(0,10),
0, N("Please choose the date to restore:"),
diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot
index 4fe1e0513..fd7649e13 100755
--- a/perl-install/standalone/drakboot
+++ b/perl-install/standalone/drakboot
@@ -78,12 +78,8 @@ unless ($::isEmbedded) {
######### menus end
}
-my $user_combo = Gtk2::ComboBox->new_text;
-$user_combo->set_popdown_strings(sort(list_users()));
-$user_combo->entry->set_text($auto_mode->{autologin}) if $auto_mode->{autologin};
-my $desktop_combo = Gtk2::ComboBox->new_text;
-$desktop_combo->set_popdown_strings(sort(split(' ', `/usr/sbin/chksession -l`)));
-$desktop_combo->entry->set_text($auto_mode->{desktop}) if $auto_mode->{desktop};
+my $user_combo = Gtk2::ComboBox->new_with_strings([ sort(list_users()) ], $auto_mode->{autologin});
+my $desktop_combo = Gtk2::ComboBox->new_with_strings([ sort(split(' ', `/usr/sbin/chksession -l`)) ], $auto_mode->{desktop});
my %themes = ('path' => '/usr/share/bootsplash/themes/',
'sysconfig' => '/etc/sysconfig/bootsplash',
@@ -128,13 +124,12 @@ foreach (all('.')) {
-f "$themes{path}$_$themes{boot}{path}bootsplash-$cur_res.jpg" and push @boot_thms, $_;
}
}
-my %combo = ('thms' => '', 'lilo' => '', 'boot' => '');
+my %combo = ('thms' => '', 'lilo' => '');
foreach (keys(%combo)) {
$combo{$_} = gtkset_size_request(Gtk2::ComboBox->new_text, 10, -1);
}
-$combo{boot}->set_popdown_strings(@boot_thms);
-$combo{boot}->entry->set_text($themes{default});
+$combo{boot} = gtkset_size_request(Gtk2::ComboBox->new_with_strings(\@boot_thms, $themes{default}), 10, -1);;
my $boot_pic = gtkcreate_img($themes{def_thmb});
change_image($boot_pic, $themes{default});
diff --git a/perl-install/standalone/drakfloppy b/perl-install/standalone/drakfloppy
index 3249276f2..2734286e1 100755
--- a/perl-install/standalone/drakfloppy
+++ b/perl-install/standalone/drakfloppy
@@ -62,15 +62,11 @@ eval { %options = getVarsFromSh($conffile) };
######## up part
# device part
-my $device_combo = Gtk2::ComboBox->new_text;
-$device_combo->set_popdown_strings(map { "/dev/" . $_->{device} } detect_devices::floppies());
+my $device_combo = Gtk2::ComboBox->new_with_strings([ map { "/dev/" . $_->{device} } detect_devices::floppies() ]);
$device_combo->set_active(0);
-
# kernel part
-my $kernel_combo = Gtk2::ComboBox->new_text;
-$kernel_combo->set_popdown_strings(sort grep { !/^\.\.?$/ } sort(all("/lib/modules")));
-$kernel_combo->entry->set_text(chomp_(`uname -r`));
+my $kernel_combo = Gtk2::ComboBox->new_with_strings([ sort grep { !/^\.\.?$/ } sort(all("/lib/modules")) ], chomp_(`uname -r`));
##########################################################
diff --git a/perl-install/standalone/drakperm b/perl-install/standalone/drakperm
index 234228edb..2eae934b8 100755
--- a/perl-install/standalone/drakperm
+++ b/perl-install/standalone/drakperm
@@ -51,8 +51,7 @@ my $index = 0;
load_perms();
#- widgets settings
-my $combo_perm = Gtk2::ComboBox->new_text;
-$combo_perm->set_popdown_strings(sort(values %perm_l10n));
+my $combo_perm = Gtk2::ComboBox->new_with_strings([ sort(values %perm_l10n) ]);
sub add_callback() {
row_setting_dialog();
@@ -275,12 +274,10 @@ sub row_setting_dialog {
my $alrd_exsts = defined $iter;
$file->set_text($model->get($iter, 1)) if $iter;
- my $users = Gtk2::ComboBox->new_text;
- $users->set_popdown_strings(&get_user_or_group('users'));
+ my $users = Gtk2::ComboBox->new_with_strings([ get_user_or_group('users') ]);
$users->entry->set_text($model->get($iter, 2)) if $iter;
- my $groups = Gtk2::ComboBox->new_text;
- $groups->set_popdown_strings(&get_user_or_group);
+ my $groups = Gtk2::ComboBox->new_with_strings([ get_user_or_group() ]);
$groups->entry->set_text($model->get($iter, 3)) if $iter;
my $id_box = gtkadd(Gtk2::HBox->new,
diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec
index a05cb0850..cc9474b85 100755
--- a/perl-install/standalone/draksec
+++ b/perl-install/standalone/draksec
@@ -126,10 +126,7 @@ maximum"))) ]);
sub new_nonedit_combo {
my ($string_list, $o_default_value) = @_;
- my $w = Gtk2::ComboBox->new_text;
- $w->set_popdown_strings(to_i18n(@$string_list)) unless is_empty_array_ref $string_list;
- $w->entry->set_text(to_i18n($o_default_value)) if $o_default_value;
- $w;
+ Gtk2::ComboBox->new_with_strings([ to_i18n(@$string_list) ], to_i18n($o_default_value));
}
sub set_help_tip {