summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Abdallah <ali.slackware@gmail.com>2009-07-16 09:50:42 +0000
committerAli Abdallah <ali.slackware@gmail.com>2009-07-16 09:50:42 +0000
commit0f1b741d0f7f217153b988170305e2921f3839bb (patch)
tree952a5db0992357097a3e8354ce15e37f5a35d31a
parentcdbdc537afb3f6a16ec8d1d3f0afd537d65e0a52 (diff)
downloadixfce4-power-manager-0f1b741d0f7f217153b988170305e2921f3839bb.tar.gz
* Provides the following standard DBus methods:
CanReboot(),CanShutdown(),Reboot(),GetPowerSaveStatus(). * src/xfpm-error.{c,h} correct errors name for non supported shutdown/hibernate... . to NoHardwareSupported+Invalid cookie to Cookie not found. * Update TODO. * Update the documentation. (Old svn revision: 7729)
-rw-r--r--ChangeLog9
-rw-r--r--TODO4
-rw-r--r--configure.ac.in2
-rw-r--r--doc/C/xfce4-power-manager.html22
-rw-r--r--doc/C/xfce4-power-manager.xml.in47
-rw-r--r--src/org.freedesktop.PowerManagement.xml15
-rw-r--r--src/xfpm-engine.c86
-rw-r--r--src/xfpm-errors.c6
-rw-r--r--src/xfpm-errors.h6
-rw-r--r--src/xfpm-inhibit.c2
-rw-r--r--src/xfpm-session.c10
-rw-r--r--src/xfpm-session.h2
-rw-r--r--src/xfpm-shutdown.c31
-rw-r--r--src/xfpm-shutdown.h3
14 files changed, 212 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index e83c6353..844ef961 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-07-15: Ali aliov@xfce.org
+ * Provides the following standard DBus methods:
+ CanReboot(),CanShutdown(),Reboot(),GetPowerSaveStatus().
+ * src/xfpm-error.{c,h} correct errors name for non
+ supported shutdown/hibernate... .
+ to NoHardwareSupported+Invalid cookie to Cookie not found.
+ * Update TODO.
+ * Update the documentation.
+
2009-07-09: Ali aliov@xfce.org
* src/xfpm-xfconf.c fix a bug affecting 0.8.1.* for the properties prefix.
* src/xfpm-engine.c Fix default idle timeout.
diff --git a/TODO b/TODO
index 3f29941e..00e9a837 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,5 @@
* : Solve the problem of possible multiple sleep requests between us and the session manager.
-* : Support Suspend Hybrid! ( DeviceKit power will not support this! ).
-
-* : Translations need to be updated.
+* : Probably provide a PermissionDenied error on the inhibit interface?
* : Updating the documentations.
diff --git a/configure.ac.in b/configure.ac.in
index 7da84500..a4dfa84d 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -3,7 +3,7 @@ m4_define([xfpm_version_major], [0])
m4_define([xfpm_version_minor], [8])
m4_define([xfpm_version_micro], [2])
m4_define([xfpm_version_build], [])
-m4_define([xfpm_version_tag],[])
+m4_define([xfpm_version_tag],[r@REVISION@])
m4_define([xfpm_version], [xfpm_version_major().xfpm_version_minor().xfpm_version_micro()ifelse(xfpm_version_tag(), [svn], [xfpm_version_tag().xfpm_version_build()], [xfpm_version_tag()])])
AC_INIT([xfce4-power-manager], [xfpm_version], [http://bugzilla.xfce.org/])
diff --git a/doc/C/xfce4-power-manager.html b/doc/C/xfce4-power-manager.html
index 078294a1..0ad2f2e4 100644
--- a/doc/C/xfce4-power-manager.html
+++ b/doc/C/xfce4-power-manager.html
@@ -1,4 +1,4 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Xfce 4 Power Manager</title><link rel="stylesheet" href="../xfce.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="#xfce4-power-manager" title="Xfce 4 Power Manager"><link rel="next" href="#xfpm-intro" title="Introduction"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="xfce4-power-manager"></a>Xfce 4 Power Manager</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Ali</span> <span class="surname">Abdallah</span></h3><div class="affiliation"><div class="address"><p><code class="email">&lt;<a class="email" href="mailto:aliov@xfce.org">aliov@xfce.org</a>&gt;</code></p></div></div></div></div></div><div><span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="releaseinfo">This manual describes <strong xmlns="" class="application"><code>xfce4-power-manager</code></strong> version 0.8.0
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Xfce 4 Power Manager</title><link rel="stylesheet" href="../xfce.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="#xfce4-power-manager" title="Xfce 4 Power Manager"><link rel="next" href="#xfpm-intro" title="Introduction"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="xfce4-power-manager"></a>Xfce 4 Power Manager</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Ali</span> <span class="surname">Abdallah</span></h3><div class="affiliation"><div class="address"><p><code class="email">&lt;<a class="email" href="mailto:aliov@xfce.org">aliov@xfce.org</a>&gt;</code></p></div></div></div></div></div><div><span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="releaseinfo">This manual describes <strong xmlns="" class="application"><code>xfce4-power-manager</code></strong> version 0.8.2r07720
<br></br></span></div><div><p class="copyright">Copyright © 2008 Ali Abdallah</p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#xfpm-intro">Introduction</a></span></dt><dd><dl><dt><span class="sect2"><a href="#xfpm-started">Getting Started</a></span></dt></dl></dd><dt><span class="sect1"><a href="#xfpm">Power Manager</a></span></dt><dd><dl><dt><span class="sect2"><a href="#xfpm-command-line">Command line options</a></span></dt><dt><span class="sect2"><a href="#xfpm-menu">Context menu</a></span></dt></dl></dd><dt><span class="sect1"><a href="#xfpm-configuration">Power Manager Configuration</a></span></dt><dd><dl><dt><span class="sect2"><a href="#xfpm-general">General options</a></span></dt><dt><span class="sect2"><a href="#xfpm-on-ac">Running on AC power</a></span></dt><dt><span class="sect2"><a href="#xfpm-on-battery">Running on battery power</a></span></dt><dt><span class="sect2"><a href="#xfpm-extended">Extended options</a></span></dt><dt><span class="sect2"><a href="#xfpm-hidden-options">Hidden options</a></span></dt></dl></dd><dt><span class="sect1"><a href="#xfpm-plugins"> Panel plugins </a></span></dt><dt><span class="sect1"><a href="#xfpm-faq">FAQ</a></span></dt><dt><span class="sect1"><a href="#xfpm-technical">
Technical information
</a></span></dt><dd><dl><dt><span class="sect2"><a href="#xfpm-dbus">DBus interfaces</a></span></dt></dl></dd><dt><span class="sect1"><a href="#xfpm-about">About <strong class="application"><code>xfce4-power-manager</code></strong></a></span></dt></dl></div><p> </p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="xfpm-intro"></a>Introduction</h2></div></div></div>
@@ -18,7 +18,7 @@
Restarts the power manager.
</p></dd><dt><span class="term"><span class="keycap"><strong>--quit</strong></span></span></dt><dd><p>
Causes any running instance of the power manager to exit.
- </p></dd></dl></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="xfpm-menu"></a>Context menu</h3></div></div></div><div class="figure"><a name="id2924856"></a><p class="title"><b>Figure 1. Context menu</b></p><div class="figure-contents"><div class="screenshot"><div class="mediaobject"><img src="images/xfpm-context-menu.png" alt="Context menu"></div></div></div></div><p><br class="figure-break"></p><p>
+ </p></dd></dl></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="xfpm-menu"></a>Context menu</h3></div></div></div><div class="figure"><a name="id2907312"></a><p class="title"><b>Figure 1. Context menu</b></p><div class="figure-contents"><div class="screenshot"><div class="mediaobject"><img src="images/xfpm-context-menu.png" alt="Context menu"></div></div></div></div><p><br class="figure-break"></p><p>
The context menu pops up when you click on the icon placed in your notification area for example a battery or an adapter icon. It contains some useful options like suspend/hibernate,
display information of the battery device and open the settings dialog. It contains as well option to inhibit the power manager. If enabled, the power manager will not attempt
to dim the screen or switch off the monitor.
@@ -29,7 +29,7 @@ if it is enabled in the settings dialog. Only critical actions are processed.</p
</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="xfpm-configuration"></a>Power Manager Configuration</h2></div></div></div><p>
In this section we will explain in details the possible configuration of the power manager running on laptop computer. Please note that the configurations are different when
the power manager is running on a desktop computer, for example you will not have LCD brightness etc.
- </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="xfpm-general"></a>General options</h3></div></div></div><div class="figure"><a name="id2929788"></a><p class="title"><b>Figure 2. General settings</b></p><div class="figure-contents"><div class="screenshot"><div class="mediaobject"><img src="images/xfpm-general-settings.png" alt="General settings"></div></div></div></div><p><br class="figure-break"></p><p>
+ </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="xfpm-general"></a>General options</h3></div></div></div><div class="figure"><a name="id2912243"></a><p class="title"><b>Figure 2. General settings</b></p><div class="figure-contents"><div class="screenshot"><div class="mediaobject"><img src="images/xfpm-general-settings.png" alt="General settings"></div></div></div></div><p><br class="figure-break"></p><p>
</p><div class="variablelist"><p class="title"><b></b></p><dl><dt><span class="term"><span class="keycap"><strong>Notification area:</strong></span></span></dt><dd><p>The notification area settings allow you to control the behaviour of the icon placed in your notification area. You can set it to be always visible. For battery devices,
you can select the icon to be visible only when your are running on battery for example.</p></dd><dt><span class="term"><span class="keycap"><strong>Keyboard special keys:</strong></span></span></dt><dd><p>
@@ -51,7 +51,7 @@ The on battery tab is only shown on systems that have battery devices. It contai
This is the power profile when running on battery. With this option your battery will last more when running on battery power.
Enabling this option is always a good idea.
</p></dd></dl></div><p>
-</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="xfpm-extended"></a>Extended options</h3></div></div></div><div class="figure"><a name="id2925152"></a><p class="title"><b>Figure 3. Extended settings</b></p><div class="figure-contents"><div class="screenshot"><div class="mediaobject"><img src="images/xfpm-extended-settings.png" alt="Extended settings"></div></div></div></div><p><br class="figure-break"></p><p>
+</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="xfpm-extended"></a>Extended options</h3></div></div></div><div class="figure"><a name="id2907607"></a><p class="title"><b>Figure 3. Extended settings</b></p><div class="figure-contents"><div class="screenshot"><div class="mediaobject"><img src="images/xfpm-extended-settings.png" alt="Extended settings"></div></div></div></div><p><br class="figure-break"></p><p>
</p><div class="variablelist"><p class="title"><b></b></p><dl><dt><span class="term"><span class="keycap"><strong>Inactivity sleep mode:</strong></span></span></dt><dd><p>You can select the inactivity sleep action to be taken by the power manger when the system is idle for a interval of time set by you
either on ac power or on battery power. Of course if you disable idle timeout those settings will have no effects.</p></dd><dt><span class="term"><span class="keycap"><strong>Monitor sleep mode:</strong></span></span></dt><dd><p>
DPMS sleep modes before switching off the monitor are either standby or suspend. They are technically different and provided for convenience.
@@ -84,13 +84,13 @@ Since <strong class="application"><code>xfce4-power-manager</code></strong> reli
</p><pre class="programlisting">xfconf-query -c <strong class="application"><code>xfce4-power-manager</code></strong> -n -p "/<strong class="application"><code>xfce4-power-manager</code></strong>/show-brightness-popup" -t bool -s false</pre><p>
- </p></dd></dl></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="xfpm-plugins"></a> Panel plugins </h2></div></div></div><div class="figure"><a name="id2929360"></a><p class="title"><b>Figure 4. Brightness plugin</b></p><div class="figure-contents"><div class="screenshot"><div class="mediaobject"><img src="images/xfpm-brightness-plugin.png" alt="Brightness plugin"></div></div></div></div><p><br class="figure-break"></p><p>
-<strong class="application"><code>xfce4-power-manager</code></strong> version 0.8.0 includes one panel plugin for LCD brightness control (possible other plugins might be added for future releases). The usage of the brightness plugin
+ </p></dd></dl></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="xfpm-plugins"></a> Panel plugins </h2></div></div></div><div class="figure"><a name="id2911816"></a><p class="title"><b>Figure 4. Brightness plugin</b></p><div class="figure-contents"><div class="screenshot"><div class="mediaobject"><img src="images/xfpm-brightness-plugin.png" alt="Brightness plugin"></div></div></div></div><p><br class="figure-break"></p><p>
+<strong class="application"><code>xfce4-power-manager</code></strong> version 0.8.2r07720 includes one panel plugin for LCD brightness control (possible other plugins might be added for future releases). The usage of the brightness plugin
is simple; just add the plugin to the panel same way as the one used to add any other plugin; then click on the plugin; a slider will pop up that you move/scroll on it to change
the brightness level of your screen. Of course the plugin will not work on a system with no back light panel.
</p></div><p> </p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="xfpm-faq"></a>FAQ</h2></div></div></div><div class="variablelist"><dl><dt><span class="term">Q: Why the icons look very similar to the icon of gnome power manager?</span></dt><dd><p>A: No, they are not similar; they are the same. Just there is no point of re-drawing icons.
gnome power manager icons are good enough. Not all the gnome power manager icons are used. Please note that
- for version 0.8.0 the icons are renamed to avoid possible conflicts with a gnome power manager installation.
+ for version 0.8.2r07720 the icons are renamed to avoid possible conflicts with a gnome power manager installation.
</p></dd><dt><span class="term">Q: What is the difference between suspend and hibernate?</span></dt><dd><p>A: Suspend is a power save feature. When suspending, the computer is still using power,
since the running applications are kept in the memory, but it is the lowest power level that the computer
can use. While Hibernate saves the system state on the hard drive and turns off the power, when you start up your
@@ -116,17 +116,17 @@ Ideally these details should go in a technical guide not the user guide, but we
</p><span class="keycap"><strong>Power management DBus interface.</strong></span><p>
-</p><div class="table"><a name="id2929581"></a><p class="title"><b>Table 1. Standard methods (org.freedesktop.PowerManagement):</b></p><div class="table-contents"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" bgcolor="#F8F9FD" cellspacing="0" cellpadding="4" summary="Standard methods (org.freedesktop.PowerManagement):" border="1"><colgroup><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns=""><col xmlns="" align="left"></colgroup><thead xmlns=""><tr><th colspan="2" align="center">Name</th><th align="left">Input parameter</th><th align="left">Return Values</th><th align="left">Errors</th><th align="left">Description</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">CanHibernate</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">whether the system is able to hibernate</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">CanSuspend</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">whether the system is able to suspend</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">GetOnBattery</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">whether the system is running on battery</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">GetLowBattery</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">whether the system is running on low battery</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">Hibernate</th><th align="left"> </th><th align="left"> </th><th align="left">PermissionDenied, NotSupported</th><th align="left"> </th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">Suspend</th><th align="left"> </th><th align="left"> </th><th align="left">PermissionDenied, NotSupported</th><th align="left"> </th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">Shutdown</th><th align="left"> </th><th align="left"> </th><th align="left">PermissionDenied, NotSupported</th><th align="left"> </th></tr></thead></table></div></div><p><br class="table-break">
+</p><div class="table"><a name="id2912037"></a><p class="title"><b>Table 1. Standard methods (org.freedesktop.PowerManagement):</b></p><div class="table-contents"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" bgcolor="#F8F9FD" cellspacing="0" cellpadding="4" summary="Standard methods (org.freedesktop.PowerManagement):" border="1"><colgroup><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns=""><col xmlns="" align="left"></colgroup><thead xmlns=""><tr><th colspan="2" align="center">Name</th><th align="left">Input parameter</th><th align="left">Return Values</th><th align="left">Errors</th><th align="left">Description</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">CanHibernate</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">whether the system is able to hibernate</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">CanSuspend</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">whether the system is able to suspend</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">CanReboot</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">whether the system is able to reboot</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">CanShutdown</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">whether the system is able to shutdown</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">GetOnBattery</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">whether the system is running on battery</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">GetLowBattery</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">whether the system is running on low battery</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">GetPowerSaveStatus</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">whether the system is running in power save mode.</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">Hibernate</th><th align="left"> </th><th align="left"> </th><th align="left">PermissionDenied, NoHardwareSupport</th><th align="left"> </th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">Suspend</th><th align="left"> </th><th align="left"> </th><th align="left">PermissionDenied, NoHardwareSupport</th><th align="left"> </th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">Reboot</th><th align="left"> </th><th align="left"> </th><th align="left">PermissionDenied, NoHardwareSupport</th><th align="left"> </th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">Shutdown</th><th align="left"> </th><th align="left"> </th><th align="left">PermissionDenied, NoHardwareSupport</th><th align="left"> </th></tr></thead></table></div></div><p><br class="table-break">
- </p><div class="table"><a name="id2972958"></a><p class="title"><b>Table 2. Standard signals (org.freedesktop.PowerManagement):</b></p><div class="table-contents"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" bgcolor="#F8F9FD" cellspacing="0" cellpadding="4" summary="Standard signals (org.freedesktop.PowerManagement):" border="1"><colgroup><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns="" align="left"></colgroup><thead xmlns=""><tr><th colspan="2" align="center">Name</th><th align="left">Values</th><th align="left">Description</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">OnBatteryChanged</th><th align="left">bool</th><th align="left">whether on battery status changed</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">LowBatteryChanged</th><th align="left">bool</th><th align="left">whether on low battery status changed</th></tr></thead></table></div></div><p><br class="table-break">
+ </p><div class="table"><a name="id2955521"></a><p class="title"><b>Table 2. Standard signals (org.freedesktop.PowerManagement):</b></p><div class="table-contents"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" bgcolor="#F8F9FD" cellspacing="0" cellpadding="4" summary="Standard signals (org.freedesktop.PowerManagement):" border="1"><colgroup><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns="" align="left"></colgroup><thead xmlns=""><tr><th colspan="2" align="center">Name</th><th align="left">Values</th><th align="left">Description</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">OnBatteryChanged</th><th align="left">bool</th><th align="left">whether on battery status changed</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">LowBatteryChanged</th><th align="left">bool</th><th align="left">whether on low battery status changed</th></tr></thead></table></div></div><p><br class="table-break">
</p><span class="keycap"><strong>Power management DBus inhibit interface.</strong></span><p>
-</p><div class="table"><a name="id2973067"></a><p class="title"><b>Table 3. Standard methods (org.freedesktop.PowerManagement.Inhibit):</b></p><div class="table-contents"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" bgcolor="#F8F9FD" cellspacing="0" cellpadding="4" summary="Standard methods (org.freedesktop.PowerManagement.Inhibit):" border="1"><colgroup><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns=""><col xmlns="" align="left"></colgroup><thead xmlns=""><tr><th colspan="2" align="center">Name</th><th align="left">Input parameter</th><th align="left">Return Values</th><th align="left">Errors</th><th align="left">Description</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">Inhibit</th><th align="left">string application name, string reason</th><th align="left">uint32 (random cookie)</th><th align="left"> </th><th align="left">Inhibit the power manager.</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">UnInhibit</th><th align="left">uint32 cookie</th><th align="left"> </th><th align="left">InvalidCookie</th><th align="left">Unihibit the power manager.</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">HasInhibit</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">Whether the power manager is currently inhibited or not.</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">GetInhibitors</th><th align="left"> </th><th align="left">Array of strings</th><th align="left"> </th><th align="left">List all the applications currently inhibiting the power manager (Not standard, use just for debugging)</th></tr></thead></table></div></div><p><br class="table-break">
+</p><div class="table"><a name="id2955630"></a><p class="title"><b>Table 3. Standard methods (org.freedesktop.PowerManagement.Inhibit):</b></p><div class="table-contents"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" bgcolor="#F8F9FD" cellspacing="0" cellpadding="4" summary="Standard methods (org.freedesktop.PowerManagement.Inhibit):" border="1"><colgroup><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns=""><col xmlns="" align="left"></colgroup><thead xmlns=""><tr><th colspan="2" align="center">Name</th><th align="left">Input parameter</th><th align="left">Return Values</th><th align="left">Errors</th><th align="left">Description</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">Inhibit</th><th align="left">string application name, string reason</th><th align="left">uint32 (random cookie)</th><th align="left"> </th><th align="left">Inhibit the power manager.</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">UnInhibit</th><th align="left">uint32 cookie</th><th align="left"> </th><th align="left">InvalidCookie</th><th align="left">Unihibit the power manager.</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">HasInhibit</th><th align="left"> </th><th align="left">bool</th><th align="left"> </th><th align="left">Whether the power manager is currently inhibited or not.</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">GetInhibitors</th><th align="left"> </th><th align="left">Array of strings</th><th align="left"> </th><th align="left">List all the applications currently inhibiting the power manager (Not standard, use just for debugging)</th></tr></thead></table></div></div><p><br class="table-break">
- </p><div class="table"><a name="id2973246"></a><p class="title"><b>Table 4. Standard signals (org.freedesktop.PowerManagement.Inhibit):</b></p><div class="table-contents"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" bgcolor="#F8F9FD" cellspacing="0" cellpadding="4" summary="Standard signals (org.freedesktop.PowerManagement.Inhibit):" border="1"><colgroup><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns="" align="left"></colgroup><thead xmlns=""><tr><th colspan="2" align="center">Name</th><th align="left">Values</th><th align="left">Description</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">HasInhibitChanged</th><th align="left">bool</th><th align="left">whether the inhibit status changed.</th></tr></thead></table></div></div><p><br class="table-break">
+ </p><div class="table"><a name="id2955809"></a><p class="title"><b>Table 4. Standard signals (org.freedesktop.PowerManagement.Inhibit):</b></p><div class="table-contents"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" bgcolor="#F8F9FD" cellspacing="0" cellpadding="4" summary="Standard signals (org.freedesktop.PowerManagement.Inhibit):" border="1"><colgroup><col xmlns="" align="left"><col xmlns="" align="left"><col xmlns="" align="left"></colgroup><thead xmlns=""><tr><th colspan="2" align="center">Name</th><th align="left">Values</th><th align="left">Description</th></tr></thead><thead xmlns=""><tr><th colspan="2" align="center">HasInhibitChanged</th><th align="left">bool</th><th align="left">whether the inhibit status changed.</th></tr></thead></table></div></div><p><br class="table-break">
</p><p>
In addition, <strong class="application"><code>xfce4-power-manager</code></strong> has other interfaces, but those interfaces are mainly used internally, for example the settings application uses such interface to
diff --git a/doc/C/xfce4-power-manager.xml.in b/doc/C/xfce4-power-manager.xml.in
index c1ff190e..5c7c2923 100644
--- a/doc/C/xfce4-power-manager.xml.in
+++ b/doc/C/xfce4-power-manager.xml.in
@@ -520,6 +520,26 @@ Ideally these details should go in a technical guide not the user guide, but we
<thead>
<row>
+ <entry namest="c1" nameend="c2" align="center">CanReboot</entry>
+ <entry></entry>
+ <entry>bool</entry>
+ <entry></entry>
+ <entry>whether the system is able to reboot</entry>
+</row>
+</thead>
+
+<thead>
+<row>
+ <entry namest="c1" nameend="c2" align="center">CanShutdown</entry>
+ <entry></entry>
+ <entry>bool</entry>
+ <entry></entry>
+ <entry>whether the system is able to shutdown</entry>
+</row>
+</thead>
+
+<thead>
+<row>
<entry namest="c1" nameend="c2" align="center">GetOnBattery</entry>
<entry></entry>
<entry>bool</entry>
@@ -540,10 +560,21 @@ Ideally these details should go in a technical guide not the user guide, but we
<thead>
<row>
+ <entry namest="c1" nameend="c2" align="center">GetPowerSaveStatus</entry>
+ <entry></entry>
+ <entry>bool</entry>
+ <entry></entry>
+ <entry>whether the system is running in power save mode.</entry>
+</row>
+</thead>
+
+
+<thead>
+<row>
<entry namest="c1" nameend="c2" align="center">Hibernate</entry>
<entry></entry>
<entry></entry>
- <entry>PermissionDenied, NotSupported</entry>
+ <entry>PermissionDenied, NoHardwareSupport</entry>
<entry></entry>
</row>
</thead>
@@ -553,7 +584,17 @@ Ideally these details should go in a technical guide not the user guide, but we
<entry namest="c1" nameend="c2" align="center">Suspend</entry>
<entry></entry>
<entry></entry>
- <entry>PermissionDenied, NotSupported</entry>
+ <entry>PermissionDenied, NoHardwareSupport</entry>
+ <entry></entry>
+</row>
+</thead>
+
+<thead>
+<row>
+ <entry namest="c1" nameend="c2" align="center">Reboot</entry>
+ <entry></entry>
+ <entry></entry>
+ <entry>PermissionDenied, NoHardwareSupport</entry>
<entry></entry>
</row>
</thead>
@@ -563,7 +604,7 @@ Ideally these details should go in a technical guide not the user guide, but we
<entry namest="c1" nameend="c2" align="center">Shutdown</entry>
<entry></entry>
<entry></entry>
- <entry>PermissionDenied, NotSupported</entry>
+ <entry>PermissionDenied, NoHardwareSupport</entry>
<entry></entry>
</row>
</thead>
diff --git a/src/org.freedesktop.PowerManagement.xml b/src/org.freedesktop.PowerManagement.xml
index 3080ad85..ad11a850 100644
--- a/src/org.freedesktop.PowerManagement.xml
+++ b/src/org.freedesktop.PowerManagement.xml
@@ -10,11 +10,22 @@
<method name="Shutdown">
</method>
+ <method name="Reboot">
+ </method>
+
<method name="Hibernate">
</method>
<method name="Suspend">
</method>
+
+ <method name="CanShutdown">
+ <arg type="b" name="can_shutdown" direction="out"/>
+ </method>
+
+ <method name="CanReboot">
+ <arg type="b" name="can_reboot" direction="out"/>
+ </method>
<method name="CanSuspend">
<arg type="b" name="can_suspend" direction="out"/>
@@ -24,6 +35,10 @@
<arg type="b" name="can_hibernate" direction="out"/>
</method>
+ <method name="GetPowerSaveStatus">
+ <arg type="b" name="save_power" direction="out"/>
+ </method>
+
<method name="GetOnBattery">
<arg type="b" name="on_battery" direction="out"/>
</method>
diff --git a/src/xfpm-engine.c b/src/xfpm-engine.c
index 77afd7b0..3a29d4bb 100644
--- a/src/xfpm-engine.c
+++ b/src/xfpm-engine.c
@@ -689,6 +689,9 @@ void xfpm_engine_reload_hal_objects (XfpmEngine *engine)
*/
static gboolean xfpm_engine_dbus_shutdown (XfpmEngine *engine,
GError **error);
+
+static gboolean xfpm_engine_dbus_reboot (XfpmEngine *engine,
+ GError **error);
static gboolean xfpm_engine_dbus_hibernate (XfpmEngine * engine,
GError **error);
@@ -696,6 +699,14 @@ static gboolean xfpm_engine_dbus_hibernate (XfpmEngine * engine,
static gboolean xfpm_engine_dbus_suspend (XfpmEngine * engine,
GError ** error);
+static gboolean xfpm_engine_dbus_can_reboot (XfpmEngine * engine,
+ gboolean * OUT_can_reboot,
+ GError ** error);
+
+static gboolean xfpm_engine_dbus_can_shutdown (XfpmEngine * engine,
+ gboolean * OUT_can_reboot,
+ GError ** error);
+
static gboolean xfpm_engine_dbus_can_hibernate (XfpmEngine * engine,
gboolean * OUT_can_hibernate,
GError ** error);
@@ -704,6 +715,10 @@ static gboolean xfpm_engine_dbus_can_suspend (XfpmEngine * engine,
gboolean * OUT_can_suspend,
GError ** error);
+static gboolean xfpm_engine_dbus_get_power_save_status (XfpmEngine * engine,
+ gboolean * OUT_save_power,
+ GError ** error);
+
static gboolean xfpm_engine_dbus_get_on_battery (XfpmEngine * engine,
gboolean * OUT_on_battery,
GError ** error);
@@ -761,6 +776,32 @@ static gboolean xfpm_engine_dbus_shutdown (XfpmEngine *engine,
return TRUE;
}
+static gboolean xfpm_engine_dbus_reboot (XfpmEngine *engine,
+ GError **error)
+{
+ gboolean caller_privilege;
+
+ TRACE ("Hibernate message received");
+
+ g_object_get (G_OBJECT (engine->priv->shutdown),
+ "caller-privilege", &caller_privilege,
+ NULL);
+
+ if (!caller_privilege)
+ {
+ g_set_error (error, XFPM_ERROR, XFPM_ERROR_PERMISSION_DENIED,
+ _("Permission denied"));
+ return FALSE;
+ }
+
+ if ( engine->priv->inhibited )
+ return TRUE;
+
+ xfpm_reboot (engine->priv->shutdown, NULL);
+
+ return TRUE;
+}
+
static gboolean
xfpm_engine_dbus_hibernate (XfpmEngine * engine, GError ** error)
{
@@ -781,7 +822,7 @@ xfpm_engine_dbus_hibernate (XfpmEngine * engine, GError ** error)
if (!can_hibernate)
{
- g_set_error (error, XFPM_ERROR, XFPM_ERROR_HIBERNATE_NOT_SUPPORTED,
+ g_set_error (error, XFPM_ERROR, XFPM_ERROR_NO_HARDWARE_SUPPORT,
_("Hibernate not supported"));
return FALSE;
}
@@ -810,7 +851,7 @@ xfpm_engine_dbus_suspend (XfpmEngine * engine, GError ** error)
if (!can_suspend)
{
- g_set_error (error, XFPM_ERROR, XFPM_ERROR_SUSPEND_NOT_SUPPORTED,
+ g_set_error (error, XFPM_ERROR, XFPM_ERROR_NO_HARDWARE_SUPPORT,
_("Suspend not supported"));
return FALSE;
}
@@ -821,6 +862,30 @@ xfpm_engine_dbus_suspend (XfpmEngine * engine, GError ** error)
}
static gboolean
+xfpm_engine_dbus_can_shutdown (XfpmEngine * engine,
+ gboolean * OUT_can_shutdown, GError ** error)
+{
+ TRACE ("Can shutdown message received");
+
+ g_object_get (G_OBJECT (engine->priv->shutdown),
+ "caller-privilege", OUT_can_shutdown, NULL);
+
+ return TRUE;
+}
+
+static gboolean
+xfpm_engine_dbus_can_reboot (XfpmEngine * engine,
+ gboolean * OUT_can_reboot, GError ** error)
+{
+ TRACE ("Can reboot message received");
+
+ g_object_get (G_OBJECT (engine->priv->shutdown),
+ "caller-privilege", OUT_can_reboot, NULL);
+
+ return TRUE;
+}
+
+static gboolean
xfpm_engine_dbus_can_hibernate (XfpmEngine * engine,
gboolean * OUT_can_hibernate, GError ** error)
{
@@ -842,6 +907,23 @@ xfpm_engine_dbus_can_suspend (XfpmEngine * engine,
return TRUE;
}
+static gboolean xfpm_engine_dbus_get_power_save_status (XfpmEngine * engine,
+ gboolean * OUT_save_power,
+ GError ** error)
+{
+ gboolean save_power;
+
+ TRACE ("Can power save message received");
+
+ g_object_get (G_OBJECT (engine->priv->conf),
+ POWER_SAVE_ON_BATTERY, &save_power,
+ NULL);
+
+ *OUT_save_power = save_power && engine->priv->on_battery;
+
+ return TRUE;
+}
+
static gboolean
xfpm_engine_dbus_get_on_battery (XfpmEngine * engine,
gboolean * OUT_on_battery, GError ** error)
diff --git a/src/xfpm-errors.c b/src/xfpm-errors.c
index ecbfab42..d87e56b3 100644
--- a/src/xfpm-errors.c
+++ b/src/xfpm-errors.c
@@ -46,10 +46,8 @@ xfpm_error_get_type (void)
{
{ XFPM_ERROR_UNKNOWN, "XFPM_ERROR_UNKNOWN", "Unknown" },
{ XFPM_ERROR_PERMISSION_DENIED, "XFPM_ERROR_PERMISSION_DENIED", "PermissionDenied" },
- { XFPM_ERROR_SUSPEND_NOT_SUPPORTED, "XFPM_ERROR_SUSPEND_NOT_SUPPORTED", "SuspendNotSupported" },
- { XFPM_ERROR_HIBERNATE_NOT_SUPPORTED, "XFPM_ERROR_HIBERNATE_NOT_SUPPORTED", "HibernateNotSupported" },
- { XFPM_ERROR_SUSPEND_HYBRID_NOT_SUPPORTED, "XFPM_ERROR_SUSPEND_HYBRID_NOT_SUPPORTED", "SuspendHybridNotSupported" },
- { XFPM_ERROR_INVALID_COOKIE, "XFPM_ERROR_INVALID_COOKIE", "InvalidCookie" },
+ { XFPM_ERROR_NO_HARDWARE_SUPPORT, "XFPM_ERROR_HARDWARE_NOT_SUPPORT", "NoHardwareSupport" },
+ { XFPM_ERROR_COOKIE_NOT_FOUND, "XFPM_ERROR_COOKIE_NOT_FOUND", "CookieNotFound" },
{ XFPM_ERROR_INVALID_ARGUMENTS, "XFPM_ERROR_INVALID_ARGUMENTS", "InvalidArguments" },
{ XFPM_ERROR_HAL_DISCONNECTED, "XFPM_ERROR_HAL_DISCONNECTED", "HalDisconnected" },
{ XFPM_ERROR_SLEEP_FAILED, "XFPM_ERROR_SLEEP_FAILED", "SleepFailed" },
diff --git a/src/xfpm-errors.h b/src/xfpm-errors.h
index b30716c1..7100a1c4 100644
--- a/src/xfpm-errors.h
+++ b/src/xfpm-errors.h
@@ -33,10 +33,8 @@ typedef enum
{
XFPM_ERROR_UNKNOWN = 0,
XFPM_ERROR_PERMISSION_DENIED,
- XFPM_ERROR_SUSPEND_NOT_SUPPORTED,
- XFPM_ERROR_HIBERNATE_NOT_SUPPORTED,
- XFPM_ERROR_SUSPEND_HYBRID_NOT_SUPPORTED,
- XFPM_ERROR_INVALID_COOKIE,
+ XFPM_ERROR_NO_HARDWARE_SUPPORT,
+ XFPM_ERROR_COOKIE_NOT_FOUND,
XFPM_ERROR_INVALID_ARGUMENTS,
XFPM_ERROR_HAL_DISCONNECTED,
XFPM_ERROR_SLEEP_FAILED
diff --git a/src/xfpm-inhibit.c b/src/xfpm-inhibit.c
index c92dc96d..80d49843 100644
--- a/src/xfpm-inhibit.c
+++ b/src/xfpm-inhibit.c
@@ -356,7 +356,7 @@ static gboolean xfpm_inhibit_un_inhibit (XfpmInhibit *inhibit,
if (!xfpm_inhibit_remove_application_by_cookie (inhibit, IN_cookie))
{
- g_set_error (error, XFPM_ERROR, XFPM_ERROR_INVALID_COOKIE, _("Invalid cookie"));
+ g_set_error (error, XFPM_ERROR, XFPM_ERROR_COOKIE_NOT_FOUND, _("Invalid cookie"));
return FALSE;
}
diff --git a/src/xfpm-session.c b/src/xfpm-session.c
index 5b18f086..d72b314d 100644
--- a/src/xfpm-session.c
+++ b/src/xfpm-session.c
@@ -238,6 +238,16 @@ gboolean xfpm_session_shutdown (XfpmSession *session)
return xfpm_session_shutdown_internal (session, type, allow_save);
}
+gboolean xfpm_session_reboot (XfpmSession *session)
+{
+ gboolean allow_save = TRUE;
+ XfsmShutdownType type = XFSM_SHUTDOWN_REBOOT;
+
+ g_return_val_if_fail (XFPM_IS_SESSION (session), FALSE);
+
+ return xfpm_session_shutdown_internal (session, type, allow_save);
+}
+
gboolean xfpm_session_ask_shutdown (XfpmSession *session)
{
gboolean allow_save = TRUE;
diff --git a/src/xfpm-session.h b/src/xfpm-session.h
index 88f4f71d..133d7053 100644
--- a/src/xfpm-session.h
+++ b/src/xfpm-session.h
@@ -57,6 +57,8 @@ void xfpm_session_quit (XfpmSession *session);
gboolean xfpm_session_shutdown (XfpmSession *session);
+gboolean xfpm_session_reboot (XfpmSession *session);
+
gboolean xfpm_session_ask_shutdown (XfpmSession *session);
G_END_DECLS
diff --git a/src/xfpm-shutdown.c b/src/xfpm-shutdown.c
index 991eb918..df76d2fb 100644
--- a/src/xfpm-shutdown.c
+++ b/src/xfpm-shutdown.c
@@ -413,13 +413,37 @@ void xfpm_shutdown (XfpmShutdown *shutdown, GError **error)
xfpm_send_message_to_network_manager ("sleep");
+ //FIXME: Shutdown the system without asking the session to do.
if ( !xfpm_session_shutdown (shutdown->priv->session) )
- xfpm_shutdown_internal (dbus_g_connection_get_connection(shutdown->priv->bus), "Shutdown", NULL);
-
+ {
+ if ( !xfpm_shutdown_internal (dbus_g_connection_get_connection(shutdown->priv->bus), "Shutdown", NULL))
+ xfpm_send_message_to_network_manager ("wake");
+ }
+
shutdown->priv->block_shutdown = FALSE;
- xfpm_send_message_to_network_manager ("wake");
}
+void xfpm_reboot (XfpmShutdown *shutdown, GError **error)
+{
+ g_return_if_fail (XFPM_IS_SHUTDOWN(shutdown));
+
+ if ( G_UNLIKELY (shutdown->priv->connected == FALSE) )
+ {
+ g_set_error (error, XFPM_ERROR, XFPM_ERROR_HAL_DISCONNECTED, _("HAL daemon is currently not connected"));
+ shutdown->priv->block_shutdown = FALSE;
+ return;
+ }
+
+ xfpm_send_message_to_network_manager ("sleep");
+ if ( !xfpm_session_reboot (shutdown->priv->session) )
+ {
+ if ( !xfpm_shutdown_internal (dbus_g_connection_get_connection(shutdown->priv->bus), "Reboot", NULL))
+ xfpm_send_message_to_network_manager ("wake");
+ }
+
+ shutdown->priv->block_shutdown = FALSE;
+}
+
void xfpm_hibernate (XfpmShutdown *shutdown, GError **error)
{
GError *error_internal = NULL;
@@ -483,7 +507,6 @@ void xfpm_suspend (XfpmShutdown *shutdown, GError **error)
g_error_free (error_internal);
}
g_signal_emit (G_OBJECT (shutdown), signals [WAKING_UP], 0);
-
xfpm_send_message_to_network_manager ("wake");
}
diff --git a/src/xfpm-shutdown.h b/src/xfpm-shutdown.h
index 102ec43a..f230558e 100644
--- a/src/xfpm-shutdown.h
+++ b/src/xfpm-shutdown.h
@@ -65,6 +65,9 @@ gboolean xfpm_shutdown_add_callback (XfpmShutdown *shutdown,
void xfpm_shutdown (XfpmShutdown *shutdown,
GError **error);
+void xfpm_reboot (XfpmShutdown *shutdown,
+ GError **error);
+
void xfpm_hibernate (XfpmShutdown *shutdown,
GError **error);