From fea55c720c9ce59ece6eb34984243312321de9e9 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 28 Sep 2004 14:38:37 +0000 Subject: check every 5 seconds if network and config are available --- mdkapplet | 15 +++++++++++---- 1 file 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; -- cgit v1.2.1