summaryrefslogtreecommitdiff
path: root/libupower-glib
Commit message (Collapse)AuthorAgeFilesLines
* build: Fix up-daemon-generated.h not being found on distcheckBastien Nocera2018-10-251-0/+2
|
* build: Fix out-of-tree buildBastien Nocera2018-10-021-1/+1
| | | | | | | | | The generated headers for the dbus service are in the build dir, not the source dir. ../../libupower-glib/up-client.c:39:10: fatal error: up-daemon-generated.h: No such file or directory #include "up-daemon-generated.h" ^~~~~~~~~~~~~~~~~~~~~~~
* lib: UpClient: up_client_get_display_device returns a UpDeviceGuido Günther2018-09-301-1/+1
| | | | It doesn't return a UpClient.
* lib: UpClient: Fix stray '%'Guido Günther2018-09-301-1/+1
|
* lib: Use @see_also instead of "See also"Guido Günther2018-09-308-16/+8
| | | | | | This ensures consistent rendering. See https://developer.gnome.org/gtk-doc-manual/stable/documenting_sections.html.en
* lib: Work-around to fix gtk-doc's type detectionGuido Günther2018-09-305-21/+13
| | | | | | | | | | Without the braces on the same line gtk-doc adds function pointers as functions to the documentation and fails to detect the types as GObjects. This fixes object names in the index and cross refs. See the examples in https://developer.gnome.org/gtk-doc-manual/stable/documenting_symbols.html.en
* lib: Add a new version of up_client_get_devices which unrefs contentsRobert Ancell2018-05-312-3/+25
| | | | | | The existing function didn't set the free function on the GPtrArray. This means a libupower user can easily make a mistake in the reference counting of the array contents.
* lib: Mention that battery level is preferred when present14-lib-add-a-new-version-of-up_client_get_devices-which-unrefs-contentsBastien Nocera2018-04-191-6/+16
| | | | | | And print "should be ignored" next to the percentage. https://bugs.freedesktop.org/show_bug.cgi?id=97484
* lib: Simplify resource destructionBastien Nocera2018-04-183-15/+7
| | | | Use g_clear_pointer() and g_clear_object() when possible.
* lib: Fix warnings when D-Bus related properties changeBastien Nocera2018-03-022-1/+13
| | | | | | | | | | | | | | | When UPower would appear, or disappear, we'd get warnings like: g_object_notify: object class 'UpDevice' has no property named 'g-name-owner' or: g_object_notify: object class 'UpClient' has no property named 'g-name-owner' This was caused by the property proxying added in 7531dbd and 28438a7 being too lax about which properties it tried to proxy, which included ones that didn't apply to the object types in question. See https://bugs.freedesktop.org/show_bug.cgi?id=43001 https://bugs.freedesktop.org/show_bug.cgi?id=102350
* docs: Better documentation for the BatteryLevel propBastien Nocera2017-10-311-2/+10
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=103361
* lib: Fix API docs for *-level propertiesBastien Nocera2017-09-081-2/+2
| | | | | One was referencing a non-existent enum member, the other was missing a link altogether.
* lib: Add UP_DEVICE_KIND_GAMING_INPUT for gaming devicesBastien Nocera2017-08-313-2/+9
| | | | | | | | Joypads, joysticks, dance mats, paddles, Wiimotes, steering wheels, tractor cabin simulators, pedals, yokes, breathing controllers, and, hmm, etc. https://bugs.freedesktop.org/show_bug.cgi?id=102493
* lib: Simplify string checksBastien Nocera2017-04-101-31/+31
| | | | | | | | | | | We don't need to protect against NULL values, we already do at the start of the function. Created with: :%s,g_strcmp0\(.*\) == 0,g_str_equal \1, Mentioned in: https://bugs.freedesktop.org/show_bug.cgi?id=100359#c14
* all: Add BatteryLevel propertyBastien Nocera2017-04-062-1/+27
| | | | | | | | | | Export approximate battery levels that devices can use, exported by the kernel as POWER_SUPPLY_CAPACITY_LEVEL_* values. This avoids bizarrely accurate values showing up in UIs when we only have ok/warning levels of accuracy in some cases. https://bugs.freedesktop.org/show_bug.cgi?id=100359
* lib: Add more members to UpDeviceLevel structBastien Nocera2017-04-062-1/+16
| | | | | | | | | | Those levels will not be used to cover warning levels, but approximate battery levels that devices can use, exported by the kernel as POWER_SUPPLY_CAPACITY_LEVEL_* values. See linux/power_supply.h https://bugs.freedesktop.org/show_bug.cgi?id=100359
* build: Fix -Wformat-y2k compilation errorsBastien Nocera2016-06-081-0/+3
| | | | The strings are user visible strings, so this isn't a y2k problem.
* lib: Remove hidden singleton instanceMartin Pitt2016-05-181-9/+1
| | | | | | | | | | GObject _new constructors should always return a new pointer and not do anything else than g_{object,initable}_new(). Drop the internal up_client_object singleton instance. This simplifies the code and makes the code robust with multiple threads. Side issue in https://bugs.freedesktop.org/show_bug.cgi?id=95350
* lib: Add proper error and cancellable handling to UpClient constructorMartin Pitt2016-05-182-22/+67
| | | | | | | | | | | | | | | | | | | | 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
* Support g_autoptr() for all libupower-glib object typesKalev Lember2015-09-153-0/+43
| | | | | | | | This allows using e.g. g_autoptr(UpDevice) in other programs, but does not make upower itself use g_autoptr, or require a new enough glib to support it. Signed-off-by: Richard Hughes <richard@hughsie.com>
* Share generated code between daemon and libraryCosimo Cecchi2015-07-294-201/+162
| | | | | Since we use the same GDBus code in libupower-glib and the daemon, auto-generate a private library that can be used by both.
* lib: Fix memory leak in up_client_get_devices()Bastien Nocera2015-06-261-2/+2
| | | | | When up_client_get_devices() fails to contact the D-Bus daemon, don't leak the newly created array.
* lib: Fix crash on uninitialized variantVlad Orlov2015-03-131-2/+2
| | | | | | | | | Initialize the GVariant* pointers, so that they aren't uninitialized when jumping to "out:" and unref'ing them. https://bugs.freedesktop.org/show_bug.cgi?id=89476 https://bugs.debian.org/774546 https://bugs.launchpad.net/ubuntu-mate/+bug/1428337
* Do not print a critical warning when misusing up_device_set_object_path_sync()Richard Hughes2014-05-201-2/+11
|
* all: Remove IsDocked propertyBastien Nocera2014-05-072-38/+0
| | | | | | | Removes the deprecated (for not very long) property, before we do a 1.0 release. https://bugs.freedesktop.org/show_bug.cgi?id=78380
* lib: Fix API doc for up_client_get_on_battery()Bastien Nocera2014-05-071-1/+1
|
* lib: Hard-code the IsDocked valueBastien Nocera2014-05-071-5/+6
|
* lib: Fix typo in g-i annotationBastien Nocera2014-04-231-1/+1
| | | | Missing colon.
* lib: Fix segfault on getting property when daemon is not runningMartin Pitt2013-11-081-0/+3
| | | | | This fixes "upower --version" when the daemon is not running, and thus the client proxy is NULL.
* lib: Fix possible warning when type changesBastien Nocera2013-10-171-1/+4
| | | | | UpDevice on the daemon side has a "type" property, but the libupower-glib object has a "kind" type instead. Translate that.
* lib: Fix compile-time warningBastien Nocera2013-10-171-1/+1
|
* lib: Remove up_client_enumerate_devices_sync()Bastien Nocera2013-10-172-95/+41
| | | | | | | | | | | | And make device-removed send an object path, not a UpDevice. This means that we don't keep all the remote devices as local UpDevices object, getting woken up any time any of them have a property changed, without anybody listening. This should greatly cut down on the wakeups on the client side, especially for applications that only use a small portion of the API like the "on-battery" or "warning-level" properties.
* all: Remove *changed signalsBastien Nocera2013-10-174-88/+0
| | | | | | | | | Now that we send out PropertiesChanged signals (on the daemon side) and "notify" signals (on the client side), there's no need for the all encompassing DeviceChanged and Changed signals. They would have woken up any client, even if they were not interested in receiving the signals.
* lib: Proxy notify changes from UpDevice glueBastien Nocera2013-10-171-2/+3
|
* lib: Simplify proxying glue properties in UpClientBastien Nocera2013-10-171-14/+2
|
* all: Add GetCriticalAction daemon methodBastien Nocera2013-10-172-0/+26
| | | | | | | | | 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.
* all: Remove WarningLevel from the daemon propertiesBastien Nocera2013-10-172-37/+0
| | | | | | The WarningLevel property just replicated the warning level on the display device, or at least should have. So we fix the latter to remove the former.
* lib: Trim properties when printing the display deviceBastien Nocera2013-10-171-7/+14
|
* lib: Add up_client_get_display_device()Bastien Nocera2013-10-172-0/+25
| | | | Add a helper to get to the display device.
* lib: Remove unneeded up_client_get_properties_sync()Bastien Nocera2013-10-172-25/+0
| | | | | It doesn't do anything, and we already broke the ABI by removing some functions, so remove this as well.
* lib: Fix compilationBastien Nocera2013-10-151-2/+2
|
* lib: Use slices to allocate cached propertiesBastien Nocera2013-10-151-2/+2
| | | | Saves on memory fragmentation.
* lib: Print property name when cached property doesn't existBastien Nocera2013-10-151-1/+1
|
* lib: Cache property values correctlyBastien Nocera2013-10-151-1/+2
| | | | This is cleaner.
* daemon: Add new WarningLevel "Discharging"Bastien Nocera2013-10-142-0/+5
| | | | | | When UPSes are discharging, we should have a warning already, as it means that mains power has been lost to the UPS (though not to the computer).
* lib: Add support for the IconName propertyBastien Nocera2013-10-141-0/+22
|
* lib: Emit notify:: signalsBastien Nocera2013-10-141-0/+28
| | | | | | In the UpClient object. https://bugs.freedesktop.org/show_bug.cgi?id=43001
* lib: up_device_to_text() won't work for fake devicesBastien Nocera2013-10-141-0/+1
| | | | | For now, up_device_to_text() won't work for devices that aren't backed by a UPower device.
* lib: Make it possible to create local UpDevicesBastien Nocera2013-10-141-0/+41
| | | | | | | | | gnome-settings-daemon creates a composite UpDevice that's not backed by any real D-Bus object in UPower, so we shouldn't try and poke the inexistant proxy in this case. We'll cache the properties that the caller sets in this case, but will not support sending back default/unset values.
* lib: Update for property removal and additionsBastien Nocera2013-10-142-21/+22
| | | | Remove on-low-battery and add warning-level daemon properties.