From 1961fe1d49f0cd22f42cd894764b98cba2a9fc26 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 27 Jan 2009 00:31:48 +0000 Subject: [PATCH] add support for an icon in the group label --- terminatorlib/terminatorterm.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 6d139ce6..95e04c6c 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -45,15 +45,18 @@ class TerminatorTermTitle (gtk.EventBox): _group = None _separator = None _hbox = None + _icon = None def __init__ (self): gtk.EventBox.__init__ (self) self._title = gtk.Label () self._group = gtk.Label () self._separator = gtk.VSeparator () + self._icon = gtk.Image () self._hbox = gtk.HBox () - self._hbox.pack_start (self._group, False, True) + self._hbox.pack_start (self._icon, False, True, 2) + self._hbox.pack_start (self._group, False, True, 2) self._hbox.pack_start (self._separator, False, True, 2) self._hbox.pack_start (self._title, True, True) self.add (self._hbox) @@ -83,6 +86,15 @@ class TerminatorTermTitle (gtk.EventBox): """Set the foreground color of the titlebar""" self._title.modify_fg (color) + def set_from_icon_name (self, name, size = gtk.ICON_SIZE_MENU): + """Set an icon for the group label""" + if not name: + self._icon.hide () + return + + self._icon.set_from_icon_name (APP_NAME + name, size) + self._icon.show () + class TerminatorTerm (gtk.VBox): matches = {}