summaryrefslogtreecommitdiff
path: root/libupower-glib
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-10-17 09:04:03 +0200
committerBastien Nocera <hadess@hadess.net>2013-10-17 09:04:03 +0200
commitdb31456921f9977d8fef8ed1dcee6517107358ff (patch)
treedcd098e7365d3d1b2fb8bc2170a4cf29c1a92a3c /libupower-glib
parenta7870229ee32616ac9e55edbab1045d1dac171be (diff)
downloadupower-db31456921f9977d8fef8ed1dcee6517107358ff.tar.gz
all: Add GetCriticalAction daemon method
This allows desktop front-ends to get which action will actually be taken when we hit critical battery. This is not a property as availability of actions might change over the course of the run of the system, and we didn't want to make unnecessary D-Bus calls on startup.
Diffstat (limited to 'libupower-glib')
-rw-r--r--libupower-glib/up-client.c25
-rw-r--r--libupower-glib/up-client.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c
index 2169a59..4bdfa91 100644
--- a/libupower-glib/up-client.c
+++ b/libupower-glib/up-client.c
@@ -145,6 +145,31 @@ up_client_get_display_device (UpClient *client)
}
/**
+ * up_client_get_critical_action:
+ * @client: a #UpClient instance.
+ *
+ * Gets a string representing the configured critical action,
+ * depending on availability.
+ *
+ * Return value: the action name, or %NULL on error.
+ *
+ * Since: 1.0
+ **/
+char *
+up_client_get_critical_action (UpClient *client)
+{
+ char *action;
+
+ g_return_val_if_fail (UP_IS_CLIENT (client), NULL);
+ if (!up_client_glue_call_get_critical_action_sync (client->priv->proxy,
+ &action,
+ NULL, NULL)) {
+ return NULL;
+ }
+ return action;
+}
+
+/**
* up_client_get_daemon_version:
* @client: a #UpClient instance.
*
diff --git a/libupower-glib/up-client.h b/libupower-glib/up-client.h
index 0f502d9..151f29b 100644
--- a/libupower-glib/up-client.h
+++ b/libupower-glib/up-client.h
@@ -81,6 +81,7 @@ gboolean up_client_enumerate_devices_sync (UpClient *client,
GCancellable *cancellable,
GError **error);
UpDevice * up_client_get_display_device (UpClient *client);
+char * up_client_get_critical_action (UpClient *client);
/* accessors */
GPtrArray *up_client_get_devices (UpClient *client);