summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-10-17 17:03:23 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-10-17 17:03:23 +0000
commitb725c34c44a2a1f5092d67231ca3bc720bd03ce2 (patch)
treea8113e713e9a69a132eed999864c1480f4ab7447 /perl-install/standalone
parent4ed2d1a518e742953b7b757e3d410d86e5cf8586 (diff)
downloaddrakx-b725c34c44a2a1f5092d67231ca3bc720bd03ce2.tar
drakx-b725c34c44a2a1f5092d67231ca3bc720bd03ce2.tar.gz
drakx-b725c34c44a2a1f5092d67231ca3bc720bd03ce2.tar.bz2
drakx-b725c34c44a2a1f5092d67231ca3bc720bd03ce2.tar.xz
drakx-b725c34c44a2a1f5092d67231ca3bc720bd03ce2.zip
- perl_checker cleanups
- this enable to catch two bugs: o test_connected function was wrong and did not pass its parameter to network code code o profile managment in net_monitor wasn't updated to latest damien api changes in network::netconnect and thus was broken :-(
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/net_monitor49
1 files changed, 24 insertions, 25 deletions
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor
index 68ca5a9a2..98821ff84 100755
--- a/perl-install/standalone/net_monitor
+++ b/perl-install/standalone/net_monitor
@@ -113,7 +113,7 @@ gtkadd($window1->{window},
)
),
0, gtkpack_(Gtk2::HBox->new(0,5),
- 1, gtksignal_connect(my $button_connect = gtkset_sensitive(Gtk2::Button->new(), 0), clicked => \&connection),
+ 1, gtksignal_connect(my $button_connect = gtkset_sensitive(Gtk2::Button->new, 0), clicked => \&connection),
0, Gtk2::VSeparator->new,
0, gtkpack(Gtk2::VBox->new(0,5),
gtksignal_connect(Gtk2::Button->new(N("Logs")), clicked => sub {
@@ -132,7 +132,8 @@ gtkadd($window1->{window},
$window1->{rwindow}->show_all;
$window1->{rwindow}->realize;
$combo1->entry->signal_connect(changed => sub {
- network::netconnect::set_profile($netcnx, $combo1->entry->get_text);
+ $netcnx->{PROFILE} = $combo1->entry->get_text;
+ network::netconnect::set_profile($netcnx);
network::netconnect::load_conf($netcnx, $netc, $intf);
network::netconnect::read_net_conf('', $netcnx, $netc);
});
@@ -169,7 +170,7 @@ ugtk2->exit(0);
my $during_connection;
my $first;
-sub connection {
+sub connection() {
$during_connection = 1;
my $wasconnected = $isconnected;
@@ -187,7 +188,7 @@ sub connection {
my $nb_point = 1;
$first = 1;
- my $tag = Glib::Timeout->add(1000, sub {
+ my $_tag = Glib::Timeout->add(1000, sub {
$statusbar->pop(1);
$statusbar->push(1, ($wasconnected == 1 ? N("Disconnecting from Internet ") : N("Connecting to Internet "))
. join('', map { "." } (1..$nb_point)));
@@ -229,18 +230,18 @@ sub connection {
my $delay = 1000;
# keep the message displayed longer if there is a problem.
if ($isconnected == $wasconnected) { $delay = 5000 }
- my $tag3 = Glib::Timeout->add($delay, sub {
+ my $_tag3 = Glib::Timeout->add($delay, sub {
$button_connect->set_sensitive(1);
$button_close->set_sensitive(1);
undef $during_connection;
update();
return 0;
- });
- } # END IF
- return $ret });
+ });
+ }
+ return $ret;
+ });
- my $netc = {};
gtkflush();
if ($wasconnected == 1) {
@@ -250,7 +251,7 @@ sub connection {
}
}
-sub rescan {
+sub rescan() {
get_val();
foreach (@interfaces) {
my $intf = $_;
@@ -306,20 +307,18 @@ sub rescan {
1;
}
-sub get_val {
- my @ret;
+sub get_val() {
my $a = cat_("/proc/net/dev");
$a =~ s/^.*?\n.*?\n//;
$a =~ s/^\s*lo:.*?\n//;
my @line = split(/\n/, $a);
- foreach (@line) {
+ map {
s/\s*(\w*)://;
my $intf = $1;
- push @ret, $intf;
$monitor->{$intf}{val} = [split()];
$monitor->{$intf}{intf} = $intf;
- }
- @ret;
+ $intf;
+ } @line;
}
sub change_color {
@@ -343,7 +342,7 @@ sub change_color {
}
my $scale;
-sub update {
+sub update() {
if (!$during_connection) {
my $isconnect = test_connected(0);
if ($isconnect != -2) {
@@ -362,7 +361,7 @@ sub update {
$default_intf = $intf;
$monitor->{$intf}{initialr} = $monitor->{$intf}{val}[0];
$monitor->{$intf}{initialt} = $monitor->{$intf}{val}[8];
- $darea = Gtk2::DrawingArea->new();
+ $darea = Gtk2::DrawingArea->new;
$darea->set_events(["pointer_motion_mask"]);
$notebook->append_page(gtkshow(my $page = gtkpack_(Gtk2::VBox->new(0,0),
0, gtkpack__(gtkset_border_width(Gtk2::HBox->new(0,0), 5),
@@ -370,21 +369,21 @@ sub update {
0, gtkpack_(Gtk2::HBox->new(0,0),
1, gtkpack__(Gtk2::VBox->new(0,0),
gtkpack__(gtkset_border_width(Gtk2::HBox->new(0,5), 5),
- gtksignal_connect(my $button_t = gtkset_relief(Gtk2::Button->new(), 'none'), clicked => sub {
+ gtksignal_connect(my $button_t = gtkset_relief(Gtk2::Button->new, 'none'), clicked => sub {
$colort = change_color($colort);
$gct->set_foreground($colort);
$_[0]->queue_draw;
}),
N("sent: "), $monitor->{$intf}{labelt} = Gtk2::Label->new("0")),
gtkpack__(gtkset_border_width(Gtk2::HBox->new(0,5), 5),
- gtksignal_connect(my $button_r = gtkset_relief(Gtk2::Button->new(), 'none'), clicked => sub {
+ gtksignal_connect(my $button_r = gtkset_relief(Gtk2::Button->new, 'none'), clicked => sub {
$colorr = change_color($colorr);
$gcr->set_foreground($colorr);
$_[0]->queue_draw;
}),
N("received: "), $monitor->{$intf}{labelr} = Gtk2::Label->new("0")),
gtkpack__(gtkset_border_width(Gtk2::HBox->new(0,5), 5),
- gtksignal_connect(my $button_a = gtkset_relief(Gtk2::Button->new(), 'none'), clicked => sub {
+ gtksignal_connect(my $button_a = gtkset_relief(Gtk2::Button->new, 'none'), clicked => sub {
$colora = change_color($colora);
$gca->set_foreground($colora);
$_[0]->queue_draw;
@@ -409,7 +408,7 @@ sub update {
)),
Gtk2::Label->new($intf));
foreach my $i ([$button_t, $gct], [$button_r, $gcr], [$button_a, $gca]) {
- $i->[0]->add(gtksignal_connect(gtkshow(gtksize(gtkset_size_request(Gtk2::DrawingArea->new(), 10, 10), 10, 10)), expose_event => sub { $_[0]->window->draw_rectangle($i->[1], 1, 0, 0, 10, 10) }));
+ $i->[0]->add(gtksignal_connect(gtkshow(gtksize(gtkset_size_request(Gtk2::DrawingArea->new, 10, 10), 10, 10)), expose_event => sub { $_[0]->window->draw_rectangle($i->[1], 1, 0, 0, 10, 10) }));
}
$notebook->set_current_page($notebook->page_num($page));
$monitor->{$intf}{page} = $notebook->page_num($page);
@@ -419,7 +418,7 @@ sub update {
$monitor->{$intf}{referencet} = $monitor->{$intf}{val}[8];
$pixmap->draw_rectangle($darea->style->black_gc, 1, 0, 0, $width, $height);
$darea->signal_connect(motion_notify_event => sub {
- my ($w, $e) = @_;
+ my (undef, $e) = @_;
my $x = $e->x - 50;
my $y = $e->y;
my $received = $x >= 0 ? $monitor->{$intf}{stack_r}[$x] : 0;
@@ -440,7 +439,6 @@ sub update {
$notebook->remove_page($monitor->{$intf}{page}) unless member($intf,@intfs);
}
@interfaces = @intfs;
- my $netc = {};
if ($isconnected != -2 && $isconnected != -1 && !$during_connection) {
if ($isconnected == 1 && !in_ifconfig($netcnx->{NET_INTERFACE})) {
$isconnected = 0;
@@ -561,5 +559,6 @@ sub draw_monitor {
sub test_connected {
- $::testing || network::tools::test_connected;
+ my ($arg) = @_;
+ $::testing || network::tools::test_connected($arg);
}