Skip to content

Commit

Permalink
changed to ES6, work done by didierm
Browse files Browse the repository at this point in the history
* (sciancio#73 (comment))
* Small update by Benjamin Kahn <xkahn@zoned.net>
  • Loading branch information
pieska authored and Benjamin Kahn committed Nov 26, 2023
1 parent eab7b7d commit 3808544
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ let Me = Extension.lookupByURL(import.meta.url);
import * as Search from './search.js'
import * as Terminals from './terminals.js';

const ConnectionManager = new Lang.Class({
Name: 'ConnectionManager',
Extends: PanelMenu.Button,
const ConnectionManager = new GObject.registerClass({
GTypeName: 'ConnectionManager',
}, class ConnectionManager extends PanelMenu.Button {

_init: function() {
_init() {

this.parent(1.0, "Connection Manager", false);
super._init(1.0, "Connection Manager", false);

this._box = new St.BoxLayout();

Expand Down Expand Up @@ -106,17 +106,17 @@ const ConnectionManager = new Lang.Class({
}

this._readConf();
},
}


_readConf: function () {
_readConf() {

this.menu.removeAll();

// Rewrite _setOpenedSubMenu method to correctly open submenu
this.menu._setOpenedSubMenu = Lang.bind(this, function (submenu) {
this.menu._setOpenedSubMenu = submenu => {
this._openedSubMenu = submenu;
});
}

this._sshList = [];

Expand Down Expand Up @@ -150,21 +150,17 @@ const ConnectionManager = new Lang.Class({
this.menu.addMenuItem(menuSepPref, this.menu.length);

let menuPref = new PopupMenu.PopupMenuItem("Connection Manager Settings");
menuPref.connect('activate', Lang.bind(this, function() {
try {
Util.trySpawnCommandLine('python2 ' + this._prefFile);
} catch (e) {
Util.trySpawnCommandLine('python ' + this._prefFile);
}
}));
menuPref.connect('activate', () => {
Util.trySpawnCommandLine('python ' + this._prefFile);
});
this.menu.addMenuItem(menuPref, this.menu.length+1);

// Update ssh name list
this._searchProvider._update(this._sshList);
},
}


_readTree: function(node, parent, ident) {
_readTree(node, parent, ident) {

let child, menuItem, menuSep, menuSub, icon, label,
menuItemAll, iconAll, menuSepAll, menuItemTabs, iconTabs, ident_prec;
Expand Down Expand Up @@ -334,7 +330,7 @@ const ConnectionManager = new Lang.Class({

}
ident = ident_prec;
},
}

});

Expand All @@ -349,7 +345,7 @@ function enable() {

let file = Gio.file_new_for_path(cm._configFile);
cm.monitor = file.monitor(Gio.FileMonitorFlags.NONE, null);
cm.monitor.connect('changed', Lang.bind(cm, cm._readConf));
cm.monitor.connect('changed', () => cm._readConf());
}

function disable() {
Expand Down

0 comments on commit 3808544

Please sign in to comment.