Palette: handle the case where setting the transient window does fail, SL #4221

The expected parent window did likely change, for example
this can happen when we switch the Home Views while a Palette
of a canvas icon is popping up (SL #4221). In that case
send the 'popdown' signal so that for example the hovering
state feedback can be cleared.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
This commit is contained in:
Simon Schampijer 2013-03-14 12:00:22 +01:00
parent dcbdcd77fe
commit b3048112d6

View File

@ -623,7 +623,13 @@ class PaletteWindow(GObject.GObject):
self._alignment = self._invoker.get_alignment(full_size_request) self._alignment = self._invoker.get_alignment(full_size_request)
self.update_position() self.update_position()
try:
self._widget.set_transient_for(self._invoker.get_toplevel()) self._widget.set_transient_for(self._invoker.get_toplevel())
except TypeError:
# the expected parent window did likely change e.g. SL #4221
# popdown the Palette
self.emit('popdown')
return
self._popdown_anim.stop() self._popdown_anim.stop()