Add activate signal to CellRendererIcon

This commit is contained in:
Tomeu Vizoso 2009-06-06 16:24:49 +02:00
parent 765de62ab8
commit a634ecfe14

View File

@ -922,6 +922,10 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
class CellRendererIcon(gtk.CellRendererPixbuf): class CellRendererIcon(gtk.CellRendererPixbuf):
__gtype_name__ = 'SugarCellRendererIcon' __gtype_name__ = 'SugarCellRendererIcon'
__gsignals__ = {
'activate': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, [object])
}
def __init__(self): def __init__(self):
gobject.GObject.__init__(self) gobject.GObject.__init__(self)
self._buffer = _IconBuffer() self._buffer = _IconBuffer()
@ -983,6 +987,9 @@ class CellRendererIcon(gtk.CellRendererPixbuf):
gtk.CellRendererPixbuf.do_render(self, window, widget, background_area, cell_area, expose_area, flags) gtk.CellRendererPixbuf.do_render(self, window, widget, background_area, cell_area, expose_area, flags)
def do_activate(self, event, widget, path, background_area, cell_area, flags):
self.emit('activate', path)
def get_icon_state(base_name, perc, step=5): def get_icon_state(base_name, perc, step=5):
strength = round(perc / step) * step strength = round(perc / step) * step
icon_theme = gtk.icon_theme_get_default() icon_theme = gtk.icon_theme_get_default()