lib: Add up_client_get_display_device()

Add a helper to get to the display device.
This commit is contained in:
Bastien Nocera 2013-10-17 00:35:22 +02:00
parent 34951c91ff
commit 45c4b37277
2 changed files with 25 additions and 0 deletions

View file

@ -121,6 +121,30 @@ up_client_get_devices (UpClient *client)
return g_ptr_array_ref (client->priv->array);
}
/**
* 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.

View file

@ -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);