Commit graph

86 commits

Author SHA1 Message Date
Martin Pitt
0d64bbddaa lib: Fix segfault on getting property when daemon is not running
This fixes "upower --version" when the daemon is not running, and thus the
client proxy is NULL.
2013-11-08 14:59:50 +01:00
Bastien Nocera
aa62f6a15c lib: Fix possible warning when type changes
UpDevice on the daemon side has a "type" property, but the
libupower-glib object has a "kind" type instead. Translate that.
2013-10-17 23:20:22 +02:00
Bastien Nocera
3063bdaf44 lib: Fix compile-time warning 2013-10-17 14:51:07 +02:00
Bastien Nocera
5f43bb78f7 lib: Remove up_client_enumerate_devices_sync()
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.
2013-10-17 14:36:35 +02:00
Bastien Nocera
0010e93251 all: Remove *changed signals
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.
2013-10-17 14:25:25 +02:00
Bastien Nocera
595d72f6b6 lib: Proxy notify changes from UpDevice glue 2013-10-17 12:37:29 +02:00
Bastien Nocera
c33528da7a lib: Simplify proxying glue properties in UpClient 2013-10-17 12:36:44 +02:00
Bastien Nocera
db31456921 all: Add GetCriticalAction daemon method
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.
2013-10-17 09:04:03 +02:00
Bastien Nocera
b2f72dd69a all: Remove WarningLevel from the daemon properties
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.
2013-10-17 00:57:27 +02:00
Bastien Nocera
a76eaeddb9 lib: Trim properties when printing the display device 2013-10-17 00:45:26 +02:00
Bastien Nocera
45c4b37277 lib: Add up_client_get_display_device()
Add a helper to get to the display device.
2013-10-17 00:37:29 +02:00
Bastien Nocera
34951c91ff lib: Remove unneeded up_client_get_properties_sync()
It doesn't do anything, and we already broke the ABI by removing
some functions, so remove this as well.
2013-10-17 00:37:20 +02:00
Bastien Nocera
85ce906bf2 lib: Fix compilation 2013-10-15 16:04:21 +02:00
Bastien Nocera
677f2f4da7 lib: Use slices to allocate cached properties
Saves on memory fragmentation.
2013-10-15 15:51:55 +02:00
Bastien Nocera
4079ba8272 lib: Print property name when cached property doesn't exist 2013-10-15 15:51:00 +02:00
Bastien Nocera
d7d215a4b6 lib: Cache property values correctly
This is cleaner.
2013-10-15 15:50:31 +02:00
Bastien Nocera
b446cac8f6 daemon: Add new WarningLevel "Discharging"
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).
2013-10-14 14:38:32 +02:00
Bastien Nocera
d2484d4ec1 lib: Add support for the IconName property 2013-10-14 11:06:53 +02:00
Bastien Nocera
28438a7672 lib: Emit notify:: signals
In the UpClient object.

https://bugs.freedesktop.org/show_bug.cgi?id=43001
2013-10-14 11:06:53 +02:00
Bastien Nocera
e0fb5078bd lib: up_device_to_text() won't work for fake devices
For now, up_device_to_text() won't work for devices that aren't
backed by a UPower device.
2013-10-14 10:42:56 +02:00
Bastien Nocera
869050d699 lib: Make it possible to create local UpDevices
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.
2013-10-14 10:42:56 +02:00
Bastien Nocera
858ab85f95 lib: Update for property removal and additions
Remove on-low-battery and add warning-level daemon properties.
2013-10-14 10:42:56 +02:00
Bastien Nocera
9c27c42a99 lib: Fix alignment of "online" in device dump 2013-10-14 10:42:56 +02:00
Bastien Nocera
493c2192a2 lib: Add warning-level device property 2013-10-14 10:42:56 +02:00
Bastien Nocera
5423adab89 lib: Add UpDeviceLevel enum 2013-10-14 10:42:56 +02:00
Bastien Nocera
8c83871f10 lib: Remove dbus-glib from the dependencies
libupower-glib now uses GDBus.
2013-10-14 10:42:56 +02:00
Bastien Nocera
5adf4c1e20 lib: Port UpWakeUps to GDBus
Using the new proxy.
2013-10-14 10:42:56 +02:00
Bastien Nocera
b989cad776 lib: Port UpDevice to GDBus
Using the new proxy.
2013-10-14 10:42:55 +02:00
Bastien Nocera
c590354d0a lib: No need to set private members to NULL
GObject already makes sure of that for us.
2013-10-14 10:42:55 +02:00
Bastien Nocera
65c84120f9 lib: Port UpClient to GDBus
Using the new proxy.
2013-10-14 10:42:55 +02:00
Bastien Nocera
760d294a34 lib: Build the new D-Bus glue 2013-10-14 10:42:55 +02:00
Bastien Nocera
a3627b8227 lib: Add autogenerated glue to the daemon 2013-10-14 10:42:55 +02:00
Bastien Nocera
d10cc97cbb Remove QoS interface
It was added for some workloads, but ill-suited and never really
got traction. Using cgroups to manage the resources of particular
services (using systemd), or something separate like rtkit is
a better bet.
2013-10-14 10:42:55 +02:00
Bastien Nocera
c842f1a53e Remove obsolete battery recall properties
The recalls for that broken batch of Sony batteries dates back from
2006. All the batteries that could have been recalled have now
been recalled, and somebody particularly interested in supporting
them can match the batteries using the old rules file, in a
user session or a separate daemon.
2013-10-14 10:42:55 +02:00
Bastien Nocera
030e2c9d36 lib: Remove deprecated features
All this is now handled by logind.
2013-10-14 10:42:55 +02:00
Bastien Nocera
ad7e809d4d lib: Simplify _new() functions
No need to use a temporary variable.
2013-10-14 10:37:03 +02:00
Bastien Nocera
f926ee488f lib: Simplify _to_string() calls 2013-10-14 10:36:13 +02:00
Bastien Nocera
66da41ceac lib: Add missing "element-type" introspection metadata
https://bugs.freedesktop.org/show_bug.cgi?id=55419
2013-10-14 09:58:22 +02:00
Bastien Nocera
fc5793e742 lib: Fix crasher calling _about_to_sleep_sync()
https://bugs.freedesktop.org/show_bug.cgi?id=54976
2013-10-13 00:49:24 +02:00
Bastien Nocera
d43ab28a29 lib: Fix a small memory leak
The bus was never unreferenced in the UpWakeups object.
2013-10-10 18:59:08 +02:00
Bastien Nocera
e4858d9434 up-client: Really don't overwrite retval with prop values
db89e5a32b was incomplete and
"ret" was being used instead of prop_val to set some of those
properties. It's likely your laptop would have been seen as
docked for example.
2013-10-10 18:32:41 +02:00
Martin Pitt
03c4abbfb5 libupower-glib: Fix error handling
In up_client_get_properties_sync(), don't set the passed GError** to NULL,
instead set the actual pointed-to GError* to NULL by default.

Fixes proper error reporting back to the client if something does fail.
2013-10-08 17:02:57 +02:00
Bastien Nocera
ecc4e379cc up-client: Don't error out gathering deprecated properties
We would error out when trying to get properties that are
disabled by default (deprecated). Ignore those properties
when building without the deprecations.

This is still broken if the library is built with the deprecations
enabled, but not the daemon isn't, but that's an edge case.

https://bugs.freedesktop.org/show_bug.cgi?id=70283

Signed-off-by: Martin Pitt <martinpitt@gnome.org>
2013-10-08 16:47:30 +02:00
Bastien Nocera
db89e5a32b up-client: Don't overwrite retval with property values
If one of the properties is FALSE, we'll end up return FALSE
without setting an error (and making the caller crash if they
expect an error being filled in).

https://bugs.freedesktop.org/show_bug.cgi?id=70283

Signed-off-by: Martin Pitt <martinpitt@gnome.org>
2013-10-08 16:46:41 +02:00
Martin Pitt
2b10e20262 Make GetHistory() array order consistent
When requesting fewer history elements than we actually have, fix the
interpolation loop to not reverse the returned elements; this already does not
happen if we request more elements than available, which led to the returned
list order depending on the history size.

Now the first array element is always the most recent one. Update documentation
accordingly.

Add test case to reproduce the problem. We now add three sample points to be
able to request a subset and still assert its correct order, and make the
charge values be further apart to ensure correct interpolation.

https://bugs.freedesktop.org/show_bug.cgi?id=68384
2013-08-29 10:44:26 +02:00
Seth Forshee
eaf86482a9 Add temperature property for batteries
Linux's power_supply class supports a temperature attribute, which is
supported by many battery drivers. Add a new property to export this
information and support this property in Linux.

https://bugs.freedesktop.org/show_bug.cgi?id=68338

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Martin Pitt <martinpitt@gnome.org>
2013-08-23 08:45:57 +02:00
Richard Hughes
9843589d2d Require applications to define UPOWER_ENABLE_DEPRECATED to use deprecated functionality
This can easily be done by doing #define UPOWER_ENABLE_DEPRECATED before
"#include <upower.h>" or adding -DUPOWER_ENABLE_DEPRECATED to the cflags line in
Makefile.am

See http://lists.freedesktop.org/archives/devkit-devel/2013-January/001339.html
for more information on future plans and for rationale.
2013-02-12 11:08:27 +00:00
Richard Hughes
5be743c910 Don't use the deprecated INCLUDES in Makefile.am 2013-01-14 09:21:30 +00:00
Julien Danjou
2f03ad62b5 Add luminosity property
This adds the luminosity property for devices able to recharge using light.

Signed-off-by: Julien Danjou <julien@danjou.info>
Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-10-30 20:03:54 +00:00
Martin Pitt
2b216e7db3 Selectively disable warnings for deprecated GValueArray
GLib 2.33 and further deprecates GValueArray. However, we still need it as long
as we are using dbus-glib, so selectively disable the deprecation warnings for
the three functions that use GValueArray. This allows us to continue to build
with -Werror.
2012-06-14 12:52:11 +02:00