Opened 16 years ago
Closed 16 years ago
Last modified 16 years ago
#7749 closed enhancement (fixed)
When running under a managed session, use that session's tools to shutdown/reboot
| Reported by: | Owned by: | Isaac Richards | |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.23 |
| Component: | MythTV - General | Version: | head |
| Severity: | medium | Keywords: | |
| Cc: | Ticket locked: | no |
Description
KDE, XFCE, & Gnome all support using their D-Bus interfaces to shutdown and reboot the system in some fashion. If one of those environment's session managers is running, it can be contacted and asked to reboot or halt the system.
If it can't be contacted, then you can fall back to the old style hardcoding of the halt/reboot commands.
Unfortunately this is broken in XFCE due to a bug in xfce-session, but when that bug is fixed, this code can be uncommented and included in myth too.
Attachments (4)
Change History (17)
by , 16 years ago
| Attachment: | use_session_to_shutdown.patch added |
|---|
by , 16 years ago
| Attachment: | use_session_or_console_kit.patch added |
|---|
comment:1 by , 16 years ago
by , 16 years ago
| Attachment: | use_session_ck_hal.diff added |
|---|
comment:2 by , 16 years ago
Although HAL is going away in the future, here's support for using all the different methods I can find for shutting down/rebooting. The logic will try each of these now in order:
1) KDE method 2) Gnome Method 3) ConsoleKit 4) HAL 5) Halt Command
That should cover all major situations. HAL is currently pretty standard on distros, and consolekit if not already is will be standard.
comment:3 by , 16 years ago
Wouldn't "shutdown now" with the appropriate options be the best option? No need to complicate MythTV trying 20 different ways to do the same thing. Every application is coded to accept a kill signal...
comment:4 by , 16 years ago
No, because that requires that you are running mythfrontend as root, or a user who has access to the shutdown command.
This way lets a lowly user do it.
comment:5 by , 16 years ago
| Milestone: | unknown → 0.23 |
|---|
comment:6 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:7 by , 16 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → new |
Unfortunately, this breaks OS X and Windows builds. The hacky fix would be for configure to test if Qt was compiled with DBus support, and #ifdef HAVE_DBUS in exitprompt.cpp. The possibly better fix would be to see if there are any DBus interfaces on OS X and Windows to shutdown/restart, and if so to build libdbus or winDBus on those platforms.
I'm trying to build libdbus on OS X right now...
comment:8 by , 16 years ago
I guess for the time being I will have something like: #ifdef HAVE_DBUS new code #else oldcode #endif
comment:9 by , 16 years ago
Rough, untested, patch atached.
It is possible that a user has built Qt --nodbus for some reason, so it is a config_ thing, not a HAVE_ ?
I think the .pro also needs a guard, because on Mac OS X, it tries to link in -lQtDBus - despite the fact that there is none and Qt was built without that feature.
comment:11 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:13 by , 16 years ago
(In [25433]) Fixes #8291. Remove the default values for the "Reboot command" and "Halt command" settings.
The given values likely will not work on most systems without at least a sudo (and possibly path information), and including default values prevents dbus shutdown from working. Therefore, more systems are likely to just do the right thing without the default values. Users wanting to use a script can simply provide the appropriate command invocation (which is almost definitely different from the former default values). This change will only affect new setups, not existing setups. Refs #8160. Refs #7749.

Upstream XFCE indicated that their API will not remain stable for using the dbus interface to xfce-session. Because of this, I've dropped their portion of the code and replaced it with consolekit. This has the added benefit that it will allow non Gnome/KDE/Xfce to be able to shutdown.