[Sugar-devel] [PATCH v2 sugar] Frame: show application-set icon for non-Sugar windows
sascha-ml-reply-to-2010-3 at silbe.org
Mon Sep 20 13:32:40 EDT 2010
Excerpts from James Cameron's message of Mon Sep 20 02:48:08 +0200 2010:
> > + def _icon_changed_cb(self, window):
> > + gobject.idle_add(self._update_icon, window)
> I'm puzzled. Why defer the update to an idle task? If it is because of
> a race, I'm worried this won't fix it.
I don't remember why I did it that way originally. Maybe it was from
when I triggered it (only) from __init__() instead of listening to the
It works fine without the idle task on both XO-1.5 and regular PC, so
let's just remove it.
> > + def _update_icon(self, window):
> > + logging.debug('_update_icon: start')
> > + pixbuf = window.get_icon()
> > + if pixbuf is None:
> > + return
> When a function is an idle task, the return value has significance, so
> I'm not sure if a bare return is the right thing here.
While it does work (bare return is actually return None which gets
evaluated to False in boolean contexts), it would be bad style.
But removing the idle task already takes care of that. :)
> > + self._icon.props.file = util.TempFilePath(path)
> > + logging.debug('_update_icon: updated icon')
> When are these files cleaned up?
sugar.util.TempFilePath is a wrapper around a file name that removes
the file when the name gets garbage-collected. So the file should
disappear on the first garbage collection run after the window was
closed or a new icon assigned.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 490 bytes
Desc: not available
Url : http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100920/154bcc1d/attachment.pgp
More information about the Sugar-devel