upower/libupower-glib
Martin Pitt 932a6a39e3 lib: Add proper error and cancellable handling to UpClient constructor
A GObject's _init() should never fail or block, but this is currently the case
as up_client_init() connects to upowerd on D-Bus. Convert this to the GInitable
interface and provide a new constructor up_client_new_full() which accepts a
GCancellable and GError, so that clients can do proper error handling
and reporting.

This changes up_client_new() to return NULL when connecting to upowerd fails.
This provides a more well-defined behaviour in this case as clients can check
for this and our methods stop segfaulting as they have checks like

   g_return_val_if_fail (UP_IS_CLIENT (client), ...)

Previously we returned a valid object, but trying to call any method on it
segfaulted due to the NULL D-Bus proxy, so client code had no chance to check
whether the UpClient object was really valid.

https://bugs.freedesktop.org/show_bug.cgi?id=95350
2016-05-18 14:58:28 +02:00
..
Makefile.am Support g_autoptr() for all libupower-glib object types 2015-09-15 12:33:44 +01:00
up-autocleanups.h Support g_autoptr() for all libupower-glib object types 2015-09-15 12:33:44 +01:00
up-client.c lib: Add proper error and cancellable handling to UpClient constructor 2016-05-18 14:58:28 +02:00
up-client.h lib: Add proper error and cancellable handling to UpClient constructor 2016-05-18 14:58:28 +02:00
up-device.c Share generated code between daemon and library 2015-07-29 13:38:13 +01:00
up-device.h all: Remove *changed signals 2013-10-17 14:25:25 +02:00
up-history-item.c lib: No need to set private members to NULL 2013-10-14 10:42:55 +02:00
up-history-item.h Convert the daemon to using objects from libupower-glib, not devkit-power-gobject 2010-03-26 12:49:01 +00:00
up-stats-item.c lib: No need to set private members to NULL 2013-10-14 10:42:55 +02:00
up-stats-item.h Update the Free Software Foundation address 2010-01-27 16:27:15 +00:00
up-types.c daemon: Add new WarningLevel "Discharging" 2013-10-14 14:38:32 +02:00
up-types.h daemon: Add new WarningLevel "Discharging" 2013-10-14 14:38:32 +02:00
up-version.h.in Update the Free Software Foundation address 2010-01-27 16:27:15 +00:00
up-wakeup-item.c lib: No need to set private members to NULL 2013-10-14 10:42:55 +02:00
up-wakeup-item.h Update the Free Software Foundation address 2010-01-27 16:27:15 +00:00
up-wakeups.c Share generated code between daemon and library 2015-07-29 13:38:13 +01:00
up-wakeups.h Use GCancellable in libupower-glib so we can eventually get to GIO async methods without breaking future API 2010-02-05 09:41:06 +00:00
upower.h Support g_autoptr() for all libupower-glib object types 2015-09-15 12:33:44 +01:00