Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions connmgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk, Gio
from StringIO import StringIO
from io import StringIO

import os.path
import shutil
Expand Down Expand Up @@ -702,7 +702,7 @@ def item_dialog(self, row):
profileName = profile.get_string("visible-name")

entry3.append_text(profileName)
if profileName.decode('utf-8') == row[3]:
if profileName == row[3]:
entry3.set_active(index)

else:
Expand Down
45 changes: 21 additions & 24 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,21 +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() {
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 @@ -321,7 +317,7 @@ const ConnectionManager = new Lang.Class({

}
ident = ident_prec;
},
}

});

Expand All @@ -336,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 All @@ -351,9 +347,10 @@ function disable() {

function init(extensionMeta) {
extensionPath = extensionMeta.path;

let theme = imports.gi.Gtk.IconTheme.get_default();
theme.append_search_path(extensionPath);

let theme = imports.gi.St.IconTheme.new();
if(theme!=null) {
theme.append_search_path(extensionPath);
}
}

7 changes: 6 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
"3.26",
"3.28",
"3.30",
"3.32"
"3.32",
"40.0",
"41.1",
"42.0",
"43.0",
"44.0"
],
"sw_bin": "connmgr.py",
"sw_config": ".connmgr",
Expand Down