Apply a slightly modified version of Mike Miller's patch to improve backwards compatibility with older pygtk. Closes LP #589216

This commit is contained in:
Chris Jones 2010-06-30 11:33:34 +01:00
parent 29ee8ace1b
commit 5fb0f518c8
1 changed files with 24 additions and 3 deletions

View File

@ -8,7 +8,6 @@ import pygtk
pygtk.require('2.0')
import gobject
import gtk
import glib
from util import dbg, err
import util
@ -36,7 +35,15 @@ class Window(Container, gtk.Window):
hidefunc = None
zoom_data = None
term_zoomed = gobject.property(type=bool, default=False)
term_zoomed = False
__gproperties__ = {
'term_zoomed': (gobject.TYPE_BOOLEAN,
'terminal zoomed',
'whether the terminal is zoomed',
False,
gobject.PARAM_READWRITE)
}
def __init__(self):
"""Class initialiser"""
@ -70,6 +77,20 @@ class Window(Container, gtk.Window):
err('Window::__init__: Unable to parse geometry: %s' %
options.geometry)
def do_get_property(self, prop):
"""Handle gobject getting a property"""
if prop.name in ['term_zoomed', 'term-zoomed']:
return(self.term_zoomed)
else:
raise AttributeError('unknown property %s' % prop.name)
def do_set_property(self, prop, value):
"""Handle gobject setting a property"""
if prop.name in ['term_zoomed', 'term-zoomed']:
self.term_zoomed = value
else:
raise AttributeError('unknown property %s' % prop.name)
def register_callbacks(self):
"""Connect the GTK+ signals we care about"""
self.connect('key-press-event', self.on_key_press)
@ -125,7 +146,7 @@ class Window(Container, gtk.Window):
try:
icon = icon_theme.load_icon(APP_NAME, 48, 0)
except (NameError, glib.GError):
except (NameError, gobject.GError):
dbg('Unable to load 48px Terminator icon')
icon = self.render_icon(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON)