Battery session timer with record saving for GNOME Shell
Note: Binary files aren't shown on the web site. To see all files, please download the extension zipfile.
EGO-X-004 warning
extensions should avoid synchronous file IO in shell code
Shell code should avoid synchronous file IO APIs like `GLib.file_get_contents()` and `Gio.File.load_contents()`.
extension.js:559
file.load_contents(null)
extension.js:585
file.load_contents(null)
extension.js:642
file.load_contents(null)
| Version | Status |
|---|---|
| 33 | Unreviewed |
| 32 | Rejected |
| 31 | Rejected |
| 30 | Rejected |
| 29 | Rejected |
| 28 | Rejected |
| 27 | Rejected |
| 26 | Rejected |
| 25 | Rejected |
| 24 | Rejected |
| 23 | Rejected |
| 22 | Rejected |
| 21 | Rejected |
| 20 | Rejected |
| 19 | Rejected |
| 18 | Rejected |
| 17 | Rejected |
| 16 | Rejected |
| 15 | Rejected |
| 14 | Rejected |
| 13 | Rejected |
| 12 | Rejected |
| 11 | Rejected |
| 10 | Rejected |
| 9 | Rejected |
| 8 | Rejected |
| 7 | Rejected |
| 6 | Rejected |
| 5 | Rejected |
| 4 | Rejected |
| 3 | Rejected |
| 2 | Rejected |
| 1 | Rejected |
This code still doesn't follow our guidelines for best practices: https://gjs.guide/extensions/review-guidelines/best-practices.html Please don't send the code without reading.
Hello. Thank you for your continued review and for pointing me to the best practices guide. I have carefully studied the GNOME Extension Best Practices and updated the code accordingly. The following issues have been fixed: Removed all unnecessary try-catch wrappers around methods that never throw exceptions (e.g., GLib.Source.remove(), disconnect()). Removed redundant optional chaining (?.()) and function type checks for guaranteed built-in methods. Removed the _enabled flag and rewrote the disable() method to perform a complete, unconditional cleanup of all resources. Reordered cleanup in disable() to follow the correct sequence: timeouts → signals → D-Bus watchers → widgets → nullification. Grouped timeout removal and creation together to ensure old timers are always properly removed before new ones are created. I have uploaded a new version (v8) for review. Please let me know if there are any remaining issues. Thanks again for your time and guidance.
Hello. Thank you for your continued guidance. I have carefully read and followed the best practices. Here is what I fixed: Removed all _enabled flags and unconditional early returns from disable(). Removed all unnecessary try-catch wrappers around disconnect() and Source.remove(). Moved _proxyGeneration++ and _logindGeneration++ to the beginning of disable(). Grouped timeout removal and creation together in _setPosition(). Removed all if (!this._enabled) checks from callbacks and lifecycle methods. I have uploaded version 9 (v9) with all fixes. Please let me know if there is anything else. Thanks!
Hello. Thank you for your patience and detailed feedback. I have carefully studied the GNOME Extension Best Practices and prepared a new version with all necessary fixes: Removed all unnecessary try-catch wrappers around guaranteed methods like disconnect() and Source.remove(). Removed redundant optional chaining (?.()) and function type checks. Removed the _enabled flag and rewrote the disable() method for complete, unconditional resource cleanup. Fixed the cleanup order in disable() to follow the recommended sequence: timeouts → signals → D-Bus watchers → widgets. Grouped timeout removal and creation together in _setPosition(). All changes are available in the latest release on GitHub: https://github.com/Gluk41/battery-session-timer/releases/tag/v1.0.3 I have also uploaded version 9 (v9) to EGO for review. Please let me know if there is anything else I need to fix. Thanks again for your time and guidance!