Commit graph

74 commits

Author SHA1 Message Date
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
Pavel Vasin
bf56cecab4 libupower-glib: fix small memory leak
Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-04-26 17:39:42 +01:00
Ryan Lortie
38d65955f4 libupower-glib: srcdir != builddir fix 2012-01-11 15:56:37 +01:00
Richard Hughes
b19fca9637 Use git.mk and remove the manual .gitignore files 2011-07-19 12:40:21 +01:00
Richard Hughes
0fd304c3f3 Add new NotifySleep() and NotifyResume() signals that include the sleep type
This allows session power managers to do different actions depending on whether the user
is suspending or hibernating. This allows the session policy agent to poke other things
(for instance, the screensaver) even if another process initiated the sleep.

This is based on a patch from Phillip Susi <psusi@cfl.rr.com>, many thanks.
2011-05-04 17:57:13 +01:00
Richard Hughes
b31de44eee Add a LidForceSleep property to ensure that we don't melt any laptops
We still need to add the DMI quirks, but I'm waiting for the
community to supply them now.
2011-02-02 13:44:09 +00:00
Richard Hughes
c507b516d4 Add an IsDocked binary property to the main interface 2011-01-04 17:01:59 +00:00
Richard Hughes
e1e796e584 trivial: fix make distcheck 2010-11-01 12:44:10 +00:00
Richard Hughes
ed34986e08 libupower-glib: Reject invalid object paths to avoid asserting libdbus 2010-11-01 09:52:07 +00:00
Richard Hughes
f74dae440b Do not dist the UPowerGlib-1.0.gir file to fix building on F14 2010-10-12 19:14:23 +01:00
Richard Hughes
58f3d9fbdf Fix up all the warnings when building with new versions of gobject-introspection 2010-10-05 11:13:09 +01:00
Edward Sheldrake
cfd3641501 Fix building with gobject-introspection 0.9.10 2010-10-05 11:03:42 +01:00
Richard Hughes
116ed04599 Fix the build with new versions of gobject-introspection 2010-10-04 15:53:51 +01:00