Re: [Gtk-osx-users] Custom URL Handler



Eric,

  Thanks for your response; my comments are inline.

On Aug 25, 2010, at 7:20 AM, Eric Le Lay wrote:

> Hi Phil,
> 
> I've done something similar a while ago : let gPodder handle "Subscribe to RSS feed" from Firefox.
> But I resorted to Carbon.AppleEvents to do it (deprecated I'm afraid).
> In case you want to check it out, here it is : 
> http://repo.or.cz/w/gpodder.git/blob/refs/heads/master:/src/gpodder/gpodderosx.py
> and
> http://repo.or.cz/w/gpodder.git/tree/refs/heads/master:/data/osx

Yes, I had thought about AppleEvents as well, but I'm trying hard to eliminate Carbon.  Nevertheless, thanks for the concrete example.

<snip>

> Did you try with your application not open ?
> From what I understand of your code, it's not possible, but my code doesn't work when the application is open (the event is not received).
> The fact that your application gains focus is encouraging.
> Maybe, when you'll be able to see debug output, it'll be easier to figure out (see next bullet).

I did not try it with the application not open.  I believe the application gains focus because of the CFBundleURLTypes key in the Info.plist.

Regardless, I've figured out why it isn't working.  Unfortunately, I'd need to run the NSApp mainloop from pyObjC for this NSURLProtocol handler to receive events.  I suppose it could be done within another thread, but then I'd have to use gtk.gdk.threads, which seem to block at application exit on Mac OS.

Further, I don't think it should be necessary to execute the mainloop from two application frameworks to make this happen.

If you're reading this, John, any chance we could get a method in OSXApplication to install a handler for NSURLProtocol?

> 
>> I'm not sure how exactly to debug this either -- normally I do my development within Eclipse with pydev, though I'm not sure how to do that with a bundled application.  Any attempts to print to STDOUT within TrytonURLProtocol methods seem to fail.
>> 
> Did you check in console.log (via /Applications/Utilities/Console) ?

I thought I did, but I guess I didn't.  Output definitely goes there.  Thanks for reminding me.

Regards,

  --phil

Attachment: smime.p7s
Description: S/MIME cryptographic signature







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