Review of "Bring Out Submenu Of Power Off Button" version 55

Details Page Preview

Diff Against

Files

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

Shexli (experimental)

Shexli has not produced a result yet.

All Versions

Previous Reviews on this Version

JustPerfection rejected
You cannot create any instance of objects in the global scope (line 11 `CreateActionItem.js`): - [EGO Review Guidelines: Initialization](https://gjs.guide/extensions/review-guidelines/review-guidelines.html#only-use-initialization-for-static-resources) - [EGO Review Guidelines: Destroy](https://gjs.guide/extensions/review-guidelines/review-guidelines.html#destroy-all-objects)
PRATAP PANABAKA posted a review
Hi, Thank you for your quick review. In extension.js I have initiated like this ``` export default class BringoutExtension extends Extension { _modifySystemItem() { modifiedMenu = new BringoutMenu( this._settings, this._gettext, this._pgettext, this._lockDownSettings ); } _queueModifySystemItem() { sourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { if (!Main.panel.statusArea.quickSettings._system) return GLib.SOURCE_CONTINUE; this._modifySystemItem(); return GLib.SOURCE_REMOVE; }); } enable() { this._settings = this.getSettings(); this._gettext = gettext; this._pgettext = pgettext; this._lockDownSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.lockdown' }); // added here if (Main.panel.statusArea.quickSettings._system) this._modifySystemItem(); else this._queueModifySystemItem(); } disable() { modifiedMenu._destroy(); modifiedMenu = null; if (sourceId) { GLib.Source.remove(sourceId); sourceId = null; } this._lockDownSettings = null; // nullify here this._pgettext = null; this._gettext = null; this._settings = null; } } ``` and in CreateActionItem.js ``` const CreateActionItem = GObject.registerClass( class CreateActionItem extends QuickSettingsItem { _init(ICON_NAME, ACCESSIBLE_NAME, ACTION, DIALOG, lockDownSettings) { // passed it here as lockDownSettings super._init({ style_class: 'icon-button', can_focus: true, track_hover: true, icon_name: ICON_NAME, accessible_name: ACCESSIBLE_NAME, }); ``` I have tested the extension with the above setup, working find. Shall I submit it for review? Thanking You
JustPerfection posted a review
Yeah, you can use dependency injection.