bare minimum titlebar functionality

This commit is contained in:
Chris Jones 2009-09-02 22:38:27 +01:00
parent 9f7834fb5b
commit d007bc45c5

View File

@ -6,18 +6,47 @@
import gtk
import gobject
from editablelabel import EditableLabel
# pylint: disable-msg=R0904
class Titlebar(gtk.EventBox):
"""Class implementing the Titlebar widget"""
oldtitle = None
termtext = None
sizetext = None
label = None
hbox = None
ebox = None
grouphbox = None
groupicon = None
grouplabel = None
def __init__(self):
"""Class initialiser"""
gtk.EventBox.__init__(self)
self.__gobject_init__()
self.show()
self.label = EditableLabel()
self.ebox = gtk.EventBox()
self.grouphbox = gtk.HBox()
self.grouplabel = gtk.Label()
self.groupicon = gtk.Image()
# FIXME: How do we decide which icon to use?
self.grouphbox.pack_start(self.groupicon, False, True, 2)
self.grouphbox.pack_start(self.grouplabel, False, True, 2)
self.ebox.add(self.grouphbox)
self.ebox.show_all()
self.hbox = gtk.HBox()
self.hbox.pack_start(self.ebox, False, True, 0)
self.hbox.pack_start(gtk.VSeparator(), False, True, 0)
self.hbox.pack_start(self.label, True, True)
self.add(self.hbox)
self.show_all()
def connect_icon(self, func):
"""Connect the supplied function to clicking on the group icon"""
@ -25,14 +54,28 @@ class Titlebar(gtk.EventBox):
def update(self):
"""Update our contents"""
pass
self.label.set_text("%s %s" % (self.termtext, self.sizetext))
def update_terminal_size(self, width, height):
"""Update the displayed terminal size"""
pass
self.sizetext = "%sx%s" % (width, height)
self.update()
def set_terminal_title(self, widget, title):
"""Update the terminal title"""
self.termtext = title
self.update()
def set_group_label(self, name):
"""Set the name of the group"""
if name:
self.grouplabel.set_text(name)
self.grouplabel.show()
else:
self.grouplabel.hide()
def on_clicked(self, widget, event):
"""Handle a click on the label"""
pass
gobject.type_register(Titlebar)