diff options
author | Bastien Nocera <hadess@hadess.net> | 2013-10-17 00:35:22 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2013-10-17 00:37:29 +0200 |
commit | 45c4b372775505e1e8f2f2bfa0c7395760bf52a4 (patch) | |
tree | 6ec5d928186535ad3999143c6a949def5484ced6 /libupower-glib | |
parent | 34951c91ffd3d11537c03909723dcb03bbcc6221 (diff) | |
download | upower-45c4b372775505e1e8f2f2bfa0c7395760bf52a4.tar.gz |
lib: Add up_client_get_display_device()
Add a helper to get to the display device.
Diffstat (limited to 'libupower-glib')
-rw-r--r-- | libupower-glib/up-client.c | 24 | ||||
-rw-r--r-- | libupower-glib/up-client.h | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c index 7243c8f..ec9434d 100644 --- a/libupower-glib/up-client.c +++ b/libupower-glib/up-client.c @@ -122,6 +122,30 @@ up_client_get_devices (UpClient *client) } /** + * up_client_get_display_device: + * @client: a #UpClient instance. + * + * Get the composite display device. + * Return value: (transfer full) a #UpClient object, or %NULL on error. + * + * Since: 1.0 + **/ +UpDevice * +up_client_get_display_device (UpClient *client) +{ + gboolean ret; + UpDevice *device; + + device = up_device_new (); + ret = up_device_set_object_path_sync (device, "/org/freedesktop/UPower/devices/DisplayDevice", NULL, NULL); + if (!ret) { + g_object_unref (G_OBJECT (device)); + return NULL; + } + return device; +} + +/** * up_client_get_daemon_version: * @client: a #UpClient instance. * diff --git a/libupower-glib/up-client.h b/libupower-glib/up-client.h index 3c389d0..0c58a3d 100644 --- a/libupower-glib/up-client.h +++ b/libupower-glib/up-client.h @@ -80,6 +80,7 @@ UpClient *up_client_new (void); gboolean up_client_enumerate_devices_sync (UpClient *client, GCancellable *cancellable, GError **error); +UpDevice * up_client_get_display_device (UpClient *client); /* accessors */ GPtrArray *up_client_get_devices (UpClient *client); |