GNOME Bugzilla – Bug 362850
(Py)Extensions should have initialize() and finalize() methods
Last modified: 2011-02-01 16:19:23 UTC
Extensions currently can implement attach/detach tab/window callbacks, but if I want to do a one-off initialization for the extension (and not do the initialization on each window) then I am currently doing: ------------------------------------ window_count = 0 def attach_window(window): global window_count if window_count == 0: do_init() window_count += 1 def detach_window(window): global window_count window_count -= 1 if window_count == 0: do_cleanup() ------------------------------------ Which works AFAICT, but seems hackish. It might be cleaner if there were explicit extension_initialize() and extension_finalize() callbacks. As raised on the mailing list at http://mail.gnome.org/archives/epiphany-list/2006-October/msg00013.html
For C extensions, this is provided by them being GObjects (implementing EphyExtension), so you can do your stuff in the init/finalize methods. Kikidonk was going to make python extensions also be objects, but hasn't had the time to do so.