subtitles, softdevice for Shutdown rewrite for 1.5.x

Message ID 20070125133351.GA4583@localhost.localdomain
State New
Headers

Commit Message

Marko Mäkelä Jan. 25, 2007, 1:33 p.m. UTC
  On Sat, Jan 13, 2007 at 09:48:47PM +0100, Udo Richter wrote:
> Marko Mäkelä wrote:
> >A minor cosmetic thing: the '#' of pre-processor directives should always
> >be located at the first column of the line.  
> 
> The only indented directives are for the debug output I think, and this 
> will probably be removed before the final integration anyway.
> 
> >A more important suggestion: Could you please add a notification method
> >to status.h for notifying plugins whether VDR is currently in
> >interactive mode?  
> 
> You can poll this state on your own by calling 
> Shutdown.IsUserInactive().

I attach my patches to the subtitles and softdevice plugins.  I
intentionally kept them simple: I'm using the existing configuration
flags for disabling output.  It would be better to introduce a separate
variable for the configuration setting, and in MainThreadHook assign
the enable flag to either FALSE or the configured setting.  In that way,
the output could be permanently disabled from the plugin menus, as it
can be done now.

I'll post improved patches when the presence of the shutdown patch can
be tested with #ifdef.

	Marko
  

Patch

diff -pu subtitles-0.3.11/subtitles.c subtitles-0.3.11/subtitles.c
--- subtitles-0.3.11/subtitles.c	2006-04-28 17:24:44.000000000 +0300
+++ subtitles-0.3.11/subtitles.c	2007-01-25 15:10:02.000000000 +0200
@@ -11,6 +11,7 @@ 
 #include <vdr/device.h>
 #include <vdr/i18n.h>
 #include <vdr/tools.h>
+#include <vdr/shutdown.h>
 #include <vdr/config.h> // VDRVERSION
 #include "subfilter.h"
 #include "configuration.h"
@@ -49,6 +50,7 @@  public:
   virtual cOsdObject *MainMenuAction(void);
   virtual cMenuSetupPage *SetupMenu(void);
   virtual bool SetupParse(const char *Name, const char *Value);
+  virtual void MainThreadHook(void);
 
   };
 
@@ -132,4 +134,10 @@  bool cPluginSubtitles::SetupParse(const 
 {
     return gSubtitlesConfiguration.Parse(Name,Value);
 }
+
+void cPluginSubtitles::MainThreadHook(void)
+{
+  gSubtitlesConfiguration.enabled = !Shutdown.IsUserInactive();
+}
+
 VDRPLUGINCREATOR(cPluginSubtitles); // Don't touch this!