Integrate modified patch from chantra with some changes so titlebars and title tooltips are configurable via terminatorrc (or in theory gconf, but that's a violation of a schema violation

This commit is contained in:
Chris Jones 2008-03-01 01:14:32 +00:00
parent 4b6094fbe5
commit 8f9b2b1804
1 changed files with 36 additions and 8 deletions

View File

@ -96,6 +96,8 @@ class TerminatorTerm:
defaults = { defaults = {
'gt_dir' : '/apps/gnome-terminal', 'gt_dir' : '/apps/gnome-terminal',
'_profile_dir' : '%s/profiles', '_profile_dir' : '%s/profiles',
'titlebars' : True,
'titletips' : False,
'allow_bold' : True, 'allow_bold' : True,
'silent_bell' : True, 'silent_bell' : True,
'background_color' : '#000000', 'background_color' : '#000000',
@ -175,17 +177,30 @@ class TerminatorTerm:
self.reconfigure_vte () self.reconfigure_vte ()
self._vte.show () self._vte.show ()
self._box = gtk.HBox () #self._box = gtk.HBox ()
self._box.show () #self._box.show ()
self._termbox = gtk.HBox ()
self._termbox.show()
if self.defaults['titlebars']:
self._title = gtk.Label()
self._title.show()
self._box = gtk.VBox ()
self._box.show()
self._box.pack_start(self._title, False)
self._box.pack_start(self._termbox)
else:
self._box = self._termbox
self._scrollbar = gtk.VScrollbar (self._vte.get_adjustment ()) self._scrollbar = gtk.VScrollbar (self._vte.get_adjustment ())
if self.scrollbar_position != "hidden" and self.scrollbar_position != "disabled": if self.scrollbar_position != "hidden" and self.scrollbar_position != "disabled":
self._scrollbar.show () self._scrollbar.show ()
if self.scrollbar_position == 'right': if self.scrollbar_position == 'right':
packfunc = self._box.pack_start packfunc = self._termbox.pack_start
else: else:
packfunc = self._box.pack_end packfunc = self._termbox.pack_end
packfunc (self._vte) packfunc (self._vte)
packfunc (self._scrollbar, False) packfunc (self._scrollbar, False)
@ -194,7 +209,7 @@ class TerminatorTerm:
self._vte.connect ("button-press-event", self.on_vte_button_press) self._vte.connect ("button-press-event", self.on_vte_button_press)
self._vte.connect ("popup-menu", self.on_vte_popup_menu) self._vte.connect ("popup-menu", self.on_vte_popup_menu)
self._vte.connect ("composited-changed", self.on_composited_changed) self._vte.connect ("composited-changed", self.on_composited_changed)
# self._vte.connect ("window-title-changed", self.on_vte_title_change) self._vte.connect ("window-title-changed", self.on_vte_title_change)
exit_action = self.gconf_client.get_string (self.profile + "/exit_action") exit_action = self.gconf_client.get_string (self.profile + "/exit_action")
exit_action = self.reconf ("exit_action") exit_action = self.reconf ("exit_action")
@ -422,6 +437,11 @@ class TerminatorTerm:
else: else:
self._scrollbar.show () self._scrollbar.show ()
def do_title_toggle (self):
if self._title.get_property ('visible'):
self._title.hide ()
else:
self._title.show ()
#keybindings for the individual splited terminals (affects only the #keybindings for the individual splited terminals (affects only the
#the selected terminal) #the selected terminal)
def on_vte_key_press (self, term, event): def on_vte_key_press (self, term, event):
@ -548,6 +568,11 @@ class TerminatorTerm:
item.connect ("toggled", lambda menu_item: self.do_scrollbar_toggle ()) item.connect ("toggled", lambda menu_item: self.do_scrollbar_toggle ())
menu.append (item) menu.append (item)
item = gtk.CheckMenuItem (_("Show Title"))
item.set_active (self._title.get_property ('visible'))
item.connect ("toggled", lambda menu_item: self.do_title_toggle ())
menu.append (item)
item = gtk.MenuItem () item = gtk.MenuItem ()
menu.append (item) menu.append (item)
@ -570,8 +595,11 @@ class TerminatorTerm:
return menu return menu
def on_vte_title_change(self, vte): def on_vte_title_change(self, vte):
vte.set_property ("has-tooltip", True) if self.reconf ('titletips'):
vte.set_property ("tooltip-text", vte.get_window_title ()) vte.set_property ("has-tooltip", True)
vte.set_property ("tooltip-text", vte.get_window_title ())
if self.reconf ('titlebars'):
self._title.set_text(vte.get_window_title ())
def get_box (self): def get_box (self):
return self._box return self._box