Review of "OSD Volume Number" version 7

Details Page Preview

Replace the on-screen-display volume level icon with a number.

Extension Homepage
https://github.com/Deminder/osd-volume-number

No comments.

Diff Against

Files

Note: Binary files aren't shown on the web site. To see all files, please download the extension zipfile.

All Versions

Version Status
11 Active
10 Active
9 Rejected
8 Active
7 Rejected
6 Active
5 Active
4 Rejected
3 Active
2 Active
1 Active

Previous Reviews on this Version

JustPerfection waiting for author
Why aren't you using InjectionManager instead of `modules/sdt/injection.js`? https://gjs.guide/extensions/topics/extension.html#injectionmanager
JustPerfection rejected
btw, you cannot create instance of objects there (line 13 extension.js). It should be created on enable and null out in disable.
Deminder posted a review
> Why aren't you using InjectionManager The InjectionManager does not work when multiple extensions override the same method. Its `restoreMethod` only restores correctly if it is called in reverse order to `overrideMethod`. The InjectionTracker helps revert object property injections 'out of order' by keeping track of the injection history. For instance both `osd-volume-number` (A) and `battery-indicator` (B) override _addItemsBefore/_addItems. If you use the InjectionManager and first enable A then B and then disable A first, A will restore the original shell function and B's function override is gone. Then if B is disabled it restores A's function override (thus an invalid state). In short: Overriding the same method with InjectionManager is not supported and will break things. > btw, you cannot create instance of objects there (line 13 extension.js). It should be created on enable and null out in disable. Is the example of InjectionManager in the docs teaching incorrect code then? https://gjs.guide/extensions/topics/extension.html#injectionmanager Note that this assignment (line 13 extension.js) is not static. It is an instance variable as in the example in the docs. Moreover, I wonder, what reason there is for the InjectionTracker to be nulled. Is there some explanation in the docs?
JustPerfection posted a review
Yes, the doc should be fixed. It should be null out on disable.
Deminder posted a review
Could you please point me to where is this rule coming from? And are there exceptions? For instance, in this extension the object `#modules = new Array();` is not nulled: https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/blob/main/src/extension.js
JustPerfection posted a review
array gets empty on disable: https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/blob/main/src/extension.js#L46 and the rule: https://gjs.guide/extensions/review-guidelines/review-guidelines.html#destroy-all-objects also applies to this rule: https://gjs.guide/extensions/review-guidelines/review-guidelines.html#only-use-init-for-initialization
Deminder posted a review
> array gets empty on disable The point is that it is not set to null. The InjectionTracker is also empty. It is not immediately apparent how and why these old rules apply to the new Extension class but that clears this up, thank you! So the exceptions to this 'null-out' rule are specifically constant objects and arrays.
JustPerfection posted a review
Array is different from the instance of an object. I'll fix the docs later.