From e8a0e25299051673ac73fa0396efeb345e5f2a55 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 18 Jul 2005 10:36:30 +0000 Subject: check for new version every minute instead of every 2 seconds --- perl-install/standalone/net_applet | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'perl-install/standalone/net_applet') diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet index 7f9f03867..eb4bcea68 100644 --- a/perl-install/standalone/net_applet +++ b/perl-install/standalone/net_applet @@ -5,7 +5,6 @@ use lib qw(/usr/lib/libDrakX); use c; use common; use standalone; -use Digest::MD5; use network::network; use network::tools; @@ -21,13 +20,12 @@ use ugtk2 qw(:create :helpers :wrappers); my $enable_activefw; my ($eventbox, $img); -my ($current_state, $menu, $timeout); +my ($current_state, $menu, $timeout, $update_timeout); my $onstartupfile = "$ENV{HOME}/.net_applet"; add_icon_path("/usr/share/libDrakX/pixmaps/"); # Allow multiple instances, but only one per user: is_running('net_applet') and die "net_applet already running\n"; my $prog_name = "/usr/bin/net_applet"; -my $current_md5 = common::md5file($prog_name); my $net = {}; my $watched_interface; @@ -170,9 +168,6 @@ sub checkNetwork() { ($watched_interface, network::tools::get_interface_status($watched_interface)) : network::tools::get_internet_connection($net); go2State($gw_address ? 'connected' : $gw_intf ? 'disconnected' : 'notconfigured', $gw_intf); - - my $new_md5 = common::md5file($prog_name); - if ($new_md5 ne $current_md5) { exec($prog_name) } } sub checkNetworkForce() { $net = {}; @@ -186,6 +181,13 @@ sub cronNetwork() { 1; }); } +sub cronUpdate() { + my $current_md5 = common::md5file($prog_name); + $update_timeout = Glib::Timeout->add(60000, sub { + my $new_md5 = common::md5file($prog_name); + $new_md5 ne $current_md5 and exec($prog_name); + }); +} sub go2State { my ($state_type, $interface) = @_; if ($current_state ne $state_type) { @@ -271,6 +273,7 @@ sub generate_menu { } sub mainQuit() { Glib::Source->remove($timeout) if $timeout; + Glib::Source->remove($update_timeout) if $update_timeout; Gtk2->main_quit; } sub getAutoStart() { -- cgit v1.2.1