Re: extensions one-off activation - attach_window / detach_window the way to go?



On Mon, 2006-16-10 at 10:15 +1000, Nigel Tao wrote:

> 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()
> ------------------------------------
> 
> I was just wondering if this would be the right way to go about it, or
> is this not thread-safe (are extensions (and their event handlers) run
> single-threadedly??) or is there an extension_activated signal that I
> can listen for?

What you're doing seems like a reasonable workaround. Also, in the long
run it might be a good idea for Epiphany to search for and execute
initialize() and finalize() methods on extensions: could you please file
a bug for that?

As for threads: Epiphany itself is multi-threaded, but all the extension
callbacks (attach/detach_window, attach/detach_tab) are run in the main,
GUI thread. In fact, I think all GLib signals within Epiphany are only
emitted from the main thread. (I'm not 100% sure of that, though -- just
around 95% sure.)

-- 
Adam Hooper
adamh densi com

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]