put the group image and label into sufficient gtk boxes that they can match the styling of the rest of the titlebar

This commit is contained in:
Chris Jones 2009-07-13 23:53:57 +01:00
parent 2a5cffb63f
commit 715bb639e2

View File

@ -51,6 +51,8 @@ class TerminatorTermTitle (gtk.EventBox):
_group = None _group = None
_separator = None _separator = None
_hbox = None _hbox = None
_ebox = None
_grouphbox = None
_icon = None _icon = None
_parent = None _parent = None
_unzoomed_title = None _unzoomed_title = None
@ -62,6 +64,8 @@ class TerminatorTermTitle (gtk.EventBox):
self._title = gtk.Label () self._title = gtk.Label ()
self._group = gtk.Label () self._group = gtk.Label ()
self._separator = gtk.VSeparator () self._separator = gtk.VSeparator ()
self._ebox = gtk.EventBox ()
self._grouphbox = gtk.HBox ()
self._icon = gtk.Image () self._icon = gtk.Image ()
self._hbox = gtk.HBox () self._hbox = gtk.HBox ()
@ -76,8 +80,12 @@ class TerminatorTermTitle (gtk.EventBox):
self.set_from_icon_name (APP_NAME + \ self.set_from_icon_name (APP_NAME + \
'_active_broadcast_off', gtk.ICON_SIZE_MENU) '_active_broadcast_off', gtk.ICON_SIZE_MENU)
self._hbox.pack_start (self._icon, False, True, 2) self._grouphbox.pack_start (self._icon, False, True, 2)
self._hbox.pack_start (self._group, False, True, 2) self._grouphbox.pack_start (self._group, False, True, 2)
self._ebox.add (self._grouphbox)
self._ebox.show_all ()
self._hbox.pack_start (self._ebox, False, True, 2)
self._hbox.pack_start (self._separator, False, True, 2) self._hbox.pack_start (self._separator, False, True, 2)
self._hbox.pack_start (self._title, True, True) self._hbox.pack_start (self._title, True, True)
self.add (self._hbox) self.add (self._hbox)
@ -89,6 +97,9 @@ class TerminatorTermTitle (gtk.EventBox):
self.connect ("button-release-event", self.on_clicked) self.connect ("button-release-event", self.on_clicked)
def connect_icon (self, func):
self._ebox.connect ("button-release-event", func)
def on_clicked (self, widget, event): def on_clicked (self, widget, event):
if self._parent is not None: if self._parent is not None:
self._parent._vte.grab_focus () self._parent._vte.grab_focus ()
@ -124,6 +135,7 @@ class TerminatorTermTitle (gtk.EventBox):
def set_background_color (self, color): def set_background_color (self, color):
"""Set the background color of the titlebar""" """Set the background color of the titlebar"""
self.modify_bg (gtk.STATE_NORMAL, color) self.modify_bg (gtk.STATE_NORMAL, color)
self._ebox.modify_bg (gtk.STATE_NORMAL, color)
def set_foreground_color (self, color): def set_foreground_color (self, color):
"""Set the foreground color of the titlebar""" """Set the foreground color of the titlebar"""
@ -297,7 +309,7 @@ class TerminatorTerm (gtk.VBox):
self._vte.connect ("resize-window", self.on_resize_window) self._vte.connect ("resize-window", self.on_resize_window)
self._vte.connect ("size-allocate", self.on_vte_size_allocate) self._vte.connect ("size-allocate", self.on_vte_size_allocate)
self._titlebox.connect ("button-release-event", self.on_group_button_press) self._titlebox.connect_icon (self.on_group_button_press)
exit_action = self.conf.exit_action exit_action = self.conf.exit_action
if exit_action == "restart": if exit_action == "restart":