From 491c1fa99a5529e88bf7a2361cf31be787e7cf90 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Sat, 3 Sep 2005 16:13:17 +0000 Subject: - Used Glib::Timeout->add() function for auto-refreshing remote printer list. --- perl-install/standalone/printerdrake | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'perl-install') diff --git a/perl-install/standalone/printerdrake b/perl-install/standalone/printerdrake index abe8e7698..7bc4e1387 100755 --- a/perl-install/standalone/printerdrake +++ b/perl-install/standalone/printerdrake @@ -272,8 +272,9 @@ my $isEmbedded = $::isEmbedded; local $::isEmbedded = 0; # Auto refresh -local $SIG{ALRM} = sub { Refresh($stringsearch) }; -alarm $refreshinterval; +my $refreshing = 0; +Glib::Timeout->add($refreshinterval * 1000, + sub { Refresh($stringsearch); 1 }); $us->{wnd}->main; ugtk2->exit; @@ -369,8 +370,9 @@ sub RefreshRemotePrintersFull { } sub Refresh { - # Do not have ourselves recalled if we are not running - alarm 0; + # Do not have ourselves recalled if we are already running + return if $refreshing; + $refreshing = 1; my ($strfilt) = @_; my $selection = get_selection(); printer::services::wait_for_cups(); @@ -380,8 +382,7 @@ sub Refresh { RefreshRemotePrintersFull($strfilt, @printers); GrayDelEdit(); set_selection($selection); - # Recall when refresh intervall has passed - alarm $refreshinterval; + $refreshing = 0; } sub AddPrinter() { -- cgit v1.2.1