Tidy up some debugging and fix group hoovering
This commit is contained in:
parent
132daeb447
commit
0ff5aa3159
|
@ -103,6 +103,7 @@ class Terminator(Borg):
|
||||||
def create_group(self, name):
|
def create_group(self, name):
|
||||||
"""Create a new group"""
|
"""Create a new group"""
|
||||||
if name not in self.groups:
|
if name not in self.groups:
|
||||||
|
dbg('Terminator::create_group: registering group %s' % name)
|
||||||
self.groups.append(name)
|
self.groups.append(name)
|
||||||
|
|
||||||
def ungroup_all(self, widget):
|
def ungroup_all(self, widget):
|
||||||
|
@ -121,17 +122,20 @@ class Terminator(Borg):
|
||||||
"""Clean out unused groups"""
|
"""Clean out unused groups"""
|
||||||
|
|
||||||
if self.config['autoclean_groups']:
|
if self.config['autoclean_groups']:
|
||||||
|
inuse = []
|
||||||
todestroy = []
|
todestroy = []
|
||||||
for group in self.groups:
|
|
||||||
for terminal in self.terminals:
|
|
||||||
save = False
|
|
||||||
if terminal.group == group:
|
|
||||||
save = True
|
|
||||||
break
|
|
||||||
|
|
||||||
if not save:
|
for terminal in self.terminals:
|
||||||
|
if terminal.group:
|
||||||
|
if not terminal.group in inuse:
|
||||||
|
inuse.append(terminal.group)
|
||||||
|
|
||||||
|
for group in self.groups:
|
||||||
|
if not group in inuse:
|
||||||
todestroy.append(group)
|
todestroy.append(group)
|
||||||
|
|
||||||
|
dbg('Terminator::group_hoover: %d groups, hoovering %d' %
|
||||||
|
(len(self.groups), len(todestroy)))
|
||||||
for group in todestroy:
|
for group in todestroy:
|
||||||
self.groups.remove(group)
|
self.groups.remove(group)
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ class Titlebar(gtk.EventBox):
|
||||||
def groupentry_activate(self, widget):
|
def groupentry_activate(self, widget):
|
||||||
"""Actually cause a group to be created"""
|
"""Actually cause a group to be created"""
|
||||||
groupname = self.groupentry.get_text()
|
groupname = self.groupentry.get_text()
|
||||||
dbg('creating group: %s' % groupname)
|
dbg('Titlebar::groupentry_activate: creating group: %s' % groupname)
|
||||||
self.groupentry_cancel(None, None)
|
self.groupentry_cancel(None, None)
|
||||||
self.emit('create-group', groupname)
|
self.emit('create-group', groupname)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue