Fixed bug where terminal being removed didn't remove it from edit menu list of terminals.

This commit is contained in:
Graeme Humphries 2013-03-15 11:50:10 -07:00
parent 725ceb4a1a
commit b248a1db49

View File

@ -175,11 +175,15 @@ class CruSSH:
def removeTerminal(self, terminal): def removeTerminal(self, terminal):
# brute force search since we don't actually know the hostname from the # brute force search since we don't actually know the hostname from the
# terminal object. this is an infrequent operation, so it should be fine. # terminal object. this is an infrequent operation, so it should be fine.
for menuitem in self.ActiveHostsMenu.get_children():
if terminal.get_tooltip_text() == menuitem.get_label():
self.ActiveHostsMenu.remove(menuitem)
for host in self.Terminals.keys(): for host in self.Terminals.keys():
if terminal == self.Terminals[host]: if terminal == self.Terminals[host]:
self.LayoutTable.remove(self.Terminals[host]) self.LayoutTable.remove(self.Terminals[host])
print("Disconnected from " + host) print("Disconnected from " + host)
del self.Terminals[host] del self.Terminals[host]
self.reflow(force=True) self.reflow(force=True)
def initGUI(self): def initGUI(self):
@ -213,7 +217,7 @@ class CruSSH:
self.Terminals[host].copy_input = checkitem.get_active() self.Terminals[host].copy_input = checkitem.get_active()
ActiveHostsItem = gtk.MenuItem(label="Active Hosts") ActiveHostsItem = gtk.MenuItem(label="Active Hosts")
ActiveHostsItem.set_submenu(self.ActiveHostsMenu) ActiveHostsItem.set_submenu(self.ActiveHostsMenu)
hosts = sorted(self.Terminals.keys(), reverse=True) hosts = sorted(self.Terminals.keys(), reverse=False)
for host in hosts: for host in hosts:
hostitem = gtk.CheckMenuItem(label=host) hostitem = gtk.CheckMenuItem(label=host)
hostitem.set_active(True) hostitem.set_active(True)