summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/net_monitor
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/net_monitor')
-rwxr-xr-xperl-install/standalone/net_monitor39
1 files changed, 37 insertions, 2 deletions
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor
index 02c400211..4de1bb5d5 100755
--- a/perl-install/standalone/net_monitor
+++ b/perl-install/standalone/net_monitor
@@ -27,6 +27,7 @@ use my_gtk qw(:helpers :wrappers);
use common;
use strict;
use network::netconnect;
+use globals "network", qw($in $prefix $connect_file $disconnect_file $connect_prog);
my ($connect, $default_intf);
init Gtk;
@@ -47,13 +48,37 @@ my $colort = my_gtk::gtkcolor(55400, 65400, 655);
my $isconnected=0;
my @interfaces;
my $monitor = {};
+my $netcnx = {};
+my $netc = {};
+my $intf = {};
+network::netconnect::load_conf($netcnx, $netc, $intf);
+network::netconnect::read_net_conf('', $netcnx, $netc);
+my $combo1 = new Gtk::Combo;
+$combo1->set_popdown_strings (network::netconnect::get_profiles() );
+$combo1->entry->set_text($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default");
+$combo1->entry->set_editable(0);
+globals::init(
+ in => $in,
+ prefix => '',
+ connect_file => "/etc/sysconfig/network-scripts/net_cnx_up",
+ disconnect_file => "/etc/sysconfig/network-scripts/net_cnx_down",
+ connect_prog => "/etc/sysconfig/network-scripts/net_cnx_pg" );
+
gtkadd($window1,
gtkpack_(new Gtk::VBox(0,5),
0, _("Network Monitoring"),
1, gtkpack_(new Gtk::HBox(0,5),
1, my $notebook = new Gtk::Notebook,
0, gtkpack_(new Gtk::VBox(0,5),
- 1, gtkadd(gtkset_shadow_type(new Gtk::Frame(_("Statistics")), 'etched_out'),
+ 1, gtkadd(gtkset_shadow_type(new Gtk::Frame(_("Settings")), 'etched_out'),
+ gtkpack__(gtkset_border_width(new Gtk::VBox(0,5),5),
+ gtkpack__(new Gtk::HBox(0,0),
+ _("Connection type: "), my $label_cnx_type = new Gtk::Label("")),
+ gtkpack__(new Gtk::HBox(0,0),
+ _("Profile: "), $combo1)
+ )
+ ),
+ 0, gtkadd(gtkset_shadow_type(new Gtk::Frame(_("Statistics")), 'etched_out'),
gtkpack__(gtkset_border_width(new Gtk::VBox(0,5),5),
gtkpack__(new Gtk::HBox(0,0),
_("Sending Speed: "), my $label_st = new Gtk::Label("")),
@@ -70,6 +95,12 @@ gtkadd($window1,
)
);
$window1->realize;
+$combo1->entry->signal_connect( 'changed', sub {
+ network::netconnect::set_profile($netcnx, $combo1->entry->get_text());
+ network::netconnect::load_conf($netcnx, $netc, $intf);
+ network::netconnect::set_net_conf($netcnx, $netc, $intf);
+ network::netconnect::read_net_conf('', $netcnx, $netc);
+ });
my $gct = new Gtk::Gdk::GC($window1->window);
$gct->set_foreground($colort);
my $gcr = new Gtk::Gdk::GC($window1->window);
@@ -127,7 +158,7 @@ sub connection {
0;
});
Gtk->main_iteration while Gtk->events_pending;
- my $tag2 = Gtk->timeout_add(1000, sub { system( $isconnected2 ? "/etc/sysconfig/network-scripts/net_cnx_down &" : "/etc/sysconfig/network-scripts/net_cnx_up &"); 0; });
+ $tag2 = Gtk->timeout_add(1000, sub { system( $isconnected2 ? "/etc/sysconfig/network-scripts/net_cnx_down &" : "/etc/sysconfig/network-scripts/net_cnx_up &"); 0; });
}
sub rescan {
@@ -152,6 +183,7 @@ sub rescan {
}
$label_sr->set(formatXiB($monitor->{sr}) . "/s");
$label_st->set(formatXiB($monitor->{st}) . "/s");
+ $label_cnx_type->set($netcnx->{type});
$monitor->{$_} = 0 foreach ('sr', 'st');
1;
}
@@ -174,6 +206,9 @@ sub get_val {
sub update {
my @intfs = get_val();
+ if($combo1->entry->get_text ne ($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default")) {
+ $combo1->entry->set_text($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default");
+ }
foreach(@intfs) {
my $intf = $_;
if(!member($intf,@interfaces)) {