Move suspend on inactivity to houesekeeping.

This commit is contained in:
Johns 2012-04-05 15:43:32 +02:00
parent c19b86411a
commit 8612044b9b

View File

@ -1402,7 +1402,7 @@ class cPluginSoftHdDevice:public cPlugin
virtual bool Initialize(void); virtual bool Initialize(void);
virtual bool Start(void); virtual bool Start(void);
virtual void Stop(void); virtual void Stop(void);
// virtual void Housekeeping(void); virtual void Housekeeping(void);
virtual void MainThreadHook(void); virtual void MainThreadHook(void);
virtual const char *MainMenuEntry(void); virtual const char *MainMenuEntry(void);
virtual cOsdObject *MainMenuAction(void); virtual cOsdObject *MainMenuAction(void);
@ -1501,6 +1501,10 @@ bool cPluginSoftHdDevice::Start(void)
return true; return true;
} }
/**
** Shutdown plugin. Stop any background activities the plugin is
** performing.
*/
void cPluginSoftHdDevice::Stop(void) void cPluginSoftHdDevice::Stop(void)
{ {
//dsyslog("[softhddev]%s:\n", __FUNCTION__); //dsyslog("[softhddev]%s:\n", __FUNCTION__);
@ -1508,8 +1512,6 @@ void cPluginSoftHdDevice::Stop(void)
::Stop(); ::Stop();
} }
#if 0
/** /**
** Perform any cleanup or other regular tasks. ** Perform any cleanup or other regular tasks.
*/ */
@ -1517,10 +1519,18 @@ void cPluginSoftHdDevice::Housekeeping(void)
{ {
dsyslog("[softhddev]%s:\n", __FUNCTION__); dsyslog("[softhddev]%s:\n", __FUNCTION__);
// ::Housekeeping(); // check if user is inactive, automatic enter suspend mode
} // FIXME: cControl prevents shutdown, disable this until fixed
if (0 && SuspendMode == NOT_SUSPENDED && ShutdownHandler.IsUserInactive()) {
// don't overwrite already suspended suspend mode
cControl::Launch(new cSoftHdControl);
cControl::Attach();
Suspend(ConfigSuspendClose, ConfigSuspendClose, ConfigSuspendX11);
SuspendMode = SUSPEND_NORMAL;
}
#endif ::Housekeeping();
}
/** /**
** Create main menu entry. ** Create main menu entry.
@ -1556,16 +1566,6 @@ void cPluginSoftHdDevice::MainThreadHook(void)
cDevice::SetPrimaryDevice(DoMakePrimary); cDevice::SetPrimaryDevice(DoMakePrimary);
DoMakePrimary = 0; DoMakePrimary = 0;
} }
// check if user is inactive, automatic enter suspend mode
// FIXME: cControl prevents shutdown, disable this until fixed
// FIXME: move this to ::Housekeeping
if (0 && SuspendMode == NOT_SUSPENDED && ShutdownHandler.IsUserInactive()) {
// don't overwrite already suspended suspend mode
cControl::Launch(new cSoftHdControl);
cControl::Attach();
Suspend(ConfigSuspendClose, ConfigSuspendClose, ConfigSuspendX11);
SuspendMode = SUSPEND_NORMAL;
}
::MainThreadHook(); ::MainThreadHook();
} }