Review of "Blackstrat Desktop Icons" version 2

Details Page Preview

Free-placement desktop icons with context menu. This extension accesses the system clipboard to support cut, copy, and paste of files between the desktop and other applications. Known limitation: cut/paste and drag&drop of files between the desktop and Nautilus (Files) are not fully supported yet.

Extension Homepage
https://github.com/BlackStrat4/blackstrat-desktopicons

No comments.

Diff Against

Files

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

Shexli (experimental) warning 5 manual_review 1

Shexli found 6 issues that may need reviewer attention.

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()`.

File Operations

  • extension.js:1334
    file.load_contents(null)

EGO-A-005 manual_review

extensions should not access the clipboard directly

Direct clipboard access via `St.Clipboard.get_default()` requires reviewer scrutiny.

Review Guidelines

  • extension.js:883
    St.Clipboard.get_default()
  • extension.js:954
    St.Clipboard.get_default()
  • extension.js:1897
    St.Clipboard.get_default()
  • extension.js:1904
    St.Clipboard.get_default()
  • extension.js:1911
    St.Clipboard.get_default()
  • extension.js:1937
    St.Clipboard.get_default()
  • extension.js:1943
    St.Clipboard.get_default()

EGO-L-002 warning

objects created by extension should be destroyed in disable()

Objects assigned in `enable()` are missing matching `.destroy()` calls in `disable()` or its helper methods.

Destroy all objects

  • extension.js:51
    this.menuManager = new PopupMenu.PopupMenuManager(Main.layoutManager.dummyCursor || Main.uiGroup)
  • extension.js:285
            this.selectionBox = new St.Widget({
                style: "background-color: rgba(53, 132, 228, 0.25); border: 1px solid #3584e4; border-radius: 2px;",
                visible: false
            })

EGO-L-005 warning

owned object references should be released in disable()

Owned references that are cleaned up in `disable()` should also be released with `null` or `undefined`.

Destroy all objects

  • extension.js:51
    this.menuManager = new PopupMenu.PopupMenuManager(Main.layoutManager.dummyCursor || Main.uiGroup)
  • extension.js:285
            this.selectionBox = new St.Widget({
                style: "background-color: rgba(53, 132, 228, 0.25); border: 1px solid #3584e4; border-radius: 2px;",
                visible: false
            })

EGO-L-003 warning

signals connected by extension should be disconnected in disable()

Signals assigned in `enable()` are missing matching disconnect calls in `disable()` or its helper methods.

Disconnect all signals

  • extension.js:1864
            clutterText.connect('activate', () => {
                applyRename();
            })
  • extension.js:1867
            clutterText.connect('key-press-event', (actor, event) => {
                let key = event.get_key_symbol();
                let state = event.get_state();
                let ctrl = (state & Clutter.ModifierType.CONTROL_MASK) !== 0;
    
                if (key === Clutter.KEY_Escape) {
                    committ
  • extension.js:294
            this.desktopLayer.connect('button-press-event', (actor, event) => {
                let button = event.get_button();
    
                if (button === 3) {
                    this._showDesktopContextMenu(event);
                    return Clutter.EVENT_STOP;
                }
    
                if (button === 1) {
       
  • extension.js:339
            this.desktopLayer.connect('button-release-event', (actor, event) => {
                if (this._isMarqueeSelecting && event.get_button() === 1) {
                    this._isMarqueeSelecting = false;
                    this.selectionBox.hide();
                    return Clutter.EVENT_STOP;
                }
     
  • extension.js:324
            this.desktopLayer.connect('motion-event', (actor, event) => {
                if (this._isMarqueeSelecting) {
                    let [cx, cy] = event.get_coords();
                    let x = Math.min(this._marqueeStartX, cx);
                    let y = Math.min(this._marqueeStartY, cy);
                    l

EGO-L-004 warning

main loop sources should be removed in disable()

Main loop sources assigned in `enable()` are missing matching removals in `disable()` or its helper methods.

Remove main loop sources

  • extension.js:1167
                GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
                    try {
                        let monitor = Main.layoutManager.primaryMonitor;
                        let [pw, ph] = panel.get_size();
                        let x = monitor.x + Math.max(0, Math.floor((monitor.width - pw) / 2));
            
  • extension.js:1839
            GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
                global.stage.set_key_focus(clutterText);
                clutterText.set_selection(0, clutterText.get_text().length);
                return GLib.SOURCE_REMOVE;
            })
  • extension.js:501
                    GLib.timeout_add(GLib.PRIORITY_DEFAULT, 50, () => {
                        dummySource.destroy();
                        return GLib.SOURCE_REMOVE;
                    })

All Versions

Version Status
6 Unreviewed
5 Rejected
4 Rejected
3 Rejected
2 Rejected
1 Rejected

Previous Reviews on this Version

JustPerfection rejected
Didn't review. Just skimmed over the code and still not using best practices. Like comments: https://gjs.guide/extensions/review-guidelines/best-practices.html#comments Also, Shexli issues are still there.
Dimitris posted a review
Hello JustPerfection. I have uploaded Version 3 where I worked hard to clean up the code. I fixed the synchronous file IO, added the missing object/signal/timeout cleanups in the disable() function to address the Shexli warnings, and removed or translated the unnecessary comments according to the guidelines. Please take a look when you have some time. Thank you for your guidance