summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/net_monitor
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-10-19 08:24:48 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-10-19 08:24:48 +0000
commit88def3bb966603ed5b91c2d7f1794bd1f769ab3c (patch)
tree21959fe0797b8a88039aaef26a0d3dcf241a8311 /perl-install/standalone/net_monitor
parentb641341ac89ed27cf57ac07c48574f0ad4a28968 (diff)
downloaddrakx-backup-do-not-use-88def3bb966603ed5b91c2d7f1794bd1f769ab3c.tar
drakx-backup-do-not-use-88def3bb966603ed5b91c2d7f1794bd1f769ab3c.tar.gz
drakx-backup-do-not-use-88def3bb966603ed5b91c2d7f1794bd1f769ab3c.tar.bz2
drakx-backup-do-not-use-88def3bb966603ed5b91c2d7f1794bd1f769ab3c.tar.xz
drakx-backup-do-not-use-88def3bb966603ed5b91c2d7f1794bd1f769ab3c.zip
fix typo
Diffstat (limited to 'perl-install/standalone/net_monitor')
-rwxr-xr-xperl-install/standalone/net_monitor143
1 files changed, 75 insertions, 68 deletions
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor
index b4e8afeb6..0f30c91a5 100755
--- a/perl-install/standalone/net_monitor
+++ b/perl-install/standalone/net_monitor
@@ -92,38 +92,45 @@ my $use_same_scale = text2bool($config{use_same_scale});
MDK::Common::Globals::init(in => $in);
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),
+ gtknew('VBox', spacing => 5, children => [
+ 1, gtknew('HBox', spacing => 5, children => [
+ 0, my $notebook = gtknew('Notebook'),
+ 1, gtknew('VBox', spacing => 5, children => [
+ 0, gtknew('Frame', text => N("Settings"), shadow_type => 'etched_out', child =>
+ gtknew('HBox', border_width => 5, children_tight => [
N("Connection type: "),
- my $label_cnx_type = Gtk2::Label->new("")),
+ my $label_cnx_type = gtknew('Label', text => ""),
+ ]),
),
- 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),
+ 1, gtknew('Frame', text => N("Global statistics"), shadow_type => 'etched_out', child =>
+ gtknew('VBox', border_width => 5, children_tight => [
+ gtknew('Table', col_spacings => 1, row_spacings => 5, homogeneous => 1, children => [
+ [ gtknew('Label', text => ""),
+ gtknew('Label', text => N("Instantaneous")) ,
+ gtknew('Label', text => N("Average")) ],
+ [ gtknew('WrappedLabel', text => N("Sending\nspeed:")),
+ my $label_st = gtknew('Label', text => ""),
+ my $label_sta = gtknew('Label', text => N("unknown")) ],
+ [ gtknew('WrappedLabel', text => N("Receiving\nspeed:")),
+ my $label_sr = gtknew('Label', text => ""),
+ my $label_sra = gtknew('Label', text => N("unknown")) ],
+ ]),
+ gtknew('HSeparator'),
+ gtknew('HBox', border_width => 5, children_tight => [
N("Connection\ntime: "),
- my $label_ct = Gtk2::Label->new(N("unknown")),
- ),
- )
+ my $label_ct = gtknew('Label', text => 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, gtknew('CheckButton', text => N("Use same scale for received and transmitted"), val => \$use_same_scale),
+ 0, gtknew('HButtonBox', layout => 'edge', children_loose => [
+ my $button_connect = gtknew('Button', text => N("Wait please"), sensitive => 0, clicked => \&connection),
+ my $button_close = gtknew('Button', text => N("Close"), clicked => \&main_quit),
+ ]),
0, my $statusbar = Gtk2::Statusbar->new
- ),
+ ]),
);
$window1->{rwindow}->show_all;
@@ -191,7 +198,7 @@ sub connection() {
$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 })
+ gtkset($label_ct, text => $e); 1 })
}
my $nb_point = 1;
$first = 1;
@@ -256,7 +263,7 @@ sub connection() {
$tool_pid =
$wasconnected == 1
- ? network::tools::stop_interface($default_intf);
+ ? network::tools::stop_interface($default_intf)
: network::tools::start_interface($default_intf);
}
@@ -283,7 +290,7 @@ sub rescan() {
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}));
+ gtkset($monitor->{$intf}{labelr}, text => formatXiB($recv - $monitor->{$intf}{initialr}));
$monitor->{$intf}{referencer} = $recv;
$monitor->{$intf}{transmita} += $transmit - $reft;
@@ -296,24 +303,24 @@ sub rescan() {
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}));
+ gtkset($monitor->{$intf}{labelt}, text => 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");
+ gtkset($label_sr, text => formatXiB($monitor->{sr}) . "/s");
+ gtkset($label_st, text => 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");
+ gtkset($label_sra, text => formatXiB($monitor->{sra}/10) . "/s");
+ gtkset($label_sta, text => formatXiB($monitor->{sta}/10) . "/s");
$monitor->{sra} = 0;
$monitor->{sta} = 0;
$monitor->{nba} = 0;
}
- $label_cnx_type->set_label(translate($netcnx->{type}));
+ gtkset($label_cnx_type, text => translate($netcnx->{type}));
$monitor->{$_} = 0 foreach 'sr', 'st';
1;
}
@@ -374,52 +381,52 @@ sub update() {
$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 {
+ $notebook->append_page(gtkshow(my $page = gtknew('VBox', children => [
+ 0, gtknew('HBox', border_width => 5, children_tight => [
+ gtkset($darea->{$intf}, width => $width, height => $height) ]),
+ 0, gtknew('HBox', children => [
+ 1, gtknew('VBox', children_tight => [
+ gtknew('HBox', spacing => 5, border_width => 5, children_tight => [
+ my $button_t = gtknew('Button', relief => '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 {
+ N("sent: "), $monitor->{$intf}{labelt} = gtknew('Label', text => "0") ]),
+ gtknew('HBox', spacing => 5, border_width => 5, children_tight => [
+ my $button_r = gtknew('Button', relief => '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 {
+ N("received: "), $monitor->{$intf}{labelr} = gtknew('Label', text => "0") ]),
+ gtknew('HBox', spacing => 5, border_width => 5, children_tight => [
+ my $button_a = gtknew('Button', relief => '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("average") ])
+ ]),
+ 0, gtknew('VBox', border_width => 5, children_tight => [
+ gtknew('Frame', text => N("Local measure"), shadow_type => 'etched_out', child =>
+ gtknew('VBox', border_width => 5, children_tight => [
+ gtknew('HBox', children_tight => [
N("sent: "),
- my $measure_t = Gtk2::Label->new("0")
- ),
- gtkpack__(Gtk2::HBox->new(0,0),
+ my $measure_t = gtknew('Label', text => "0")
+ ]),
+ gtknew('HBox', children_tight => [
N("received: "),
- my $measure_r = Gtk2::Label->new("0")
- )
- )
+ my $measure_r = gtknew('Label', text => "0")
+ ])
+ ])
)
- )
- )
- )),
- Gtk2::Label->new($intf));
+ ])
+ ])
+ ])),
+ gtknew('Label', text => $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)),
+ $i->[0]->add(gtksignal_connect(gtkshow(gtkset(Gtk2::DrawingArea->new, width => 10, height => 10)),
expose_event => sub { $_[0]->window->draw_rectangle($i->[1], 1, 0, 0, 10, 10) }));
}
$monitor->{$intf}{page} = $notebook->page_num($page);
@@ -433,8 +440,8 @@ sub update() {
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));
+ gtkset($measure_r, text => formatXiB($received));
+ gtkset($measure_t, text => 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);