summaryrefslogtreecommitdiffstats
path: root/mdkapplet
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-09-28 14:38:37 +0000
committerOlivier Blin <oblin@mandriva.org>2004-09-28 14:38:37 +0000
commitfea55c720c9ce59ece6eb34984243312321de9e9 (patch)
tree659aab02c860cb17afdb885ca54ecc7a259c3426 /mdkapplet
parent6aa8e207e59b40f78e43484d0e562002dfbe2efa (diff)
downloadmgaonline-fea55c720c9ce59ece6eb34984243312321de9e9.tar
mgaonline-fea55c720c9ce59ece6eb34984243312321de9e9.tar.gz
mgaonline-fea55c720c9ce59ece6eb34984243312321de9e9.tar.bz2
mgaonline-fea55c720c9ce59ece6eb34984243312321de9e9.tar.xz
mgaonline-fea55c720c9ce59ece6eb34984243312321de9e9.zip
check every 5 seconds if network and config are available
Diffstat (limited to 'mdkapplet')
-rwxr-xr-xmdkapplet15
1 files changed, 11 insertions, 4 deletions
diff --git a/mdkapplet b/mdkapplet
index f14c15cd..73f0b36d 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -132,6 +132,7 @@ if ($opt eq '--force' || $opt eq '-f') { setAutoStart('TRUE') };
shouldStart() or die "$localfile should be set to TRUE: please use --force or -f option to launch applet";
+checkConfig();
checkUpdates();
cronUpdate();
@@ -285,7 +286,10 @@ sub is_running {
} `ps -o '%P %p %c' -u $ENV{USER}`;
}
sub cronUpdate {
- my ($to) = shift;
+ Glib::Timeout->add(5*1000, sub {
+ checkConfig();
+ 1;
+ });
$timeout = Glib::Timeout->add(3*60*60*1000, sub {
checkUpdates();
1;
@@ -307,17 +311,20 @@ sub setLastTime {
my $date = getTime() ;
setVar($localfile, 'LASTCHECK', $date);
}
-sub checkUpdates {
+sub checkConfig {
if (!isNetwork()) {
logIt(N("Checking Network: seems disabled\n"));
go2State('disconnected')
} elsif (!-e $conffile) {
logIt(N("Checking config file: Not present\n"));
go2State('noconfig')
- } else {
- silentCheck();
+ } elsif (member($state_global, qw(disconnected noconfig))) {
+ silentCheck(); #- state has changed, update
}
}
+sub checkUpdates {
+ silentCheck() unless member($state_global, qw(disconnected noconfig));
+}
sub go2State {
my $state = shift;
$menu && $menu->destroy;