summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2009-09-15 17:07:05 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2009-09-15 17:07:05 +0000
commit4c94cefb03bbbb2c20898cade8284f809b0842f7 (patch)
tree05debd9cc419f60c4aed020266549dda27ddb5a2 /bin
parentabe3b849ca87b4b8e57604db466f0ef6ffcc3442 (diff)
downloaddrakx-net-4c94cefb03bbbb2c20898cade8284f809b0842f7.tar
drakx-net-4c94cefb03bbbb2c20898cade8284f809b0842f7.tar.gz
drakx-net-4c94cefb03bbbb2c20898cade8284f809b0842f7.tar.bz2
drakx-net-4c94cefb03bbbb2c20898cade8284f809b0842f7.tar.xz
drakx-net-4c94cefb03bbbb2c20898cade8284f809b0842f7.zip
Update net_applet icon when a connection is in progress (#50741)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/net_applet23
1 files changed, 19 insertions, 4 deletions
diff --git a/bin/net_applet b/bin/net_applet
index 31ba331..40f6d80 100755
--- a/bin/net_applet
+++ b/bin/net_applet
@@ -46,7 +46,7 @@ our %pixbufs =
(
firewall => gtknew('Pixbuf', file => 'drakfirewall'),
firewall_icon => gtknew('Pixbuf', file => 'drakfirewall')->scale_simple(24, 24, 'hyper'),
- state => { map { $_ => gtknew('Pixbuf', file => $_) } qw(connected disconnected unconfigured) },
+ state => { map { $_ => gtknew('Pixbuf', file => $_) } qw(connected disconnected unconfigured connecting) },
link_level => { map {
$_ => gtknew('Pixbuf', file => 'wifi-' . sprintf('%03d', $_))->scale_simple(24, 24, 'hyper');
} qw(20 40 60 80 100) },
@@ -99,9 +99,11 @@ sub get_state_message {
($network && "\n\n" . N("Connected to %s (link level: %d %%)", $network->{name}, $network->{signal_strength}))
: $current_state eq 'disconnected' ?
N("Network is down on interface %s.", get_interface_name($interface))
- :
+ : $current_state eq 'unconfigured' ?
N("You do not have any configured Internet connection.
Run the \"%s\" assistant from the Mandriva Linux Control Center", N("Set up a new network interface (LAN, ISDN, ADSL, ...)"))
+ :
+ N("Connecting..")
);
}
@@ -251,6 +253,18 @@ sub is_running {
$ppid != 1 && $pid != $$ && $n eq $name;
} `ps -o '%P %p %c' -u $user`;
}
+
+sub is_running_match {
+ # (eugeni) this matches part of a running command.
+ # Right now it is only used to detect if ifup script is running.
+ my ($name, $o_user) = @_;
+ my $user = $o_user || $ENV{USER};
+ any {
+ my ($ppid, $pid, $n) = /^\s*(\d+)\s+(\d+)\s+(.*)/;
+ $ppid != 1 && $pid != $$ && $n =~ $name;
+ } `ps -o '%P %p %c' -u $user`;
+}
+
sub shouldStart() {
my ($opt) = @ARGV;
if ($opt eq '--force' || $opt eq '-f') {
@@ -333,7 +347,8 @@ sub checkNetwork() {
my ($gw_intf, $_is_up, $gw_address) = $watched_interface ?
($watched_interface, network::tools::get_interface_status($watched_interface)) :
network::tools::get_default_connection($net);
- go2State($gw_address ? 'connected' : $gw_intf ? 'disconnected' : 'unconfigured', $gw_intf);
+ my $connecting = is_running_match('ifup', 'root');
+ go2State($gw_address ? 'connected' : $connecting ? 'connecting' : $gw_intf ? 'disconnected' : 'unconfigured', $gw_intf);
}
sub checkNetworkForce() {
$net = {};
@@ -366,7 +381,7 @@ sub go2State {
$need_update = 1;
}
if ($current_state ne $state_type) {
- my $show = defined $current_state; # don't show notification at applet startup
+ my $show = defined $current_state && $state_type ne 'connecting'; # don't show notification at applet startup and when establishing a connection
$current_state = $state_type;
$notification_queue->add({
title => $old_description || $current_description || N("Network connection"),