Fix scrollbar position on current terminals when changed in prefs

This commit is contained in:
Stephen Boddy 2015-12-02 21:12:59 +01:00
parent fc6e3e7e65
commit 4ac75317e7
1 changed files with 10 additions and 23 deletions

View File

@ -78,7 +78,6 @@ class Terminal(Gtk.VBox):
vte = None vte = None
terminalbox = None terminalbox = None
scrollbar = None scrollbar = None
scrollbar_position = None
titlebar = None titlebar = None
searchbar = None searchbar = None
@ -241,19 +240,9 @@ class Terminal(Gtk.VBox):
terminalbox = Gtk.HBox() terminalbox = Gtk.HBox()
self.scrollbar = Gtk.VScrollbar(self.vte.get_vadjustment()) self.scrollbar = Gtk.VScrollbar(self.vte.get_vadjustment())
self.scrollbar.set_no_show_all(True)
self.scrollbar_position = self.config['scrollbar_position']
if self.scrollbar_position not in ('hidden', 'disabled'): terminalbox.pack_start(self.vte, True, True, 0)
self.scrollbar.show() terminalbox.pack_start(self.scrollbar, False, True, 0)
if self.scrollbar_position == 'left':
func = terminalbox.pack_end
else:
func = terminalbox.pack_start
func(self.vte, True, True, 0)
func(self.scrollbar, False, True, 0)
terminalbox.show_all() terminalbox.show_all()
return(terminalbox) return(terminalbox)
@ -775,16 +764,14 @@ class Terminal(Gtk.VBox):
self.vte.set_scroll_on_keystroke(self.config['scroll_on_keystroke']) self.vte.set_scroll_on_keystroke(self.config['scroll_on_keystroke'])
self.vte.set_scroll_on_output(self.config['scroll_on_output']) self.vte.set_scroll_on_output(self.config['scroll_on_output'])
if self.scrollbar_position != self.config['scrollbar_position']: if self.config['scrollbar_position'] in ['disabled', 'hidden']:
self.scrollbar_position = self.config['scrollbar_position'] self.scrollbar.hide()
if self.config['scrollbar_position'] in ['disabled', 'hidden']: else:
self.scrollbar.hide() self.scrollbar.show()
else: if self.config['scrollbar_position'] == 'left':
self.scrollbar.show() self.terminalbox.reorder_child(self.scrollbar, 0)
if self.config['scrollbar_position'] == 'left': # FIXME FOR GTK3: moving the scrollbar to the other side (by changing prefs) doesn't work elif self.config['scrollbar_position'] == 'right':
self.reorder_child(self.scrollbar, 0) self.terminalbox.reorder_child(self.vte, 0)
elif self.config['scrollbar_position'] == 'right':
self.reorder_child(self.vte, 0)
self.vte.set_rewrap_on_resize(self.config['rewrap_on_resize']) self.vte.set_rewrap_on_resize(self.config['rewrap_on_resize'])