From 068395f63de0be60ae0270f039fd4a6de0c3527c Mon Sep 17 00:00:00 2001 From: Gerd Riesselmann Date: Wed, 8 Apr 2015 17:00:02 +0200 Subject: [PATCH 1/6] Fix #51 Fixed .ssh/config parsing but replaces it by a simpler algorithm, ignoring HostName, User, Port (and IdentityFile, which is already ignored) --- connmgr.py | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/connmgr.py b/connmgr.py index 30d23a4..ba576b7 100644 --- a/connmgr.py +++ b/connmgr.py @@ -625,28 +625,14 @@ def a_host(line): lines = [line.strip() for line in file(SSH_CONFIG_FILE)] comments_removed = [remove_comment(line) for line in lines] blanks_removed = [line for line in comments_removed if line] + non_hosts_removed = [line for line in blanks_removed if a_host(line)] - block = itertools.groupby(blanks_removed, not_a_host) - - first_block = False - for key, group in block: - Info = dict([line.split(None, 1) for line in group]) - - if (not key): - if (not first_block): - first_block = True - importedHost = Info['Host'] - if (key and first_block): - if 'HostName' in Info: - importedHostname = Info['HostName'] - if 'User' in Info: - importedHostname = Info['User']+'@'+importedHostname - if 'Port' in Info: - importedHostname = '-p '+Info['Port']+' '+importedHostname - + for line in non_hosts_removed: + importedHosts = line.split(None)[1:] + for importedHost in importedHosts: if importedHost != '*': treestore.append(import_iter, ['__item__', - importedHost, importedHostname, 'Unnamed', 'ssh']) + importedHost, importedHost, 'Unnamed', 'ssh']) def is_folder(self, iter): if self.treestore.get_value(iter, 0) == '__folder__': From bb3b9db8f095a1b39044c3379be4c5f38a0927d5 Mon Sep 17 00:00:00 2001 From: Andreas Piesk Date: Mon, 3 May 2021 19:08:30 +0200 Subject: [PATCH 2/6] fixes for Fedora 32+ (see https://github.com/sciancio/connectionmanager2/issues/69) --- connmgr.py | 4 ++-- extension.js | 11 ++++------- metadata.json | 3 ++- 3 files changed, 8 insertions(+), 10 deletions(-) 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..fa5f896 100644 --- a/extension.js +++ b/extension.js @@ -138,11 +138,7 @@ const ConnectionManager = new Lang.Class({ 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); - } + Util.trySpawnCommandLine('python ' + this._prefFile); })); this.menu.addMenuItem(menuPref, this.menu.length+1); @@ -353,7 +349,8 @@ function init(extensionMeta) { extensionPath = extensionMeta.path; let theme = imports.gi.Gtk.IconTheme.get_default(); - theme.append_search_path(extensionPath); - + if(theme!=null) { + theme.append_search_path(extensionPath); + } } diff --git a/metadata.json b/metadata.json index 08e9f02..0f7e810 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,8 @@ "3.26", "3.28", "3.30", - "3.32" + "3.32", + "40.0" ], "sw_bin": "connmgr.py", "sw_config": ".connmgr", From 0ff045ad2605acae00ac7afcb69302a1c539105c Mon Sep 17 00:00:00 2001 From: Andreas Piesk Date: Tue, 9 Nov 2021 14:41:47 +0100 Subject: [PATCH 3/6] updated for fedora 35 (gnome 41.1) --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 0f7e810..ed76a0e 100644 --- a/metadata.json +++ b/metadata.json @@ -15,7 +15,8 @@ "3.28", "3.30", "3.32", - "40.0" + "40.0", + "41.1" ], "sw_bin": "connmgr.py", "sw_config": ".connmgr", From 26f198a3749e818663976e676158edad4ec67303 Mon Sep 17 00:00:00 2001 From: Andreas Piesk Date: Thu, 12 May 2022 20:02:05 +0200 Subject: [PATCH 4/6] updated for fedora 36 (gnome 42.0) --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index ed76a0e..bafbd0b 100644 --- a/metadata.json +++ b/metadata.json @@ -16,7 +16,8 @@ "3.30", "3.32", "40.0", - "41.1" + "41.1", + "42.0" ], "sw_bin": "connmgr.py", "sw_config": ".connmgr", From 8382375c44e15006109adce9c24f840ba98546c9 Mon Sep 17 00:00:00 2001 From: Andreas Piesk Date: Tue, 17 May 2022 14:24:09 +0200 Subject: [PATCH 5/6] changed to ES6, work done by didierm (https://github.com/sciancio/connectionmanager2/issues/73#issuecomment-1128606674) --- extension.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/extension.js b/extension.js index fa5f896..3761242 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,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; @@ -317,7 +317,7 @@ const ConnectionManager = new Lang.Class({ } ident = ident_prec; - }, + } }); @@ -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() { From 8dc682ab3b660ae8e4d517fbf66467716d2d4a8c Mon Sep 17 00:00:00 2001 From: Andreas Piesk Date: Thu, 20 Apr 2023 12:57:05 +0200 Subject: [PATCH 6/6] fix for gnome 44.0 https://github.com/sciancio/connectionmanager2/issues/74#issuecomment-1528707164 --- extension.js | 4 ++-- metadata.json | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/extension.js b/extension.js index 3761242..859f5cd 100644 --- a/extension.js +++ b/extension.js @@ -347,8 +347,8 @@ function disable() { function init(extensionMeta) { extensionPath = extensionMeta.path; - - let theme = imports.gi.Gtk.IconTheme.get_default(); + + let theme = imports.gi.St.IconTheme.new(); if(theme!=null) { theme.append_search_path(extensionPath); } diff --git a/metadata.json b/metadata.json index bafbd0b..745d63a 100644 --- a/metadata.json +++ b/metadata.json @@ -17,7 +17,9 @@ "3.32", "40.0", "41.1", - "42.0" + "42.0", + "43.0", + "44.0" ], "sw_bin": "connmgr.py", "sw_config": ".connmgr",