Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Feature request - Shutdown confirmation (patch included)



Just as I send my message Klaus announced the new developer version 1.3.2.
I attached the patch for it. Studiply a small bug was in the first
patch (config.c, return false;). Damn. But this one here should be
bugless.

Sorry for the trouble.

Patrick
diff -u /usr/src/vdr/vdr-1.3.2/config.c ./config.c
--- /usr/src/vdr/vdr-1.3.2/config.c	Sun Jan 11 16:38:11 2004
+++ ./config.c	Sun Jan 18 18:00:51 2004
@@ -289,6 +289,7 @@
   memset(CaCaps, sizeof(CaCaps), 0);
   CurrentChannel = -1;
   CurrentVolume = MAXVOLUME;
+  ShutdownBehaviour = 0;
 }
 
 cSetup& cSetup::operator= (const cSetup &s)
@@ -476,6 +477,7 @@
   else if (!strcasecmp(Name, "CaCaps"))              return ParseCaCaps(Value);
   else if (!strcasecmp(Name, "CurrentChannel"))      CurrentChannel     = atoi(Value);
   else if (!strcasecmp(Name, "CurrentVolume"))       CurrentVolume      = atoi(Value);
+  else if (!strcasecmp(Name, "ShutdownBehaviour"))    ShutdownBehaviour  = atoi(Value);
   else
      return false;
   return true;
@@ -528,6 +530,7 @@
   StoreCaCaps("CaCaps");
   Store("CurrentChannel",     CurrentChannel);
   Store("CurrentVolume",      CurrentVolume);
+  Store("ShutdownBehaviour",  ShutdownBehaviour);
 
   Sort();
 
diff -u /usr/src/vdr/vdr-1.3.2/config.h ./config.h
--- /usr/src/vdr/vdr-1.3.2/config.h	Sun Jan 11 22:42:23 2004
+++ ./config.h	Sun Jan 18 17:51:39 2004
@@ -245,6 +245,7 @@
   int CaCaps[MAXDEVICES][MAXCACAPS];
   int CurrentChannel;
   int CurrentVolume;
+  int ShutdownBehaviour;  /* 0 = default; 1 = confirm */
   int __EndData__;
   cSetup(void);
   cSetup& operator= (const cSetup &s);
diff -u /usr/src/vdr/vdr-1.3.2/i18n.c ./i18n.c
--- /usr/src/vdr/vdr-1.3.2/i18n.c	Sat Jan 17 15:39:38 2004
+++ ./i18n.c	Sun Jan 18 17:51:39 2004
@@ -4142,6 +4142,74 @@
     "Aquest plugin no admet configuració!",
     "¼ÞÔãÛì àÐáèØàÕÝØï ÝÕ ØÜÕÕâ ßÐàÐÜÕâàÞÒ ÝÐáâàÞÙÚØ!",
    },
+  { "Do you really want to shutdown?",
+    "Wirklich herunterfahren?",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "Vraiment éteindre?",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+  },
+  { "Setup.Miscellaneous$Confirm shutdown",
+    "Ausschalten bestätigen",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "Confirmer éteindre",// TODO
+    "",// TODO
+    "",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+  },
+  { "confirm",
+    "bestätigen",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "confirmer",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+  },
+  { "timeout",
+    "timeout",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "timeout",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+  },
   { NULL }
   };
 
diff -u /usr/src/vdr/vdr-1.3.2/menu.c ./menu.c
--- /usr/src/vdr/vdr-1.3.2/menu.c	Sat Jan 17 15:17:00 2004
+++ ./menu.c	Sun Jan 18 17:51:39 2004
@@ -2348,6 +2348,7 @@
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Min. user inactivity (min)"), &data.MinUserInactivity));
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$SVDRP timeout (s)"),          &data.SVDRPTimeout));
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Zap timeout (s)"),            &data.ZapTimeout));
+  Add(new cMenuEditBoolItem( tr("Setup.Miscellaneous$Confirm shutdown"),          &data.ShutdownBehaviour,("timeout"), tr("confirm") ));
 }
 
 // --- cMenuSetupPluginItem --------------------------------------------------
diff -u /usr/src/vdr/vdr-1.3.2/vdr.c ./vdr.c
--- /usr/src/vdr/vdr-1.3.2/vdr.c	Sat Jan 17 17:56:57 2004
+++ ./vdr.c	Sun Jan 18 17:51:39 2004
@@ -793,7 +793,14 @@
                        dsyslog("next timer event at %s", ctime(&Next));
                     if (WatchdogTimeout > 0)
                        signal(SIGALRM, SIG_IGN);
-                    if (Interface->Confirm(tr("Press any key to cancel shutdown"), UserShutdown ? 5 : SHUTDOWNWAIT, true)) {
+					
+                    bool halt;
+                    if (UserShutdown && Setup.ShutdownBehaviour == 1) 
+                      halt = Interface->Confirm(tr("Do you really want to shutdown?"));
+                    else
+                      halt = Interface->Confirm(tr("Press any key to cancel shutdown"), UserShutdown ? 5 : SHUTDOWNWAIT, true);
+
+                    if (halt) {
                        int Channel = timer ? timer->Channel()->Number() : 0;
                        const char *File = timer ? timer->File() : "";
                        Delta = Next - time(NULL); // compensates for Confirm() timeout

Home | Main Index | Thread Index