diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-11-04 15:56:27 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-11-04 15:56:27 +0000 |
commit | 674723913a0359ac1be37487b3d3cceffb3cb24c (patch) | |
tree | 7f91c7e45911de6aa31ccd6208f4af2ac490805d /perl-install/standalone | |
parent | b45cc8868229f2e1236beab2110ae975de472bf7 (diff) | |
download | drakx-674723913a0359ac1be37487b3d3cceffb3cb24c.tar drakx-674723913a0359ac1be37487b3d3cceffb3cb24c.tar.gz drakx-674723913a0359ac1be37487b3d3cceffb3cb24c.tar.bz2 drakx-674723913a0359ac1be37487b3d3cceffb3cb24c.tar.xz drakx-674723913a0359ac1be37487b3d3cceffb3cb24c.zip |
manage all interfaces when there more than one
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-x | perl-install/standalone/net_monitor | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor index 979f59132..b7fb30680 100755 --- a/perl-install/standalone/net_monitor +++ b/perl-install/standalone/net_monitor @@ -288,7 +288,7 @@ sub rescan() { $monitor->{$intf}{labelt}->set_label(formatXiB($transmit - $monitor->{$intf}{initialt})); $monitor->{$intf}{referencet} = $transmit; - draw_monitor($monitor->{$intf}); + draw_monitor($monitor->{$intf}, $intf); } $label_sr->set_label(formatXiB($monitor->{sr}) . "/s"); $label_st->set_label(formatXiB($monitor->{st}) . "/s"); @@ -361,11 +361,11 @@ sub update() { $default_intf = $intf; $monitor->{$intf}{initialr} = $monitor->{$intf}{val}[0]; $monitor->{$intf}{initialt} = $monitor->{$intf}{val}[8]; - $darea = Gtk2::DrawingArea->new; - $darea->set_events(["pointer_motion_mask"]); + $darea->{$intf} = Gtk2::DrawingArea->new; + $darea->{$intf}->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), - gtksize($darea, $width, $height)), + gtksize($darea->{$intf}, $width, $height)), 0, gtkpack_(Gtk2::HBox->new(0,0), 1, gtkpack__(Gtk2::VBox->new(0,0), gtkpack__(gtkset_border_width(Gtk2::HBox->new(0,5), 5), @@ -412,12 +412,12 @@ sub update() { } $notebook->set_current_page($notebook->page_num($page)); $monitor->{$intf}{page} = $notebook->page_num($page); - $darea->realize; - $pixmap = Gtk2::Gdk::Pixmap->new($darea->window, $width, $height, $darea->window->get_depth); + $darea->{$intf}->realize; + $pixmap = Gtk2::Gdk::Pixmap->new($darea->{$intf}->window, $width, $height, $darea->{$intf}->window->get_depth); $monitor->{$intf}{referencer} = $monitor->{$intf}{val}[0]; $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 { + $pixmap->draw_rectangle($darea->{$intf}->style->black_gc, 1, 0, 0, $width, $height); + $darea->{$intf}->signal_connect(motion_notify_event => sub { my (undef, $e) = @_; my $x = $e->x - 50; my $y = $e->y; @@ -429,8 +429,8 @@ sub update() { $measure_r->set_label(formatXiB($received)); $measure_t->set_label(formatXiB($transmitted)); }); - $darea->signal_connect(expose_event => sub { - $darea->window->draw_drawable($darea->style->bg_gc('normal'), $pixmap, 0, 0, 0, 0, $width, $height); + $darea->{$intf}->signal_connect(expose_event => sub { + $darea->{$intf}->window->draw_drawable($darea->{$intf}->style->bg_gc('normal'), $pixmap, 0, 0, 0, 0, $width, $height); }); } } @@ -468,9 +468,9 @@ sub in_ifconfig { } sub draw_monitor { - my ($o) = @_; - defined $darea or return; - $pixmap->draw_rectangle($darea->style->black_gc, 1, 0, 0, $width, $height); + my ($o, $intf) = @_; + defined $darea->{$intf} or return; + $pixmap->draw_rectangle($darea->{$intf}->style->black_gc, 1, 0, 0, $width, $height); my $maxr = 0; foreach (@{$o->{stack_r}}) { $maxr = $_ if $_ > $maxr } my $maxt = 0; @@ -517,8 +517,8 @@ sub draw_monitor { } my $switch = 1; - my $gcl = Gtk2::Gdk::GC->new($darea->window); - $gcl->set_foreground($darea->style->white); + my $gcl = Gtk2::Gdk::GC->new($darea->{$intf}->window); + $gcl->set_foreground($darea->{$intf}->style->white); $gcl->set_line_attributes(1, 'on-off-dash', 'not-last', 'round'); for (my $i = 30; $i <= 120; $i += 30) { $pixmap->draw_line($gcl, 50, $i, 300, $i); @@ -552,9 +552,9 @@ sub draw_monitor { $text = formatXiB($i*$ech/150); $gc2 = $gct; } - $pixmap->draw_layout($gc2, 45-string_width($darea, $text), $i-5, $darea->create_pango_layout($text)); + $pixmap->draw_layout($gc2, 45-string_width($darea->{$intf}, $text), $i-5, $darea->{$intf}->create_pango_layout($text)); } - $darea->queue_draw; + $darea->{$intf}->queue_draw; } |