migrate titlebar wantedness to the titlebar class

This commit is contained in:
Chris Jones 2009-01-30 11:42:28 +00:00
parent 01d4602d43
commit 4f8a3a8d34
1 changed files with 12 additions and 4 deletions

View File

@ -41,6 +41,7 @@ except ImportError:
sys.exit (1) sys.exit (1)
class TerminatorTermTitle (gtk.EventBox): class TerminatorTermTitle (gtk.EventBox):
wanted = None
_title = None _title = None
_group = None _group = None
_separator = None _separator = None
@ -95,13 +96,20 @@ class TerminatorTermTitle (gtk.EventBox):
self._icon.set_from_icon_name (APP_NAME + name, size) self._icon.set_from_icon_name (APP_NAME + name, size)
self._icon.show () self._icon.show ()
def update (self):
"""Update our state"""
parent = self.get_parent ()
if parent._group:
self.set_group_label (parent._group)
else:
self.set_group_label (None)
class TerminatorTerm (gtk.VBox): class TerminatorTerm (gtk.VBox):
matches = {} matches = {}
TARGET_TYPE_VTE = 8 TARGET_TYPE_VTE = 8
_custom_font_size = None _custom_font_size = None
_group = None _group = None
_want_titlebar = False
focus = None focus = None
def __init__ (self, terminator, profile = None, command = None, cwd = None): def __init__ (self, terminator, profile = None, command = None, cwd = None):
@ -178,7 +186,7 @@ class TerminatorTerm (gtk.VBox):
if self.conf.titlebars: if self.conf.titlebars:
self._titlebox.show() self._titlebox.show()
self._want_titlebar = True self._titlebox.wanted = True
else: else:
self._titlebox.hide() self._titlebox.hide()
@ -747,7 +755,7 @@ text/plain
self.toggle_widget_visibility (self._scrollbar) self.toggle_widget_visibility (self._scrollbar)
def do_title_toggle (self): def do_title_toggle (self):
self._want_titlebar = not self._titlebox.get_property ('visible') self._titlebox.wanted = not self._titlebox.get_property ('visible')
self.toggle_widget_visibility (self._titlebox) self.toggle_widget_visibility (self._titlebox)
def toggle_widget_visibility (self, widget): def toggle_widget_visibility (self, widget):
@ -1271,7 +1279,7 @@ text/plain
self._group = data self._group = data
if data == None: if data == None:
# We have been removed from a group # We have been removed from a group
if not self.conf.titlebars and not self._want_titlebar: if not self.conf.titlebars and not self._titlebox.wanted:
self._titlebox.hide () self._titlebox.hide ()
self.terminator.group_hoover () self.terminator.group_hoover ()