Track gnome-terminal scrollbar position settings. Fixes 185051

This commit is contained in:
Chris Jones 2008-02-02 01:49:32 +00:00
parent 8069b83bef
commit ea73696330
1 changed files with 35 additions and 5 deletions

View File

@ -82,7 +82,7 @@ class TerminatorTerm:
'emulation' : 'xterm', 'emulation' : 'xterm',
'font' : 'Serif 10', 'font' : 'Serif 10',
'foreground_color' : '#AAAAAA', 'foreground_color' : '#AAAAAA',
'scrollbar' : True, 'scrollbar_position' : "right",
'scroll_background' : True, 'scroll_background' : True,
'scroll_on_keystroke' : False, 'scroll_on_keystroke' : False,
'scroll_on_output' : False, 'scroll_on_output' : False,
@ -137,18 +137,27 @@ class TerminatorTerm:
self.clipboard = gtk.clipboard_get (gtk.gdk.SELECTION_CLIPBOARD) self.clipboard = gtk.clipboard_get (gtk.gdk.SELECTION_CLIPBOARD)
self.scrollbar_position = self.reconf ('scrollbar_position')
self._vte = vte.Terminal () self._vte = vte.Terminal ()
self._vte.set_size (80, 24) self._vte.set_size (80, 24)
self.reconfigure_vte () self.reconfigure_vte ()
self._vte.show () self._vte.show ()
self._box = gtk.HBox () self._box = gtk.HBox ()
self._box.show ()
self._scrollbar = gtk.VScrollbar (self._vte.get_adjustment ()) self._scrollbar = gtk.VScrollbar (self._vte.get_adjustment ())
if self.defaults['scrollbar']: if self.scrollbar_position != "disabled":
self._scrollbar.show () self._scrollbar.show ()
self._box.pack_start (self._vte) if self.scrollbar_position == 'right':
self._box.pack_start (self._scrollbar, False) packfunc = self._box.pack_start
else:
packfunc = self._box.pack_end
packfunc (self._vte)
packfunc (self._scrollbar, False)
self._vte.connect ("key-press-event", self.on_vte_key_press) self._vte.connect ("key-press-event", self.on_vte_key_press)
self._vte.connect ("button-press-event", self.on_vte_button_press) self._vte.connect ("button-press-event", self.on_vte_button_press)
@ -304,6 +313,27 @@ class TerminatorTerm:
self._vte.set_scroll_on_keystroke (self.reconf ('scroll_on_keystroke')) self._vte.set_scroll_on_keystroke (self.reconf ('scroll_on_keystroke'))
self._vte.set_scroll_on_output (self.reconf ('scroll_on_output')) self._vte.set_scroll_on_output (self.reconf ('scroll_on_output'))
scrollbar_position = self.reconf ('scrollbar_position')
if scrollbar_position != self.scrollbar_position:
if scrollbar_position == 'disabled':
self._scrollbar.hide ()
if scrollbar_position == 'right':
self._box.remove (self._scrollbar)
self._box.remove (self._vte)
self._box.pack_start (self._vte)
self._box.pack_start (self._scrollbar)
self._scrollbar.show ()
elif scrollbar_position == 'left':
self._box.remove (self._vte)
self._box.remove (self._scrollbar)
self._box.pack_start(self._scrollbar)
self._box.pack_start(self._vte)
self._scrollbar.show ()
self._vte.show ()
self.scrollbar_position = scrollbar_position
# Set our sloppiness # Set our sloppiness
self.focus = self.gconf_client.get_string ("/apps/metacity/general/focus_mode") or self.defaults['focus'] self.focus = self.gconf_client.get_string ("/apps/metacity/general/focus_mode") or self.defaults['focus']
@ -502,7 +532,7 @@ class Terminator:
self.term_list = [term] self.term_list = [term]
self.window.add (term.get_box ()) self.window.add (term.get_box ())
self.window.show_all () self.window.show ()
def maximize (self): def maximize (self):
""" Maximize the Terminator.""" """ Maximize the Terminator."""