summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2006-01-03 15:41:30 +0000
committerOlivier Blin <oblin@mandriva.org>2006-01-03 15:41:30 +0000
commitc2dda5abbae0ef821d2d8c93e2cf90972279f1f8 (patch)
treed309965399fedd8fdd6c09c6a74e8d21ba98a7ac
parentbe98e2d67ccfcb58c1c114bf6054b8dcb00250b0 (diff)
downloaddrakx-c2dda5abbae0ef821d2d8c93e2cf90972279f1f8.tar
drakx-c2dda5abbae0ef821d2d8c93e2cf90972279f1f8.tar.gz
drakx-c2dda5abbae0ef821d2d8c93e2cf90972279f1f8.tar.bz2
drakx-c2dda5abbae0ef821d2d8c93e2cf90972279f1f8.tar.xz
drakx-c2dda5abbae0ef821d2d8c93e2cf90972279f1f8.zip
don't have a useless empty hash in wizards objects, use the wizards hash
-rw-r--r--perl-install/network/netconnect.pm11
-rwxr-xr-xperl-install/standalone/drakconnect8
-rwxr-xr-xperl-install/standalone/drakgw9
-rwxr-xr-xperl-install/standalone/draksambashare18
-rwxr-xr-xperl-install/standalone/drakups10
-rwxr-xr-xperl-install/standalone/logdrake9
-rw-r--r--perl-install/wizards.pm24
-rwxr-xr-xtools/draklive8
8 files changed, 44 insertions, 53 deletions
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index 3b0fa1153..adf7f2084 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -243,9 +243,8 @@ sub real_main {
use locale;
set_l10n_sort();
- # main wizard:
- my $wiz;
- $wiz =
+ require wizards;
+ my $wiz = wizards->new(
{
defaultimage => "drakconnect.png",
name => N("Network & Internet Configuration"),
@@ -1394,7 +1393,8 @@ Test your connection via net_monitor or mcc. If your connection does not work, y
end => 1,
},
},
- };
+ });
+ $wiz->process($in);
#- keeping the translations in case someone want to restore these texts
if_(0,
@@ -1413,9 +1413,6 @@ Click on Ok to keep your configuration, or cancel to reconfigure your Internet &
N("You have configured multiple ways to connect to the Internet.\nChoose the one you want to use.\n\n"),
N("Internet connection"),
);
-
- require wizards;
- wizards->new->process($wiz, $in);
}
sub safe_main {
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect
index bd04c475b..64b300e6b 100755
--- a/perl-install/standalone/drakconnect
+++ b/perl-install/standalone/drakconnect
@@ -702,7 +702,8 @@ sub del_intf() {
}
@all_cards = network::ethernet::get_eth_cards($modules_conf);
my %ethernet_names = network::ethernet::get_eth_cards_names(@all_cards);
- my $wiz =
+ require wizards;
+ my $wiz = wizards->new(
{
defaultimage => "drakconnect.png",
name => N("Remove a network interface"),
@@ -747,9 +748,8 @@ sub del_intf() {
end => 1,
},
},
- };
- require wizards;
- wizards->new->safe_process($wiz, $in);
+ });
+ $wiz->safe_process($in);
$in->exit(0);
}
diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw
index 2eda7db6d..78f0b1c37 100755
--- a/perl-install/standalone/drakgw
+++ b/perl-install/standalone/drakgw
@@ -68,8 +68,8 @@ my $resolv_conf = network::network::read_resolv_conf_raw();
my $squid_conf = network::squid::read_squid_conf();
my $dhcpd_conf = network::dhcpd::read_dhcpd_conf();
-my $wiz;
-$wiz =
+require wizards;
+my $wiz = wizards->new(
{
defaultimage => "drakgw.png",
name => N("Internet Connection Sharing"),
@@ -332,9 +332,8 @@ You may now share Internet connection with other computers on your Local Area Ne
end => 1,
},
},
-};
-require wizards;
-wizards->new->safe_process($wiz, $in);
+});
+$wiz->safe_process($in);
diff --git a/perl-install/standalone/draksambashare b/perl-install/standalone/draksambashare
index 54ce32fc6..3ff11fba1 100755
--- a/perl-install/standalone/draksambashare
+++ b/perl-install/standalone/draksambashare
@@ -366,10 +366,9 @@ sub printers_section() {
}
sub add_entry() {
- use wizards;
+ require wizards;
my ($wiz_addshare_name, $wiz_addshare_comment, $wiz_addshare_path);
- my $w = wizards->new;
- my $wiz = {
+ my $wiz = wizards->new({
name => N("Add a Samba share"),
pages => {
welcome => {
@@ -426,21 +425,20 @@ sub add_entry() {
next => 0,
},
}
- };
- $w->process($wiz, $in);
+ });
+ $wiz->process($in);
$::isWizard = 0;
gtkset_mousecursor_normal();
}
sub add_printers_entry() {
- use wizards;
- my $w = wizards->new;
+ require wizards;
my %print = (
1 => N("pdf-gen - a PDF generator"),
2 => N("printers - all printers available"),
);
my $wiz_todo;
- my $wiz = {
+ my $wiz = wizards->new({
name => N("Add Special Printer share"),
pages => {
welcome => {
@@ -533,8 +531,8 @@ sub add_printers_entry() {
next => 0,
},
}
- };
- $w->process($wiz, $in);
+ });
+ $wiz->process($in);
$::isWizard = 0;
# gtkset_mousecursor_normal()
}
diff --git a/perl-install/standalone/drakups b/perl-install/standalone/drakups
index 60d626f40..1030cbc5e 100755
--- a/perl-install/standalone/drakups
+++ b/perl-install/standalone/drakups
@@ -63,10 +63,7 @@ sub add_device_wizard {
my ($in, $config) = @_;
my ($ups_models, $model_list) = readDriversList();
- use wizards;
my ($ups, $vendor, $model, $extra, $name, $driver, $port, @new_devices, $opts);
- my $w = wizards->new;
- my $wiz;
my %methods = (
# network => N("Connected through the network"), # need SNMP probe
# serial => N("Connected through a serial port"),
@@ -75,7 +72,8 @@ sub add_device_wizard {
manual => N("Manual configuration"),
);
my $method = $methods{auto};
- $wiz = {
+ require wizards;
+ my $wiz = wizards->new({
#defaultimage => "logdrake.png", # FIXME
name => N("Add an UPS device"),
pages => {
@@ -164,8 +162,8 @@ Please fill in its name, its driver and its port.", $model, $vendor);
next => 0
},
},
- };
- $w->process($wiz, $in);
+ });
+ $wiz->process($in);
$config->{$name}{driver} = $driver;
$config->{$name}{port} = $port;
diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake
index b98c30d8e..0a93d0c78 100755
--- a/perl-install/standalone/logdrake
+++ b/perl-install/standalone/logdrake
@@ -389,15 +389,14 @@ sub alert_config() {
my %services_to_check = map { $_ => 1 } split(':', $options{SERVICES});
$::isWizard = 1;
- use wizards;
- my $w = wizards->new;
my $mode;
my $cron_file = "/etc/cron.hourly/logdrake_service";
my %modes = (
configure => N("Configure the mail alert system"),
disable => N("Stop the mail alert system"),
);
- my $wiz = {
+ require wizards;
+ my $wiz = wizards->new({
defaultimage => "logdrake.png",
name => N("Mail alert"),
pages => {
@@ -460,8 +459,8 @@ sub alert_config() {
no_back => 1,
},
},
- };
- $w->process($wiz, $in);
+ });
+ $wiz->process($in);
return if $mode eq 'disable';
$options{SERVICES} = join ':', grep { $services_to_check{$_} } sort keys %services_to_check;
diff --git a/perl-install/wizards.pm b/perl-install/wizards.pm
index c7f4f9e15..22af03d53 100644
--- a/perl-install/wizards.pm
+++ b/perl-install/wizards.pm
@@ -11,12 +11,10 @@ wizards - a layer on top of interactive that ensure proper stepping
=head1 SYNOPSIS
- use wizards
- # global wizard options:
-
use wizards;
use interactive;
- my $wiz = {
+
+ my $wiz = wizards->new({
allow_user => "", # do we need root
defaultimage => "", # wizard icon
@@ -52,10 +50,9 @@ wizards - a layer on top of interactive that ensure proper stepping
],
},
},
- };
-
- my $w = wizards->new;
- $w->process($wiz, $in);
+ });
+ my $in = 'interactive'->vnew;
+ $wiz->process($in);
=head1 DESCRIPTION
@@ -85,7 +82,10 @@ extra exception managment such as destroying the wizard window and the like.
=cut
-sub new { bless {}, $_[0] }
+sub new {
+ my ($class, $o) = @_;
+ bless $o, $class;
+}
sub check_rpm {
@@ -109,7 +109,7 @@ my %default_callback = (changed => sub {}, focus_out => sub {}, complete => sub
sub process {
- my ($_w, $o, $in) = @_;
+ my ($o, $in) = @_;
local $::isWizard = 1;
local $::Wizard_title = $o->{name} || $::Wizard_title;
local $::Wizard_pix_up = $o->{defaultimage} || $::Wizard_pix_up;
@@ -193,8 +193,8 @@ sub process {
sub safe_process {
- my ($w, $wiz, $in) = @_;
- eval { $w->process($wiz, $in) };
+ my ($o, $in) = @_;
+ eval { $o->process($in) };
my $err = $@;
if ($err =~ /wizcancel/) {
$in->exit(0);
diff --git a/tools/draklive b/tools/draklive
index 61c25979e..680175af6 100755
--- a/tools/draklive
+++ b/tools/draklive
@@ -709,9 +709,8 @@ sub copy_wizard {
require interactive;
require wizards;
my $in = 'interactive'->vnew('su');
- my $w = wizards->new;
my ($storage, $device, $format);
- $w->process({
+ my $w = wizards->new({
name => N("Live system copy wizard"),
pages => {
welcome => {
@@ -758,8 +757,9 @@ sub copy_wizard {
},
end => 1,
},
- },
- }, $in);
+ }
+ });
+ $w->process($in);
}
sub complete_config {