After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 362850 - (Py)Extensions should have initialize() and finalize() methods
(Py)Extensions should have initialize() and finalize() methods
Status: RESOLVED OBSOLETE
Product: epiphany
Classification: Core
Component: [obsolete] Bindings:Python
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-10-17 13:16 UTC by Nigel Tao
Modified: 2011-02-01 16:19 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Nigel Tao 2006-10-17 13:16:41 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
Comment 1 Christian Persch 2006-10-17 19:31:45 UTC
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.