(trunk-1564) Merge default broadcast behaviour toggle by Jiri (jtyr) - fixes lp #1288835

This commit is contained in:
Stephen Boddy 2015-06-22 20:06:21 +02:00
parent e4edaa1ffa
commit 29a412ee0f
5 changed files with 82 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.
Default value: \fBtop\fR
.TP
.B broadcast_default
Defines default broadcast behavior. Can be any of: all, group, off.
Default value: \fBgroup\fR
.TP
.B close_button_on_tab \fR(boolean)
If set to True, tabs will have a close button on them.
Default value: \fBTrue\fR

View File

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

View File

@ -256,6 +256,23 @@
</row>
</data>
</object>
<object class="GtkListStore" id="BroadcastDefaultListStore">
<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">
<columns>
<!-- column-name state -->
@ -530,6 +547,42 @@
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label41">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Broadcast default</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="broadcastdefault">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">BroadcastDefaultListStore</property>
<property name="active">0</property>
<signal name="changed" handler="on_broadcastdefault_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>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>

View File

@ -247,6 +247,16 @@ class PrefsEditor:
else:
active = 0
widget.set_active(active)
# Broadcast default
option = self.config['broadcast_default']
widget = guiget('broadcastdefault')
if option == 'all':
active = 0
elif option == 'off':
active = 2
else:
active = 1
widget.set_active(active)
# scroll_tabbar
widget = guiget('scrolltabbarcheck')
widget.set_active(self.config['scroll_tabbar'])
@ -958,6 +968,18 @@ class PrefsEditor:
self.config['tab_position'] = value
self.config.save()
def on_broadcastdefault_changed(self, widget):
"""Broadcast default changed"""
selected = widget.get_active()
if selected == 0:
value = 'all'
elif selected == 2:
value = 'off'
else:
value = 'group'
self.config['broadcast_default'] = value
self.config.save()
def on_winstatecombo_changed(self, widget):
"""Window state changed"""
selected = widget.get_active()

View File

@ -71,10 +71,10 @@ class Terminator(Borg):
self.terminals = []
if not self.groups:
self.groups = []
if self.groupsend == None:
self.groupsend = self.groupsend_type['group']
if not self.config:
self.config = Config()
if self.groupsend == None:
self.groupsend = self.groupsend_type[self.config['broadcast_default']]
if not self.keybindings:
self.keybindings = Keybindings()
self.keybindings.configure(self.config['keybindings'])