summaryrefslogtreecommitdiff
path: root/src/up-daemon.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2011-02-02 13:44:09 +0000
committerRichard Hughes <richard@hughsie.com>2011-02-02 13:44:09 +0000
commitb31de44eeeacb3473fe83d8f4cd3f6a5afc9ae42 (patch)
tree61b33e8032d2e94b3b1bc0c5b476a0052190cc3d /src/up-daemon.c
parent6343de2dd658d81935481ba4063a71743e379b53 (diff)
Add a LidForceSleep property to ensure that we don't melt any laptops
We still need to add the DMI quirks, but I'm waiting for the community to supply them now.
Diffstat (limited to 'src/up-daemon.c')
-rw-r--r--src/up-daemon.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/up-daemon.c b/src/up-daemon.c
index dbdb488..baafd5a 100644
--- a/src/up-daemon.c
+++ b/src/up-daemon.c
@@ -51,6 +51,7 @@ enum
PROP_ON_LOW_BATTERY,
PROP_LID_IS_CLOSED,
PROP_LID_IS_PRESENT,
+ PROP_LID_FORCE_SLEEP,
PROP_IS_DOCKED,
PROP_LAST
};
@@ -79,6 +80,7 @@ struct UpDaemonPrivate
gboolean on_low_battery;
gboolean lid_is_closed;
gboolean lid_is_present;
+ gboolean lid_force_sleep;
gboolean is_docked;
gboolean kernel_can_suspend;
gboolean kernel_can_hibernate;
@@ -763,6 +765,18 @@ up_daemon_set_lid_is_closed (UpDaemon *daemon, gboolean lid_is_closed)
}
/**
+ * up_daemon_set_lid_force_sleep:
+ **/
+void
+up_daemon_set_lid_force_sleep (UpDaemon *daemon, gboolean lid_force_sleep)
+{
+ UpDaemonPrivate *priv = daemon->priv;
+ g_debug ("lid_force_sleep = %s", lid_force_sleep ? "yes" : "no");
+ priv->lid_force_sleep = lid_force_sleep;
+ g_object_notify (G_OBJECT (daemon), "lid-enforce-sleep");
+}
+
+/**
* up_daemon_set_lid_is_present:
**/
void
@@ -1150,6 +1164,9 @@ up_daemon_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe
case PROP_LID_IS_PRESENT:
g_value_set_boolean (value, priv->lid_is_present);
break;
+ case PROP_LID_FORCE_SLEEP:
+ g_value_set_boolean (value, priv->lid_force_sleep);
+ break;
case PROP_IS_DOCKED:
g_value_set_boolean (value, priv->is_docked);
break;
@@ -1250,6 +1267,14 @@ up_daemon_class_init (UpDaemonClass *klass)
G_PARAM_READABLE));
g_object_class_install_property (object_class,
+ PROP_LID_FORCE_SLEEP,
+ g_param_spec_boolean ("lid-enforce-sleep",
+ "Enforce sleep on lid close",
+ "If this computer has to sleep on lid close",
+ FALSE,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class,
PROP_IS_DOCKED,
g_param_spec_boolean ("is-docked",
"Is docked",