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

On Aug 25, 2010, at 10:50 AM, Phillip Heller wrote:


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



I've tried numerous (hackish) methods to hook a custom URL handler to my pygtk application with no success, so I've come back around to doing it via Cocoa.

I've got a proof-of-concept implementation for gtk_osxapplication which mostly works, though is likely illustrative of my utter lack of Objective-C experience.

With respect to the one issue: I install the handler in an applicationWillFinishLoading method within the GtkApplicationDelegate implementation, though it does not seem to process the URL which may have been used to invoke the application (if it were not previously running).

You can find my fork here:

Once the source tree is built and installed, try the python bindings like so:

% cd ige-mac-integration/bindings/python/gtk_osxapplication
% python ./ py2app
% open dist/ (just once, to register the URL handler with LaunchServices)  then, quit....

Now, try some invocations:

% open gtk-osx://foo  (if the test application isn't running, this will just open the application)
% open gtk-osx://bar  (this should open a MessageDialog)

I hope this is useful for others, and hopefully someone might have an idea why the URL used to launch the app doesn't seem to be processed....



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

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