Here is the scenario:
- Add a widget to home screen (python gtk widget)
- Add a timeout_add_seconds function to trigger regular refreshes (check servers for rss updates)
- Remove the widget from the home screen
The problem when doing so, the widget stays in memory and the function keeps getting called.
Is there a signal, or a property, that can be checked to make sure the widget is still on the home screen?
Disclaimer: I'm **** at Python and I've never created a GObject in Python. I've made my fair share in (rather ****) C, though.
In C, you'd remove timeout sources in the finalize/dispose function. In PyGObject, I have no idea how you override them. Probably due to Python's automatic memory management - after all, who needs to worry about this ****?!
Anyway, gtk.Object offers a "destroy" signal. Guess what it does and when it's invoked
It works, but there may be better ways of doing this.
P.S. I don't know what this timer does, but if it's not needed when the focus is not on the desktop, connect to the "notify::is-on-current-desktop" signal.