Rather than having people use an ugly value of -1 for infinite scrollback, have it as a separate setting, with all of the extra gubbins involved in making that work neatly. Closes LP #532513

This commit is contained in:
Chris Jones 2010-03-24 13:22:37 +00:00
parent 82af1ddba8
commit bbdf055477
4 changed files with 47 additions and 8 deletions

View File

@ -173,6 +173,7 @@ DEFAULTS = {
'scroll_on_keystroke' : True,
'scroll_on_output' : True,
'scrollback_lines' : 500,
'scrollback_infinite' : False,
'exit_action' : 'close',
'palette' :'#000000000000:#cdcd00000000:#0000cdcd0000:\
#cdcdcdcd0000:#30bf30bfa38e:#a53c212fa53c:\

View File

@ -2153,7 +2153,7 @@
<object class="GtkTable" id="table27">
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="n_rows">4</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@ -2169,8 +2169,8 @@
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
@ -2186,8 +2186,8 @@
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
@ -2242,7 +2242,7 @@
<object class="GtkLabel" id="scrollback_lines_spinbutton_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">lines &lt;small&gt;&lt;b&gt;(Note: for infinite scrollback choose -1)&lt;/b&gt;&lt;/small&gt;</property>
<property name="label" translatable="yes">lines</property>
<property name="use_markup">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">scrollback_lines_spinbutton</property>
@ -2293,6 +2293,27 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkCheckButton" id="scrollback_infinite">
<property name="label" translatable="yes">Infinite Scrollback</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_scrollback_infinite_toggled"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
</object>
<packing>
<property name="position">4</property>
@ -2867,7 +2888,6 @@
<property name="page_increment">0.20000000000000001</property>
</object>
<object class="GtkAdjustment" id="ScrollbackAdjustmend">
<property name="lower">-1</property>
<property name="upper">10000000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>

View File

@ -380,6 +380,9 @@ class PrefsEditor:
# Scrollback lines
widget = guiget('scrollback_lines_spinbutton')
widget.set_value(self.config['scrollback_lines'])
# Scrollback infinite
widget = guiget('scrollback_infinite')
widget.set_active(self.config['scrollback_infinite'])
# Scroll on outut
widget = guiget('scroll_on_output_checkbutton')
widget.set_active(self.config['scroll_on_output'])
@ -519,6 +522,17 @@ class PrefsEditor:
self.config['scrollback_lines'] = value
self.config.save()
def on_scrollback_infinite_toggled(self, widget):
"""Scrollback infiniteness changed"""
spinbutton = self.builder.get_object('scrollback_lines_spinbutton')
value = widget.get_active()
if value == True:
spinbutton.set_sensitive(False)
else:
spinbutton.set_sensitive(True)
self.config['scrollback_infinite'] = value
self.config.save()
def on_scrollbar_position_combobox_changed(self, widget):
"""Scrollbar position setting changed"""
selected = widget.get_active()

View File

@ -629,7 +629,11 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
except TypeError:
err('beep signal unavailable with this version of VTE')
self.vte.set_scrollback_lines(self.config['scrollback_lines'])
if self.config['scrollback_infinite'] == True:
scrollback_lines = -1
else:
scrollback_lines = self.config['scrollback_lines']
self.vte.set_scrollback_lines(scrollback_lines)
self.vte.set_scroll_on_keystroke(self.config['scroll_on_keystroke'])
self.vte.set_scroll_on_output(self.config['scroll_on_output'])