summaryrefslogtreecommitdiffstats
path: root/perl-install/ChangeLog
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-08-07 01:00:02 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-08-07 01:00:02 +0000
commit20ca2c410a4092e407e36c15ad374e4fdc503e5d (patch)
tree7f878c32b1db5a6a1fb039cfc80708f09db28304 /perl-install/ChangeLog
parent9a080167487ad0d06d3e21ca71bc8d7bf5f9c895 (diff)
downloaddrakx-20ca2c410a4092e407e36c15ad374e4fdc503e5d.tar
drakx-20ca2c410a4092e407e36c15ad374e4fdc503e5d.tar.gz
drakx-20ca2c410a4092e407e36c15ad374e4fdc503e5d.tar.bz2
drakx-20ca2c410a4092e407e36c15ad374e4fdc503e5d.tar.xz
drakx-20ca2c410a4092e407e36c15ad374e4fdc503e5d.zip
*** empty log message ***
Diffstat (limited to 'perl-install/ChangeLog')
-rw-r--r--perl-install/ChangeLog74
1 files changed, 73 insertions, 1 deletions
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog
index 3af417a02..8592cd5fe 100644
--- a/perl-install/ChangeLog
+++ b/perl-install/ChangeLog
@@ -1,3 +1,75 @@
+2003/08/07 Pablo Saratxaga <pablo at mandrakesoft.com>
+
+ * share/po/sv.po, share/po/he.po: updated Hebrew and Swedish files
+
+2003/08/06 Arkadiusz Lipiec <alipiec at elka.pw.edu.pl>
+
+ * share/po/pl.po: Update (partially)
+
+2003/08/06 David Baudens <baudens at mandrakesoft.com>
+
+ * standalone/drakfloppy: Use capital letter when needed
+
+2003/08/06 Pablo Saratxaga <pablo at mandrakesoft.com>
+
+ * share/po/az.po: updated Azeri file
+
+2003/08/06 Pixel <pixel at mandrakesoft.com>
+
+ * any.pm: try to restore the MBR using "lilo -u" for users not liking the
+ default
+ bootloader automatic configuration (eg: bug #4415)
+
+ * services.pm: in drakxservices, display differently services handled by
+ xinetd (bug #4516)
+ create services_raw() which returns all the info out of "chkconfig
+ --list"
+ perl_checker compliance
+
+2003/08/05 François Pons <fpons at mandrakesoft.com>
+
+ * install2.pm: added discovery and download meta_class facility in VERSION
+ file.
+
+ * pkgs.pm: checking transaction allow ordering them ;-)
+ make default size of transaction to 13 (?) and avoid rpm ordering which
+ seems
+ nasty at present (missing configuration read ?).
+
+2003/08/05 Guillaume Cottenceau <gc at mandrakesoft.com>
+
+ * lang.pm: ghanese ppl don't talk french!?
+
+2003/08/05 Pablo Saratxaga <pablo at mandrakesoft.com>
+
+ * keyboard.pm: Turkish "F" keyboard was unavailable due to a typo
+
+ * share/po/sk.po, share/po/it.po: updated Italian file
+
+2003/08/05 Pixel <pixel at mandrakesoft.com>
+
+ * ugtk2.pm: do not invert Ok/Cancel for mdk 9.2 (per IHM team request)
+ remove stock icons (per IHM team request)
+
+ * any.pm: fix an old typo
+
+ * standalone/drakbackup, standalone/drakfloppy, standalone/logdrake,
+ diskdrake/hd_gtk.pm, standalone/harddrake2, standalone/drakgw,
+ standalone/drakperm, standalone/draksec,
+ Xconfig/resolution_and_depth.pm, standalone/mousedrake, Xconfig/main.pm,
+ interactive/gtk.pm, standalone/drakboot, standalone/net_monitor,
+ services.pm, standalone/drakbug, standalone/drakfont,
+ standalone/drakconnect: remove stock icons (per IHM team request)
+
+ * lang.pm:
+ - fix system_locales_to_ourlocale() returning { lang => 'zh' } for
+ $locale_lang == 'zn_CN.UTF8'
+ - in standard_locale, return zh_TW instead of zh_CN for lang=zh_TW
+ country=CN
+ - cleanup standard_locale
+
+ * install_any.pm: add flag UTF8 for rpmsrate
+
2003/08/05 François Pons <fpons at mandrakesoft.com>
* pkgs.pm: checking transaction allow ordering them ;-)
@@ -18349,7 +18421,7 @@
* Makefile.config: remove dir security
- * proxy.pm: add $Id: ChangeLog,v 1.815 2003/08/05 11:17:56 prigaux Exp $
+ * proxy.pm: add $Id: ChangeLog,v 1.816 2003/08/05 14:27:20 prigaux Exp $
* interactive/gtk.pm: use my_gtk {isWizard} and {isEmbedded} which are
more accurate than
6 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
#!/usr/bin/perl

# NetMonitor

# Copyright (C) 1999-2005 Mandriva
# Damien "Dam's" Krotkine
# Thierry Vignaud <tvignaud@mandriva.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

use lib qw(/usr/lib/libDrakX);

use strict;
use standalone;     #- warning, standalone must be loaded very first, for 'explanations'

use c;
use interactive;
use ugtk2 qw(:create :helpers :wrappers);
use common;
use network::network;
use network::tools;
use POSIX;

$ugtk2::wm_icon = "/usr/share/mcc/themes/default/net_monitor-mdk.png";

if ("@ARGV" =~ /--status/) { print network::tools::connected(); exit(0) }
my $force = "@ARGV" =~ /--force/;
my $quiet = "@ARGV" =~ /--quiet/;
my $connect = "@ARGV" =~ /--connect/;
my $disconnect = "@ARGV" =~ /--disconnect/;
my ($default_intf) = "@ARGV" =~ /--defaultintf (\w+)/;

my $net = {};
network::network::read_net_conf($net);
$default_intf ||= $net->{net_interface};

if ($force) {
    $connect and network::tools::start_interface($default_intf, 1);
    $disconnect and network::tools::stop_interface($default_intf, 1);
    $connect = $disconnect = 0;
}
$quiet and exit(0);


my $window1 = ugtk2->new(N("Network Monitoring"));
$window1->{window}->signal_connect(delete_event => \&main_quit);

unless ($::isEmbedded) {
    $window1->{window}->set_position('center');
    $window1->{window}->set_title(N("Network Monitoring"));
    $window1->{window}->set_border_width(5);
}
#$::isEmbedded or $window1->{window}->set_size_request(580, 320);

my $colorr = gtkcolor(50400, 655, 20000);
my $colort = gtkcolor(55400, 55400, 655);
my $colora = gtkcolor(655, 50400, 655);
my $isconnected = -1;
my @interfaces;
my $monitor = {};
my $c_time = 0;
my $ct_tag;

my ($pixmap, $darea, $gc_lines);
my ($width, $height) = (300, 150);

my $left_border = 50;
my $grid_interval = 30;
my $arrow_space = 6;
my $arrow_size = 5;

my $cfg_file = $< ? "$ENV{HOME}/.net_monitorrc" : "/etc/sysconfig/net_monitorrc";
my %config = getVarsFromSh($cfg_file);
my $use_same_scale = text2bool($config{use_same_scale});

gtkadd($window1->{window},
       gtkpack_(Gtk2::VBox->new(0,5),
                1, gtkpack_(Gtk2::HBox->new(0,5),
                            0, my $notebook = Gtk2::Notebook->new,
                            1, gtkpack_(Gtk2::VBox->new(0,5),
                                        0, gtkadd(gtkset_shadow_type(Gtk2::Frame->new(N("Settings")), 'etched_out'),
                                                  gtkpack__(gtkset_border_width(Gtk2::HBox->new(0,0),5),
                                                            N("Connection type: "), 
                                                            my $label_cnx_type = Gtk2::Label->new("")),
                                                 ),
                                        1, gtkadd(gtkset_shadow_type(Gtk2::Frame->new(N("Global statistics")), 'etched_out'),
                                                  gtkpack__(gtkset_border_width(Gtk2::VBox->new(0,0),5),
                                                            create_packtable({ col_spacings => 1, row_spacings => 5, homogeneous => 1 },
                                                                             [ Gtk2::Label->new(""), Gtk2::Label->new(N("Instantaneous")) , Gtk2::Label->new(N("Average")) ],
                                                                             [ Gtk2::WrappedLabel->new(N("Sending\nspeed:")),   my $label_st = Gtk2::Label->new(""), my $label_sta = Gtk2::Label->new(N("unknown")) ],
                                                                             [ Gtk2::WrappedLabel->new(N("Receiving\nspeed:")), my $label_sr = Gtk2::Label->new(""), my $label_sra = Gtk2::Label->new(N("unknown")) ],
                                                                            ),
                                                            Gtk2::HSeparator->new,
                                                            gtkpack__(gtkset_border_width(Gtk2::HBox->new(0,0),5),
                                                                      N("Connection\ntime: "), 
                                                                      my $label_ct = Gtk2::Label->new(N("unknown")),
                                                                     ),
                                                           )
                                                 ),
                                       )
                           ),
                0, gtksignal_connect(gtkset_active(Gtk2::CheckButton->new(N("Use same scale for received and transmitted")), $use_same_scale), clicked => sub { $use_same_scale = !$use_same_scale }),
                0, gtkpack(create_hbox('edge'),
                           gtksignal_connect(my $button_connect = gtkset_sensitive(Gtk2::Button->new(N("Wait please")), 0), clicked => \&connection),
                           gtksignal_connect(my $button_close = Gtk2::Button->new(N("Close")), clicked => \&main_quit),
                          ),
                0, my $statusbar = Gtk2::Statusbar->new
               ),
      );

$window1->{window}->show_all;
$window1->{window}->realize;

my $gct = Gtk2::Gdk::GC->new($window1->{window}->window);
$gct->set_foreground($colort);
my $gcr = Gtk2::Gdk::GC->new($window1->{window}->window);
$gcr->set_foreground($colorr);
my $gca = Gtk2::Gdk::GC->new($window1->{window}->window);
$gca->set_foreground($colora);

$statusbar->push(1, N("Wait please, testing your connection..."));
$window1->{window}->show_all;

Glib::Timeout->add(1000, \&rescan);
my $time_tag2 = Glib::Timeout->add(1000, \&update);

update();
rescan();

gtkflush() while $isconnected == -2 || $isconnected == -1;

Glib::Source->remove($time_tag2);
$time_tag2 = Glib::Timeout->add(5000, \&update);

connection() if $connect && !$isconnected || $disconnect && $isconnected;

my $tool_pid;

$SIG{CHLD} = sub {
    my $child_pid;
    do { 
        $child_pid = waitpid(-1, POSIX::WNOHANG);
        if ($tool_pid eq $child_pid) {
            undef $tool_pid;
            $button_close->set_sensitive(1);
        }
    } while $child_pid > 0;
};


$window1->main;
main_quit();

my $during_connection;
my $first;

sub main_quit() {
    $config{use_same_scale} = bool2yesno($use_same_scale);
    setVarsInSh($cfg_file, \%config);
    ugtk2->exit(0);
}

sub connection() {
    $during_connection = 1;
    my $wasconnected = $isconnected;

    $button_connect->set_sensitive(0);
    $button_close->set_sensitive(0);
    $statusbar->pop(1);
    $statusbar->push(1, $wasconnected ? N("Disconnecting from Internet ") : N("Connecting to Internet "));
    if ($wasconnected == 0) {
	$c_time = time();
	$ct_tag = Glib::Timeout->add(1000, sub {
				       my ($sec, $min, $hour) = gmtime(time() - $c_time);
				       my $e = sprintf("%02d:%02d:%02d", $hour, $min, $sec);
				       $label_ct->set_label($e); 1 });
    }
    my $nb_point = 1;
    $first = 1;

    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)));
				   $nb_point++;
				   if ($nb_point  < 4) { return 1 }
				   my $ret = 1;

				   my $isconnect = test_connected(0);

				   if ($nb_point < 20) {
                                       if ($first == 1)  { # first time
				           if ($isconnect == -2) { # wait for last test to finish
    				               test_connected(2); # not yet terminated, try to cancel it
				               return 1;
					   }
				           test_connected(1);  # initiates new connection test
				           $first = 0;
				           return 1;
				       }
				       if ($isconnect == -2) { return 1 } # no result yet, wait.
				       if ($isconnect == $wasconnected) {
				           # we got a test result; but the connection state did not change; retry.
                                           test_connected(1);
				           return 1;
				       }
				   }
                                   # either we got a result, or we timed out.
				   if ($isconnect != -2 || $nb_point > 20) {
				            $isconnected = $isconnect;
					    $ret = 0;
					    $statusbar->pop(1);
					    $statusbar->push(1, $wasconnected ? ($isconnected ?
									  N("Disconnection from Internet failed.") :
									  N("Disconnection from Internet complete.")) :
						     ($isconnected ?
						       N("Connection complete.") :
						       N("Connection failed.\nVerify your configuration in the Mandriva Linux Control Center."))
						    );
 				            # remove the connection time timer if connection is down or failed
 				            $isconnected or Glib::Source->remove($ct_tag);
				            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 {

						  $button_connect->set_sensitive(1);
				    		  $button_close->set_sensitive(1);
				    		  undef $during_connection;
						  update();
						  return 0;
                            });
                            }
                       return $ret;
                   });

    gtkflush();

    $tool_pid = 
      $wasconnected == 1 
	? network::tools::stop_interface($default_intf, 1)
        : network::tools::start_interface($default_intf, 1);
}

sub graph_window_width() { $width - $left_border }

sub rescan() {
    get_val();
    foreach (@interfaces) {
	my $intf = $_;
	my $recv = $monitor->{$intf}{val}[0];
	my $transmit = $monitor->{$intf}{val}[8];
	my $refr = $monitor->{$intf}{referencer};
	my $reft = $monitor->{$intf}{referencet};
	$monitor->{sr} += $recv - $refr;
	$monitor->{st} += $transmit - $reft;

	$monitor->{$intf}{recva} += $recv - $refr;
	$monitor->{$intf}{recvan}++;
	if ($monitor->{$intf}{recvan} > 9) {
	    push(@{$monitor->{$intf}{stack_ra}}, $monitor->{$intf}{recva}/10);
	    $monitor->{$intf}{recva} = $monitor->{$intf}{recvan} = 0;
	} else { push(@{$monitor->{$intf}{stack_ra}}, -1) }
	shift @{$monitor->{$intf}{stack_ra}} if @{$monitor->{$intf}{stack_ra}} > graph_window_width();

	push(@{$monitor->{$intf}{stack_r}}, $recv - $refr);
	shift @{$monitor->{$intf}{stack_r}} if @{$monitor->{$intf}{stack_r}} > graph_window_width();
	$monitor->{$intf}{labelr}->set_label(formatXiB($recv - $monitor->{$intf}{initialr}));
	$monitor->{$intf}{referencer} = $recv;

	$monitor->{$intf}{transmita} += $transmit - $reft;
	$monitor->{$intf}{transmitan}++;
	if ($monitor->{$intf}{transmitan} > 9) {
	    push(@{$monitor->{$intf}{stack_ta}}, $monitor->{$intf}{transmita}/10);
	    $monitor->{$intf}{transmita} = $monitor->{$intf}{transmitan} = 0;
	} else { push(@{$monitor->{$intf}{stack_ta}}, -1) }
	shift @{$monitor->{$intf}{stack_ta}} if @{$monitor->{$intf}{stack_ta}} > graph_window_width();

	push(@{$monitor->{$intf}{stack_t}}, $transmit - $reft);
	shift @{$monitor->{$intf}{stack_t}} if @{$monitor->{$intf}{stack_t}} > graph_window_width();
	$monitor->{$intf}{labelt}->set_label(formatXiB($transmit - $monitor->{$intf}{initialt}));
	$monitor->{$intf}{referencet} = $transmit;

	draw_monitor($monitor->{$intf}, $intf);
    }
    $label_sr->set_label(formatXiB($monitor->{sr}) . "/s");
    $label_st->set_label(formatXiB($monitor->{st}) . "/s");
    $monitor->{sra} += $monitor->{sr};
    $monitor->{sta} += $monitor->{st};
    $monitor->{nba}++;
    if ($monitor->{nba} > 9) {
	$label_sra->set_label(formatXiB($monitor->{sra}/10) . "/s");
	$label_sta->set_label(formatXiB($monitor->{sta}/10) . "/s");
	$monitor->{sra} = 0;
	$monitor->{sta} = 0;
	$monitor->{nba} = 0;
    }
    $label_cnx_type->set_label(translate($net->{type}));
    $monitor->{$_} = 0 foreach 'sr', 'st';
    1;
}

sub get_val() {
    my $a = cat_("/proc/net/dev");
    $a =~ s/^.*?\n.*?\n//;
    $a =~ s/^\s*lo:.*?\n//;
    my @line = split(/\n/, $a);
    require detect_devices;
    my @net_devices = detect_devices::get_net_interfaces();
    map {
	s/\s*(\w*)://;
	my $intf = $1;
        if (member($intf, @net_devices)) {
            $monitor->{$intf}{val} = [ split() ];
            $monitor->{$intf}{intf} = $intf;
            $intf;
        } else { () }
    } @line;
}

sub change_color {
    my ($color) = @_;
    my $dialog = _create_dialog(N("Color configuration"));
    $dialog->vbox->add(my $colorsel = Gtk2::ColorSelection->new);
    $colorsel->set_current_color($color);
    $dialog->add_button(N("Cancel"), 'cancel');
    $dialog->add_button(N("Ok"), 'ok');
    $dialog->show_all;
    if ($dialog->run eq 'ok') {
        $color = $colorsel->get_current_color;
    }
    $dialog->destroy;
    $color;
}

my ($scale_r, $scale_t);
$scale_r = $scale_t = $height;

sub scale_tranmistted($) { $_[0] * $scale_t }
sub scale_received($) { $_[0] * $scale_r }

sub update() {
    if (!$during_connection) {
        my $isconnect = test_connected(0);
        if ($isconnect != -2) {
	    $isconnected = $isconnect; # save current state
	    $isconnect = test_connected(1); # start new test
       }
    }

    my @intfs = get_val(); # get values from /proc file system
    foreach (@intfs) {
	my $intf = $_;
	if (!member($intf,@interfaces)) {
	    $default_intf ||= $intf;
	    $monitor->{$intf}{initialr} = $monitor->{$intf}{val}[0];
	    $monitor->{$intf}{initialt} = $monitor->{$intf}{val}[8];
	    $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->{$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),
										   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 {
													 $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 {
													 $colora = change_color($colora);
													 $gca->set_foreground($colora);
													 $_[0]->queue_draw;
												     }),
										   N("average"))
								     ),
							    0, gtkpack__(gtkset_border_width(Gtk2::VBox->new(0,0), 5),
							      gtkadd(gtkset_shadow_type(Gtk2::Frame->new(N("Local measure")), 'etched_out'),
								     gtkpack__(gtkset_border_width(Gtk2::VBox->new(0,0), 5),
									       gtkpack__(Gtk2::HBox->new(0,0),
											 N("sent: "),
											 my $measure_t = Gtk2::Label->new("0")
											),
									       gtkpack__(Gtk2::HBox->new(0,0),
											 N("received: "),
											 my $measure_r = Gtk2::Label->new("0")
											)
									      )
									)
									)
							  )
					       )),
				   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) }));
	    }
	    $monitor->{$intf}{page} = $notebook->page_num($page);
	    $darea->{$intf}->realize;
	    $pixmap->{$intf} = 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->{$intf}->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 $received    = $x >= 0 ? $monitor->{$intf}{stack_r}[$x] : 0;
                                    my $transmitted = $x >= 0 ? $monitor->{$intf}{stack_t}[$x] : 0;
                                    $measure_r->set_label(formatXiB($received));
                                    $measure_t->set_label(formatXiB($transmitted));
                                });
	    $darea->{$intf}->signal_connect(expose_event => sub {
                         $darea->{$intf}->window->draw_drawable($darea->{$intf}->style->bg_gc('normal'), $pixmap->{$intf}, 0, 0, 0, 0, $width, $height);
                     });
            $gc_lines->{$intf} = Gtk2::Gdk::GC->new($darea->{$intf}->window);
            $gc_lines->{$intf}->set_foreground($darea->{$intf}->style->white);
            $gc_lines->{$intf}->set_line_attributes(1, 'on-off-dash', 'not-last', 'round');

	}
    }
    foreach (@interfaces) {
	my $intf = $_;
     $notebook->remove_page($monitor->{$intf}{page}) unless member($intf,@intfs);
    }
    if (@intfs && !@interfaces) {
	#- select the default interface at start
	for (my $num_p = 0; $num_p < $notebook->get_n_pages; $num_p++) {
	    if ($notebook->get_tab_label_text($notebook->get_nth_page($num_p)) eq $default_intf) {
		$notebook->set_current_page($num_p);
		last;
	    }
	}
    }
    @interfaces = @intfs;
	if ($isconnected != -2 && $isconnected != -1 && !$during_connection) {
	    if ($isconnected == 1 && !in_ifconfig($net->{net_interface})) {
		$isconnected = 0;
		$statusbar->pop(1);
		$statusbar->push(1, N("Warning, another internet connection has been detected, maybe using your network"));
	    } else {
		#- translators : $net->{type} is the type of network connection (modem, adsl...)
		$statusbar->pop(1);
		$statusbar->push(1, $isconnected == 1 ? N("Connected") : N("Not connected"));
	    }
            $button_connect->set_sensitive(1);
            $button_connect->set("label", $isconnected == 1 ? N("Disconnect %s", translate($net->{type})) : N("Connect %s", $net->{type}));
	}
    unless ($default_intf || @interfaces) {
	$button_connect->set_sensitive(0);
	$button_connect->set("label", N("No internet connection configured"));
    }
    1;
}

sub in_ifconfig {
    my ($intf) = @_;
    -x '/sbin/ifconfig' or return 1;
    $intf eq '' and return 1;
    `/sbin/ifconfig` =~ /$intf/;
}

sub draw_monitor {
    my ($o, $intf) = @_;
    defined $darea->{$intf} or return;
    my $gcl = $gc_lines->{$intf};
    my $pixmap = $pixmap->{$intf};
    $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;
    foreach (@{$o->{stack_t}}) { $maxt = $_ if $_ > $maxt }

    my ($graph_maxr, $graph_maxt);
    if ($use_same_scale) {
        $graph_maxr = $graph_maxt = ($maxr + $maxt)/2;
    } else {
        $graph_maxr = $maxr;
        $graph_maxt = $maxt;
    }
    $scale_r = ($height/2) / max($graph_maxr, 1);
    $scale_t = ($height/2) / max($graph_maxt, 1);

    my $step = $left_border - 1;
    foreach (@{$o->{stack_t}}) {
	$pixmap->draw_rectangle($gct, 1, $step, 0, 1, scale_tranmistted($_));
	$step++;
    }
    $step = $left_border - 1;
    my ($av1, $av2, $last_a);
    foreach (@{$o->{stack_ta}}) {
	if ($_ != -1) {
	    if (!defined $av1) { $av1 = $_ } else { defined $av2 or $av2 = $_ }
	    if ($av1 && $av2) {
		$pixmap->draw_line($gca, $step-15, scale_tranmistted($av1), $step-5, scale_tranmistted($av2));
		$av1 = $av2;
		undef $av2;
		$last_a = $step - $left_border + 1;
	    }
	}
	$step++;
    }
    $step = $left_border - 1;
    foreach (@{$o->{stack_r}}) {
	$pixmap->draw_rectangle($gcr, 1, $step, $height-scale_received($_), 1, scale_received($_));
	$step++;
    }
    $step = $left_border - 1;
    $av1 = $av2 = undef;
    foreach (@{$o->{stack_ra}}) {
	if ($_ != -1) {
	    if (!defined $av1) { $av1 = $_ } else { defined $av2 or $av2 = $_ }
	    if (defined $av1 && defined $av2) {
		$pixmap->draw_line($gca, $step-15, $height-scale_received($av1), $step-5, $height-scale_received($av2));
		$av1 = $av2;
		undef $av2;
	    }
	}
	$step++;
    }

    my ($pix_maxr, $pix_maxt);
    if ($last_a) {
        $pix_maxr = $height - scale_received(@{$o->{stack_ra}}[$last_a]);
        $pix_maxt = scale_tranmistted(@{$o->{stack_ta}}[$last_a]);
    } else {
        $pix_maxr = $height - scale_received(@{$o->{stack_r}}[@{$o->{stack_r}}-1]);
        $pix_maxt = scale_tranmistted(@{$o->{stack_t}}[@{$o->{stack_t}}-1]);
    }

    my $x_l = $arrow_size + 1;
    my $y_l;

    #- "transmitted" arrow
    $y_l = max($arrow_space, min($pix_maxt, $pix_maxr - 2*$arrow_size - $arrow_space));
    $pixmap->draw_line($gct, $x_l, 0, $x_l, $y_l);
    $pixmap->draw_line($gct, $x_l-1, 0, $x_l-1, $y_l);
    $pixmap->draw_line($gct, $x_l+1, 0, $x_l+1, $y_l);
    $pixmap->draw_polygon($gct, 1, $x_l-$arrow_size, $y_l, $x_l+$arrow_size, $y_l, $x_l, $y_l+$arrow_size);

    #- "received" arrow
    $y_l = min($height - $arrow_space, max($pix_maxr, $y_l + 2*$arrow_size + $arrow_space));
    $pixmap->draw_line($gcr, $x_l, $height, $x_l, $y_l);
    $pixmap->draw_line($gcr, $x_l-1, $height, $x_l-1, $y_l);
    $pixmap->draw_line($gcr, $x_l+1, $height, $x_l+1, $y_l);
    $pixmap->draw_polygon($gcr, 1, $x_l-$arrow_size, $y_l, $x_l+$arrow_size, $y_l, $x_l, $y_l-$arrow_size);

    for (my $i = $grid_interval; $i <= $height - $grid_interval; $i += $grid_interval) {
	$pixmap->draw_line($gcl, $left_border, $i, $width, $i);
	my ($gc2, $text);
        if ($i > max($grid_interval, $use_same_scale ? $pix_maxt : $height/2)) {
	    $text = formatXiB(($height-$i)/$scale_r);
	    $gc2 = $gcr;
        } else {
	    $text = formatXiB($i/$scale_t);
	    $gc2 = $gct;
        }
        $pixmap->draw_layout($gc2, 45-string_width($darea->{$intf}, $text), $i-5, $darea->{$intf}->create_pango_layout($text));
    }
    $darea->{$intf}->queue_draw;
}


sub test_connected {
    my ($arg) = @_;
    $::testing || network::tools::test_connected($arg);
}