Skip to content

Commit

Permalink
MythFrontend: Convert ExitPrompter to use MythPower
Browse files Browse the repository at this point in the history
- most, if not all, users should see no change to existing behaviour
- if a command is set for reboot or shutdown, these are still used
- the old dbus code used a mix of logind, HAL, ConsoleKit and UPower
interfaces
- consolekit is now no longer installed on most systems and is
unmaintained and considered unsafe
- HAL is deprecated
- UPower no longer supports suspend or hibernate
- and logind is now the interface of choice
- MythPower also has an OSX implementation offering similar functionality
- add a new option for Suspend
- extend the confirmation dialog so that it is always used when a
shutdown/suspend/reboot request is initiated
- there is a default 3 second delay between the request to MythPower and
its implementation. When MythPower is added by default to
MythCoreContext, this will allow other MythTV components to request that
the delay is extended so that shutdowns etc can be handled gracefully
(e.g. allow SSDP Bye Bye notifications to be sent twice over a 5 second
interval).
- the use of logind scheduled requests also allows other system
components to handle shutdown etc gracefully if need be.
- it is theoretically possible to add another dialog that would offer a
countdown and ability to cancel the shutdown/reboot/suspend - but most
window managers appear to start shutting down display etc as soon as the
request is made - and hence the extra dialog is not isible/useful
  • Loading branch information
mark-kendall committed Jan 27, 2020
1 parent 934bcf9 commit 3905f73
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 183 deletions.
4 changes: 2 additions & 2 deletions mythtv/libs/libmythbase/mythpower.cpp
Expand Up @@ -29,7 +29,7 @@ QMutex MythPower::s_lock(QMutex::Recursive);
* for at least that period of time. This behaviour is not guaranteed - most
* notably in the case of externally triggered events. The actual delay attempted
* will be the maximum of those registered and, in the case of user initiated
* events, the EXIT_SHUTDOWN_DELAY user setting (which defaults to 5 seconds).
* events, the EXIT_SHUTDOWN_DELAY user setting (which defaults to 3 seconds).
*
* There is no method to subsequently alter the delay. Should this be needed, release
* the current reference and re-acquire with a new MinimumDelay. To ensure the
Expand Down Expand Up @@ -181,7 +181,7 @@ bool MythPower::RequestFeature(Feature Request, bool Delay)
// N.B Always check for a new user delay value as this class is persistent.
// Default is user preference, limited by the maximum supported system value
// and possibly overriden by the maximum delay requested by other Myth classes.
int user = gCoreContext->GetNumSetting("EXIT_SHUTDOWN_DELAY", 5);
int user = gCoreContext->GetNumSetting("EXIT_SHUTDOWN_DELAY", 3);
uint delay = qMin(qMax(static_cast<uint>(user), m_maxRequestedDelay), m_maxSupportedDelay);

LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Delay: %1 User: %2 Requested: %3 Supported: %4")
Expand Down

0 comments on commit 3905f73

Please sign in to comment.