Commit graph

985 commits

Author SHA1 Message Date
Bastien Nocera
8453da5014 tools: Use notify signals instead of *changed ones 2013-10-17 12:40:05 +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
c9f3a13b29 power: Work-around batteries that are slow to notice charge
This is a hack that was in gnome-settings-daemon's power plugin.
We would check whether we were on AC before saying for certain
that batteries had a low-level, and raising the warning-level.
2013-10-17 11:31:41 +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
a7870229ee linux: Fix incorrect check for logind sleep methods
A simple reversed check...
2013-10-17 08:56:41 +02:00
Bastien Nocera
5f830e74a7 build: And bump soname 2013-10-17 01:21:27 +02:00
Bastien Nocera
16556b9377 build: Bump version to 0.99.0 2013-10-17 01:20:54 +02:00
Bastien Nocera
b777c63d97 daemon: Make warning-level UpDevice property writable
So we can update the display device warning level.
2013-10-17 01:07:06 +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
c00eda8ca0 tools: Print the display device when using -d 2013-10-17 00:46:01 +02:00
Bastien Nocera
a76eaeddb9 lib: Trim properties when printing the display device 2013-10-17 00:45:26 +02:00
Bastien Nocera
369a2c6d08 daemon: Indentation in UpDaemon struct 2013-10-17 00:37:29 +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
c2426adb4b daemon: Add documentation for computed properties
Those are also part of the display device properties that we
will update.
2013-10-16 15:58:39 +02:00
Bastien Nocera
b72973472c daemon: Mention hard-coded display device object path
/org/freedesktop/UPower/devices/DisplayDevice is a stable
object path.
2013-10-16 15:58:13 +02:00
Bastien Nocera
511a1dbf7c daemon: Minimise WarningLevel signals
When it doesn't actually change, don't send out signals.
2013-10-16 15:57:34 +02:00
Bastien Nocera
f065cd202c daemon: Fix sending device's PropertiesChanged signal
The interface name was missing ".Device" at the end, so wasn't
getting registered by clients.
2013-10-16 15:56:19 +02:00
Bastien Nocera
01226cb282 daemon: Emit PropertiesChanged for computed properties too
The IconName and WarningLevel properties were not sent out through
PropertiesChanged when they changed for devices.
2013-10-16 13:56:35 +02:00
Bastien Nocera
cb9b1aaad8 daemon: Only modify display device when it changes
When none of the properties of the display device change,
do not modify it.
2013-10-16 13:48:25 +02:00
Bastien Nocera
bda51f5284 daemon: Add GetDisplayDevice method
And export a DisplayDevice object which can be used by desktop
shells to show/hide the status icon.
2013-10-16 13:42:34 +02:00
Bastien Nocera
e7eed719f2 daemon: Set the display device type when on battery
When on battery only, we weren't setting the display device type
properly.
2013-10-16 13:39:26 +02:00
Bastien Nocera
f15992c6a3 daemon: Use constant for the devices object paths 2013-10-16 13:06:13 +02:00
Bastien Nocera
473b4c3568 daemon: Remove spurious linefeed 2013-10-16 13:05:54 +02:00
Bastien Nocera
19fdd684fa daemon: Remove 2 undefined functions from headers
up_daemon_get_on_battery() and up_daemon_get_warning_level()
weren't defined or used anywhere.
2013-10-16 12:42:09 +02:00
Bastien Nocera
8bf9ae0eef daemon: Remove left-over debug 2013-10-15 17:50:55 +02:00
Bastien Nocera
2dae17d87b daemon: Make UpDevice emit PropertiesChanged signals
That will make libupower-glib UpDevice work again, as the proxy
was not receiving property changes, and we kept reading old
cached values.
2013-10-15 17:50:18 +02:00
Bastien Nocera
5e5e737948 daemon: Add support for more types for PropertiesChanged
Add code to transform strings, doubles, uint64s, and int64s.
2013-10-15 17:50:18 +02:00
Bastien Nocera
2cfd98c01d daemon: Coalesce PropertiesChanged signals together
Instead of sending one changed signal at a time, coalesce them
together to reduce wakeups.

We also export up_daemon_emit_properties_changed() for UpDevice
to use.
2013-10-15 17:50:18 +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
689ae112de daemon: Calculate global WarningLevel correctly
By using the state of all the combined batteries, rather than
each one (eg. 2 batteries of the same type at 15% shouldn't trigger
the "low" warning level).

This introduces code to calculate the state of a "display" device,
which is either a UPS, or a combination of all batteries.
2013-10-15 15:01:37 +02:00
Bastien Nocera
7e61b09409 daemon: Fix possible crasher in UpDevice self-test 2013-10-15 15:01:37 +02:00
Bastien Nocera
01d8004d6c daemon: Remove unimplemented up_device_test() 2013-10-15 15:01:37 +02:00
Bastien Nocera
dab98e291a daemon: Remove unused internal D-Bus proxy
In UpDevice.
2013-10-15 15:01:37 +02:00
Bastien Nocera
f71ac98cd2 daemon: Register on the Bus after coldplug
Both for the daemon and devices, so as to avoid D-Bus changes
storms on startup.
2013-10-15 15:01:37 +02:00
Bastien Nocera
d74e4a7243 daemon: Don't emit changed signal in coldplug
We weren't emitting GObject signals in coldplug, no need to send out
D-Bus signals either.
2013-10-14 16:19:10 +02:00
Bastien Nocera
0ac5c13369 daemon: Sort the UpDaemon struct member 2013-10-14 16:05:11 +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
77c3278ff5 daemon: Move all computations of warning level to daemon
There's no reason why the state check should be done in the UpDevice
implementation, and the state will be needed to add a new warning
level for UPSes.
2013-10-14 14:27:48 +02:00
Bastien Nocera
ac1708e86e daemon: Require newer GLib
And remove ifdef's.
2013-10-14 11:06:53 +02:00
Bastien Nocera
d2484d4ec1 lib: Add support for the IconName property 2013-10-14 11:06:53 +02:00
Bastien Nocera
c9aeb660e1 daemon: Add IconName property
Sends out icon names as defined by the Icon Naming specification.

Will save quite a bit of client side code.
2013-10-14 11:06:53 +02:00
Bastien Nocera
68b9975ad9 daemon: Add CriticalPowerAction
Paraphrasing from the configuration option:
The action to take when "TimeAction" or "PercentageAction" above has
been reached for the batteries (UPS or laptop batteries) supplying
the computer.

This is done 20 seconds after the warning-level variable got set
to UP_DEVICE_LEVEL_ACTION has been set, to give the opportunity
to front-ends to display a (short) warning.

This is only implemented for the Linux backend, using logind.
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
7531dbdac0 daemon: Emit the PropertiesChanged signal
Use raw D-Bus.

https://bugs.freedesktop.org/show_bug.cgi?id=43001
2013-10-14 11:06:53 +02:00
Bastien Nocera
3d16414652 daemon: Emit the "Changed" signal without going through notify
There's no need to use the "notify" signal to capture when
the properties are changed, we're the ones sending the notify
signals in the first place.
2013-10-14 11:06:53 +02:00