Skip to content

Commit

Permalink
changed to ES6, work done by didierm (sciancio#73 (comment))
Browse files Browse the repository at this point in the history
  • Loading branch information
pieska committed May 17, 2022
1 parent 26f198a commit 8382375
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const St = imports.gi.St;
const Gdk = imports.gi.Gdk;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const Lang = imports.lang;
const GObject = imports.gi.GObject;
const Shell = imports.gi.Shell;

const Mainloop = imports.mainloop;
Expand All @@ -46,13 +46,13 @@ const Search = CM.imports.search;
const Terminals = CM.imports.terminals;


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 @@ -93,17 +93,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 @@ -137,17 +137,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() {
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 @@ -317,7 +317,7 @@ const ConnectionManager = new Lang.Class({

}
ident = ident_prec;
},
}

});

Expand All @@ -332,7 +332,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 8382375

Please sign in to comment.