lib: Add up_client_new_session()

To create a UpClient that will listen on the session bus.
This commit is contained in:
Bastien Nocera 2019-10-18 17:40:36 +02:00
parent 6a8715ce98
commit 3e3fa04ffb
2 changed files with 18 additions and 0 deletions

View file

@ -611,3 +611,20 @@ up_client_new (void)
return client;
}
/**
* up_client_new_session:
*
* Creates a new #UpClient object that will listen to UPower data on the session
* bus rather than on the system bus.
*
* Return value: a new UpClient object, or %NULL on failure.
*
* Since: 0.9.11
**/
UpClient *
up_client_new_session (GCancellable *cancellable, GError **error)
{
return g_initable_new (UP_TYPE_CLIENT, cancellable, error,
"bus-type", G_BUS_TYPE_SESSION,
NULL);
}

View file

@ -73,6 +73,7 @@ typedef struct {
GType up_client_get_type (void);
UpClient *up_client_new (void);
UpClient *up_client_new_full (GCancellable *cancellable, GError **error);
UpClient *up_client_new_session (GCancellable *cancellable, GError **error);
/* sync versions */
UpDevice * up_client_get_display_device (UpClient *client);