Mailing List archive

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

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



Hello List,

Thanks to my "stubby finger" (Wurstfinger) and my misdesigned remote
control, at least one time per day, I shutdown my vdr without wanting it.
My RC has a button "All off" and during this process, I'm not able to
interruppt the shutdown confirmation, because I cannot press any key.

The solution for me is, to confirm the shutdown by pressing "ok" (like it
is when you want to restart via Menu->Setup).

Attached is a patch for vdr 1.3.1 which adds a menuentry to choose
between timeout and confirmation. When pressing the shutdown button vdr
either waits for the timeout or waits for confirmation.

Maybe Klaus thinks it is useful and applies it to vdr.

Because this is my first patch for vdr I would like to know if this is
the correct way to supply the patch (or should I have send it directly to
Klaus).

Patrick
diff -uB /usr/src/vdr/vdr-1.3.unchanged/config.c ./config.c
--- /usr/src/vdr/vdr-1.3.unchanged/config.c	Sun Jan 11 16:38:11 2004
+++ ./config.c	Sun Jan 18 15:07:36 2004
@@ -289,6 +289,7 @@
   memset(CaCaps, sizeof(CaCaps), 0);
   CurrentChannel = -1;
   CurrentVolume = MAXVOLUME;
+  ShutdownBehaviour = 0;
 }
 
 cSetup& cSetup::operator= (const cSetup &s)
@@ -476,7 +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
+  else if (!strcasecmp(Name, "ShutdownBehaviour"))    ShutdownBehaviour  = atoi(Value);
      return false;
   return true;
 }
@@ -528,6 +529,7 @@
   StoreCaCaps("CaCaps");
   Store("CurrentChannel",     CurrentChannel);
   Store("CurrentVolume",      CurrentVolume);
+  Store("ShutdownBehaviour",  ShutdownBehaviour);
 
   Sort();
 
diff -uB /usr/src/vdr/vdr-1.3.unchanged/config.h ./config.h
--- /usr/src/vdr/vdr-1.3.unchanged/config.h	Tue Jan  6 17:47:41 2004
+++ ./config.h	Sun Jan 18 17:08:12 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 -uB /usr/src/vdr/vdr-1.3.unchanged/i18n.c ./i18n.c
--- /usr/src/vdr/vdr-1.3.unchanged/i18n.c	Sun Jan 11 16:38:45 2004
+++ ./i18n.c	Sun Jan 18 17:03:19 2004
@@ -3899,6 +3899,74 @@
     "Ennek a plugin-nak nincs setup-parametere!",
     "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 -uB /usr/src/vdr/vdr-1.3.unchanged/menu.c ./menu.c
--- /usr/src/vdr/vdr-1.3.unchanged/menu.c	Sun Jan 11 16:40:32 2004
+++ ./menu.c	Sun Jan 18 16:57:57 2004
@@ -2341,6 +2341,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 -uB /usr/src/vdr/vdr-1.3.unchanged/vdr.c ./vdr.c
--- /usr/src/vdr/vdr-1.3.unchanged/vdr.c	Sun Jan  4 12:12:05 2004
+++ ./vdr.c	Sun Jan 18 17:10:29 2004
@@ -792,7 +792,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() : "";
                        char *cmd;

Home | Main Index | Thread Index