EventIcon: Have a default create_palette method

The create_palette mechanism allows to create
palettes on demand and not for each icon upfront
whether it will be needed or not.

If you hover over an EventIcon and there is no
palette already associated with the Invoker, the Invoker
will call create_palette to see if it can be created
on demand. With this patch the EventIcon will return None
here (see as well CellRendererIcon or ToggleToolButton which
are having the same default behavior).
When subclassing EventIcon the create_palette method can
be overwritten and a Palette returned (see for example
the ActivityIcon in the HomeView).

Without this patch you can see tracebacks when hovering
over the EventIcon because the Invoker tries to call
create_palette.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Benjamin Berg <benzea@sugarlabs.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
This commit is contained in:
Simon Schampijer 2012-06-21 10:31:48 +02:00
parent 020917ac02
commit 61d54cf7e2

View File

@ -594,6 +594,9 @@ class EventIcon(Gtk.EventBox):
icon = GObject.property(
type=object, getter=get_icon)
def create_palette(self):
return None
def get_palette(self):
return self._palette_invoker.palette