From patchwork Wed May 3 22:45:10 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Udo Richter X-Patchwork-Id: 12299 Received: from mail.gmx.net ([213.165.64.20]) by www.linuxtv.org with smtp (Exim 4.50) id 1FbQ7P-0003n0-9Y for vdr@linuxtv.org; Thu, 04 May 2006 00:46:51 +0200 Received: (qmail invoked by alias); 03 May 2006 22:46:19 -0000 Received: from p548A4191.dip0.t-ipconnect.de (EHLO [192.168.73.1]) [84.138.65.145] by mail.gmx.net (mp001) with SMTP; 04 May 2006 00:46:19 +0200 X-Authenticated: #1417946 Message-ID: <44593276.4080107@gmx.de> Date: Thu, 04 May 2006 00:45:10 +0200 From: Udo Richter User-Agent: Thunderbird 2.0a1 (Windows/20060502) MIME-Version: 1.0 To: VDR Mailing List Subject: Re: [vdr] [Patch] Fix shutdown References: <4454AC03.70905@cadsoft.de> <14EF5C32-0872-49B0-8099-E77BC9E555F0@gmx.net> <4457BA08.9030701@gmx.de> In-Reply-To: <4457BA08.9030701@gmx.de> X-Y-GMX-Trusted: 0 X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2006 22:46:51 -0000 Status: O X-Status: X-Keywords: X-UID: 9304 Udo Richter wrote: > Dominique Simon wrote: >> I noticed that VDR does not warn anymore if you press the power button >> (on the remote) and there is a timer within the next X minutes. > > One way to fix this would be to always ask, and skip the && > !ForceShutdown before asking "Recording in %ld minutes, shut down > anyway?". This would result in up to three confirms on shutdown: Running > recording, plugin activity and soon recording. For better consistency, > its probably a good idea to move this question into the kPower handler, > where the other two confirms reside. The attached patch moves the "Recording in %ld minutes, shut down anyway?" confirmation into the kPower handler, where all the other shutdown confirms reside. I *hope* that this time it doesn't cause yet another regression. ;) Cheers, Udo --- vdr-1.4.0-orig/vdr.c 2006-05-04 00:07:45.000000000 +0200 +++ vdr-1.4.0/vdr.c 2006-05-04 00:22:43.052229240 +0200 @@ -970,7 +970,7 @@ } break; // Power off: - case kPower: + case kPower: { isyslog("Power button pressed"); DELETE_MENU; if (!Shutdown) { @@ -985,8 +985,21 @@ } if (cPluginManager::Active(tr("shut down anyway?"))) break; + + cTimer *timer = Timers.GetNextActiveTimer(); + time_t Next = timer ? timer->StartTime() : 0; + time_t Delta = timer ? Next - time(NULL) : 0; + if (Next && Delta <= Setup.MinEventTimeout * 60) { + char *buf; + asprintf(&buf, tr("Recording in %ld minutes, shut down anyway?"), Delta / 60); + bool confirm=Interface->Confirm(buf); + free(buf); + if (!confirm) break; + } + ForceShutdown = true; break; + } default: break; } Interact = Menu ? Menu : cControl::Control(); // might have been closed in the mean time @@ -1121,15 +1134,6 @@ else LastActivity = 1; } - if (UserShutdown && Next && Delta <= Setup.MinEventTimeout * 60 && !ForceShutdown) { - char *buf; - asprintf(&buf, tr("Recording in %ld minutes, shut down anyway?"), Delta / 60); - if (Interface->Confirm(buf)) - ForceShutdown = true; - else - UserShutdown = false; - free(buf); - } if (!Next || Delta > Setup.MinEventTimeout * 60 || ForceShutdown) { ForceShutdown = false; if (timer)