Configurable broadcast group

This commit is contained in:
Jiri Tyr 2014-03-07 22:50:06 +00:00
parent 72e605d30d
commit ec649aaa31
5 changed files with 85 additions and 2 deletions

View File

@ -61,6 +61,10 @@ Defines where tabs are placed. Can be any of: top, left, right, bottom.
If this is set to "hidden", the tab bar will not be shown. Note that hiding the tab bar is very confusing and not recommended. If this is set to "hidden", the tab bar will not be shown. Note that hiding the tab bar is very confusing and not recommended.
Default value: \fBtop\fR Default value: \fBtop\fR
.TP .TP
.B broadcast_group
Defines broadcast behavior. Can be any of: all, group, off.
Default value: \fBgroup\fR
.TP
.B close_button_on_tab \fR(boolean) .B close_button_on_tab \fR(boolean)
If set to True, tabs will have a close button on them. If set to True, tabs will have a close button on them.
Default value: \fBTrue\fR Default value: \fBTrue\fR

View File

@ -83,6 +83,7 @@ DEFAULTS = {
'window_state' : 'normal', 'window_state' : 'normal',
'borderless' : False, 'borderless' : False,
'tab_position' : 'top', 'tab_position' : 'top',
'broadcast_group' : 'group',
'close_button_on_tab' : True, 'close_button_on_tab' : True,
'hide_tabbar' : False, 'hide_tabbar' : False,
'scroll_tabbar' : False, 'scroll_tabbar' : False,

View File

@ -256,6 +256,23 @@
</row> </row>
</data> </data>
</object> </object>
<object class="GtkListStore" id="BroadcastGroupListStore">
<columns>
<!-- column-name position -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">All</col>
</row>
<row>
<col id="0" translatable="yes">Group</col>
</row>
<row>
<col id="0" translatable="yes">None</col>
</row>
</data>
</object>
<object class="GtkListStore" id="WindowStateListStore"> <object class="GtkListStore" id="WindowStateListStore">
<columns> <columns>
<!-- column-name state --> <!-- column-name state -->
@ -530,6 +547,42 @@
<property name="y_options">GTK_EXPAND</property> <property name="y_options">GTK_EXPAND</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="label41">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Broadcast group</property>
</object>
<packing>
<property name="top_attach">18</property>
<property name="bottom_attach">19</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="broadcastgroup">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">BroadcastGroupListStore</property>
<property name="active">0</property>
<signal name="changed" handler="on_broadcastgroup_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext18"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">18</property>
<property name="bottom_attach">19</property>
<property name="x_options"></property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child> <child>
<object class="GtkLabel" id="label6"> <object class="GtkLabel" id="label6">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -248,6 +248,16 @@ class PrefsEditor:
else: else:
active = 0 active = 0
widget.set_active(active) widget.set_active(active)
# Broadcast group
option = self.config['broadcast_group']
widget = guiget('broadcastgroup')
if option == 'all':
active = 0
elif option == 'off':
active = 2
else:
active = 1
widget.set_active(active)
# scroll_tabbar # scroll_tabbar
widget = guiget('scrolltabbarcheck') widget = guiget('scrolltabbarcheck')
widget.set_active(self.config['scroll_tabbar']) widget.set_active(self.config['scroll_tabbar'])
@ -1007,6 +1017,18 @@ class PrefsEditor:
self.config['tab_position'] = value self.config['tab_position'] = value
self.config.save() self.config.save()
def on_broadcastgroup_changed(self, widget):
"""Broadcast group changed"""
selected = widget.get_active()
if selected == 0:
value = 'all'
elif selected == 2:
value = 'off'
else:
value = 'group'
self.config['broadcast_group'] = value
self.config.save()
def on_winstatecombo_changed(self, widget): def on_winstatecombo_changed(self, widget):
"""Window state changed""" """Window state changed"""
selected = widget.get_active() selected = widget.get_active()

View File

@ -56,10 +56,10 @@ class Terminator(Borg):
self.terminals = [] self.terminals = []
if not self.groups: if not self.groups:
self.groups = [] self.groups = []
if self.groupsend == None:
self.groupsend = self.groupsend_type['off']
if not self.config: if not self.config:
self.config = Config() self.config = Config()
if self.groupsend == None:
self.groupsend = self.groupsend_type[self.config['broadcast_group']]
if not self.keybindings: if not self.keybindings:
self.keybindings = Keybindings() self.keybindings = Keybindings()
self.keybindings.configure(self.config['keybindings']) self.keybindings.configure(self.config['keybindings'])
@ -370,6 +370,9 @@ class Terminator(Borg):
if maker.isinstance(child, 'Notebook'): if maker.isinstance(child, 'Notebook'):
child.configure() child.configure()
# Set broadcasting group
self.groupsend = self.groupsend_type[self.config['broadcast_group']]
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: