Tidy up some debugging and fix group hoovering

This commit is contained in:
Chris Jones 2009-11-19 23:40:31 -06:00
parent 132daeb447
commit 0ff5aa3159
3 changed files with 14 additions and 10 deletions

View File

@ -103,6 +103,7 @@ class Terminator(Borg):
def create_group(self, name):
"""Create a new group"""
if name not in self.groups:
dbg('Terminator::create_group: registering group %s' % name)
self.groups.append(name)
def ungroup_all(self, widget):
@ -121,17 +122,20 @@ class Terminator(Borg):
"""Clean out unused groups"""
if self.config['autoclean_groups']:
inuse = []
todestroy = []
for terminal in self.terminals:
if terminal.group:
if not terminal.group in inuse:
inuse.append(terminal.group)
for group in self.groups:
for terminal in self.terminals:
save = False
if terminal.group == group:
save = True
break
if not save:
todestroy.append(group)
if not group in inuse:
todestroy.append(group)
dbg('Terminator::group_hoover: %d groups, hoovering %d' %
(len(self.groups), len(todestroy)))
for group in todestroy:
self.groups.remove(group)

View File

@ -285,7 +285,7 @@ class Terminal(gtk.VBox):
item = gtk.MenuItem(_('New group...'))
item.connect('activate', self.create_group)
menu.append(item)
if len(self.terminator.groups) > 0:
groupitem = gtk.RadioMenuItem(groupitem, _('None'))
groupitem.set_active(self.group == None)

View File

@ -136,7 +136,7 @@ class Titlebar(gtk.EventBox):
def groupentry_activate(self, widget):
"""Actually cause a group to be created"""
groupname = self.groupentry.get_text()
dbg('creating group: %s' % groupname)
dbg('Titlebar::groupentry_activate: creating group: %s' % groupname)
self.groupentry_cancel(None, None)
self.emit('create-group', groupname)