more group work
This commit is contained in:
parent
55c79f56d5
commit
830863d711
|
@ -49,8 +49,8 @@ class Terminator(Borg):
|
|||
|
||||
def register_terminal(self, terminal):
|
||||
"""Register a new terminal widget"""
|
||||
|
||||
self.terminals.append(terminal)
|
||||
terminal.connect('ungroup-all', self.ungroup_all)
|
||||
|
||||
def deregister_terminal(self, terminal):
|
||||
"""De-register a terminal widget"""
|
||||
|
@ -63,10 +63,21 @@ class Terminator(Borg):
|
|||
for terminal in self.terminals:
|
||||
terminal.reconfigure()
|
||||
|
||||
def create_group(self, name):
|
||||
"""Create a new group"""
|
||||
if name not in self.groups:
|
||||
self.groups.append(name)
|
||||
|
||||
def ungroup_all(self, widget):
|
||||
"""Remove all groups"""
|
||||
for terminal in self.terminals:
|
||||
terminal.set_group(None, None)
|
||||
self.groups = []
|
||||
|
||||
def group_hoover(self):
|
||||
"""Clean out unused groups"""
|
||||
|
||||
if self.config['autoclean_groups']:
|
||||
if self.autocleangroups:
|
||||
todestroy = []
|
||||
for group in self.groups:
|
||||
for terminal in self.terminals:
|
||||
|
|
|
@ -270,7 +270,7 @@ class Terminal(gtk.VBox):
|
|||
menu = gtk.Menu()
|
||||
groupitem = None
|
||||
|
||||
item = gtk.MenuItem(_('Assign to group...'))
|
||||
item = gtk.MenuItem(_('New group...'))
|
||||
item.connect('activate', self.create_group)
|
||||
menu.append(item)
|
||||
|
||||
|
@ -374,15 +374,32 @@ class Terminal(gtk.VBox):
|
|||
|
||||
return(widget_x, menu_y, 1)
|
||||
|
||||
def set_group(self, item, name):
|
||||
"""Set a particular group"""
|
||||
if self.group == name:
|
||||
# already in this group, no action needed
|
||||
return
|
||||
self.group = name
|
||||
self.titlebar.set_group_label(name)
|
||||
self.terminator.group_hoover()
|
||||
|
||||
def create_group(self, item):
|
||||
"""Trigger the creation of a group via the titlebar (because popup
|
||||
windows are really lame)"""
|
||||
self.titlebar.create_group()
|
||||
|
||||
def really_create_group(self, groupname):
|
||||
def really_create_group(self, widget, groupname):
|
||||
"""The titlebar has spoken, let a group be created"""
|
||||
self.terminator.create_group(groupname)
|
||||
self.group = groupname
|
||||
self.set_group(None, groupname)
|
||||
|
||||
def ungroup(self, widget, data):
|
||||
"""Remove a group"""
|
||||
# FIXME: Could we emit and have Terminator do this?
|
||||
for term in self.terminator.terminals:
|
||||
if term.group == data:
|
||||
term.set_group(None, None)
|
||||
self.terminator.group_hoover()
|
||||
|
||||
def set_groupsend(self, widget, value):
|
||||
"""Set the groupsend mode"""
|
||||
|
|
Loading…
Reference in New Issue