Commit graph

964 commits

Author SHA1 Message Date
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
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
010ab14505 daemon: Device* signals send out object paths
Not strings, so correct the signal definitions to match the
XML service definition.
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
87709f709a daemon: Add small hack for keyboards and mice
Imported from gnome-settings-daemon, itself from
gnome-power-manager.
2013-10-14 10:42:56 +02:00
Bastien Nocera
0da46209f3 tools: Update for API changes 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
bd3a57fe04 daemon: Replace "on-low-battery" property
With "warning-level" property.
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
de749a332b daemon: Add WarningLevel device property 2013-10-14 10:42:56 +02:00
Bastien Nocera
68aca3a7e7 daemon: Load level policy configuration 2013-10-14 10:42:56 +02:00
Bastien Nocera
3bf0b7adaf daemon: Add helper to get uint from config 2013-10-14 10:42:56 +02:00
Bastien Nocera
ccda7a4a17 daemon: Remove unused config file loading
We already have UpConfig to handle that.
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
4a5d12a909 etc: Add configuration for battery levels 2013-10-14 10:42:56 +02:00
Bastien Nocera
91df125e39 daemon: Remove unneeded reset of priv struct members
It's already done by GObject.
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