Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for battery device icon update #674

Merged
merged 1 commit into from May 8, 2016

Conversation

quozl
Copy link
Contributor

@quozl quozl commented Apr 6, 2016

(this is the updated commit message from 67ffe98)

Frame battery device is static on Ubuntu 16.04, with UPower 0.99.4.

The 'changed' signal is not sent. UPower had deprecated 'changed', replacing with 'notify' for all properties, or on per-property basis.

  • switch to UPowerGlib GObject introspection API,
  • continue to use 'changed' signals on older UPower, for compatibility with OLPC OS 13.2.7, Fedora 18, UPower 0.9.19,
  • switch to 'notify' signals if they are present,
  • continue to use D-Bus API to get device path, because the older UPower fails on get_devices method, and doesn't have get_display_device,
  • ignore bursts of notify signals; reduces frame icon redraws,
  • fixes https://bugs.sugarlabs.org/ticket/4781.

Tested with OLPC OS 13.2.7 on XO-4, and Ubuntu 16.04 on commodity hardware.

Requires gir1.2-upowerglib-1.0 on Ubuntu 16.04.

@quozl
Copy link
Contributor Author

quozl commented Apr 7, 2016

Rewrote patch;

  • avoid checking for get_display_device, always use the D-Bus enumerate devices result,
  • split out the connecting of signals into a private method,
  • check the signals using GObject.signal_list_names,
  • include test results.

_UP_STATE_DISCHARGE_PENDING = 6
_UP_STATE_UNKNOWN = UPowerGlib.DeviceState.UNKNOWN
_UP_STATE_CHARGING = UPowerGlib.DeviceState.CHARGING
_UP_STATE_DISCHARGING = UPowerGlib.DeviceState.DISCHARGING
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we just use the UPowerGlib constants directly? Find and replace is good :)

Frame battery device is static on Ubuntu 16.04, with UPower 0.99.4.

The 'changed' signal is not sent.  UPower had deprecated 'changed',
replacing with 'notify' for all properties, or on per-property basis.

- switch to UPowerGlib GObject introspection API,

- continue to use 'changed' signals on older UPower, for compatibility
  with OLPC OS 13.2.7, Fedora 18, UPower 0.9.19,

- switch to 'notify' signals if they are present,

- continue to use D-Bus API to get device path, because the older UPower
  fails on get_devices method, and doesn't have get_display_device,

- ignore bursts of notify signals; reduces frame icon redraws,

- fixes https://bugs.sugarlabs.org/ticket/4781.

Tested with OLPC OS 13.2.7 on XO-4, and Ubuntu 16.04 on commodity
hardware.

Requires gir1.2-upowerglib-1.0 on Ubuntu 16.04.
@quozl
Copy link
Contributor Author

quozl commented Apr 12, 2016

  • use UPowerGlib constants directly instead of making our own based on them, reported by @samdroid-apps,
  • confirmed _UP_STATE* were not used outside module.

@samdroid-apps samdroid-apps merged commit 495b216 into sugarlabs:master May 8, 2016
@quozl quozl deleted the 2016-097-battery-2 branch September 11, 2019 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants