diff --git a/connmgr.py b/connmgr.py index e1874cb..7b2f193 100644 --- a/connmgr.py +++ b/connmgr.py @@ -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 @@ -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: diff --git a/extension.js b/extension.js index a9a85f3..859f5cd 100644 --- a/extension.js +++ b/extension.js @@ -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; @@ -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(); @@ -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 = []; @@ -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; @@ -321,7 +317,7 @@ const ConnectionManager = new Lang.Class({ } ident = ident_prec; - }, + } }); @@ -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() { @@ -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); + } } diff --git a/metadata.json b/metadata.json index 08e9f02..745d63a 100644 --- a/metadata.json +++ b/metadata.json @@ -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",