summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmdkapplet51
1 files changed, 40 insertions, 11 deletions
diff --git a/mdkapplet b/mdkapplet
index d17225ea..bc8371b4 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -80,7 +80,7 @@ mkdir_p($localdir) if !-d $localdir;
my %state = (
delayed => {
colour => [ 'busy' ],
- changes => [ 'busy', 'critical' ],
+ changes => [ 'busy', 'critical', 'disconnected' ],
menu => [ 'check' ],
do_not_use_bubble => 1,
tt => [
@@ -91,19 +91,19 @@ my %state = (
okay => {
colour => [ 'okay' ],
- changes => [ 'busy', 'critical' ],
+ changes => [ 'busy', 'critical', 'disconnected' ],
menu => [ 'check' ],
tt => [ N_("Your system is up-to-date") ]
},
critical => {
colour => [ 'noconf' ],
- changes => [ 'okay', 'busy', 'critical' ],
+ changes => [ 'okay', 'busy', 'critical', 'disconnected' ],
menu => [ 'check' ],
tt => [ N_("Service configuration problem. Please check logs and send mail to support\@mandrivaonline.com") ]
},
busy => {
colour => [ 'busy' ],
- changes => [ 'okay', 'critical', 'error' ],
+ changes => [ 'okay', 'critical', 'error', 'disconnected' ],
menu => [],
do_not_use_bubble => 1,
tt => [ N_("Please wait, finding available packages...") ]
@@ -120,6 +120,12 @@ my %state = (
menu => [ 'update', 'check' ],
tt => [ N_("New bundles are available for your system") ]
},
+ disconnected => {
+ colour => [ 'disconnect' ],
+ changes => [ 'okay', 'busy', 'critical', 'error' ],
+ menu => [ 'confNetwork' ],
+ tt => [ N_("Network is down. Please configure your network") ]
+ },
disabled => {
colour => [ 'disabled' ],
changes => [ 'okay', 'busy', 'critical', 'error' ],
@@ -128,7 +134,7 @@ my %state = (
},
locked => {
colour => [ 'noconf' ],
- changes => [ 'okay', 'busy', 'critical' ],
+ changes => [ 'okay', 'busy', 'critical', 'disconnected' ],
menu => [ 'check' ],
tt => [ N_("urpmi database locked") ],
},
@@ -140,13 +146,13 @@ my %state = (
},
no_update_medium => {
colour => [ 'noconf' ],
- changes => [ 'okay', 'busy', 'critical' ],
+ changes => [ 'okay', 'busy', 'critical', 'disconnected' ],
menu => [ 'check' ],
tt => [ N_("No medium found. You must add some media through 'Software Media Manager'.") ],
},
no_enabled_medium => {
colour => [ 'noconf' ],
- changes => [ 'okay', 'busy', 'critical' ],
+ changes => [ 'okay', 'busy', 'critical', 'disconnected' ],
menu => [ 'check' ],
tt => [ N("You already have at least one update medium configured, but
all of them are currently disabled. You should run the Software
@@ -197,7 +203,7 @@ my %comm_codes = (
my %actions = (
'update' => { name => N("Install updates"), launch => sub { installUpdates() } },
- 'check' => { name => N("Check Updates"), launch => \&silentCheck },
+ 'check' => { name => N("Check Updates"), launch => \&checkUpdates },
'confNetwork' => { name => N("Configure Network"), launch => sub { configNetwork() } },
);
@@ -227,7 +233,8 @@ shouldStart() or die "$localfile should be set to TRUE: please use --force or -f
$icon->show_all;
go2State('delayed');
gtkflush();
-Glib::Timeout->add($config{FIRST_CHECK_DELAY}, sub { silentCheck(); 0 });
+checkConfig();
+Glib::Timeout->add($config{FIRST_CHECK_DELAY}, sub { checkUpdates(); 0 });
setup_cyclic_check();
@@ -388,8 +395,8 @@ sub setup_cyclic_check() {
$first_run = 1;
return 1;
}
-
- silentCheck();
+ checkConfig();
+ checkUpdates();
1;
});
}
@@ -405,6 +412,19 @@ sub setLastTime() {
setVar($localfile, 'LASTCHECK', $date);
}
+sub checkConfig() {
+ if (!isNetwork()) {
+ logIt(N_("Checking Network: seems disabled\n"));
+ go2State('disconnected');
+ } elsif (member($state_global, qw(disconnected))) {
+ silentCheck(); #- state has changed, update
+ }
+}
+
+sub checkUpdates() {
+ member($state_global, qw(disconnected)) or silentCheck();
+}
+
sub go2State {
my $state = shift;
$menu->destroy if $menu;
@@ -412,6 +432,15 @@ sub go2State {
$state_global = $state;
}
+sub isNetwork() {
+ require network::network;
+ require network::tools;
+ my $net = {};
+ network::network::read_net_conf($net);
+ my ($_gw_intf, $_is_up, $gw_address, $_dns_server) = network::tools::get_internet_connection($net);
+ to_bool($gw_address);
+}
+
sub shouldStart() {
my %p = getVarsFromSh($localfile);
my $ret = $p{AUTOSTART} eq 'FALSE' ? 0 : 1;