Closed Bug 140635 Opened 23 years ago Closed 21 years ago

Mozilla access to GNOME URL-handlers for externals

Categories

(Core :: Networking, enhancement)

x86
Linux
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: u27431, Assigned: bryner)

References

Details

(Keywords: helpwanted)

Attachments

(1 file)

GNOME provides a way of setting desktop wide URL-handlers.  Mozilla should be
able to access these if a URL is supposed to handled externally.

This is closely related to bug 128668 and raises the same questions as to
whether Mozilla should be allowed to depend on GNOME headers, or if some other
mechanism can be found.  Perhaps the GNOME side could be encouraged to create
some small, standard utility (e.g. "gnome-handle-url") which could be discovered
and used by Mozilla.  Perhaps it already exists.

I think this is well worth doing since, as far as I know, GNOME is intended to
be the desktop of choice by a few vendors.

I'm sure KDE has a similar function.  Perhaps something in common with both
could be done.
ccing blizzard for his insight... It'd be nice if we didn't have to compile
against gnome.h and such to get this info....
Status: UNCONFIRMED → NEW
Ever confirmed: true
this is really an enhancement

This function is supposed to be used for such a purpose:
http://developer.gnome.org/doc/API/libgnome/gnome-gnome-url.html

maybe we could try to dlopen libgnome.so and if that succeeds get the symbol
gnome_url_show and call it.

Or we could manually parse  ~/.gnome/Gnome, section URL Handlers, but that
sounds like a hack.
Severity: normal → enhancement
> Or we could manually parse  ~/.gnome/Gnome, section URL Handlers, but that
> sounds like a hack.

This would not pick up url handlers in the global gnome dirs, would it?  And
manually parsing it would just kinda suck..
The library call seems like the right thing to do.  Is there a way to ask Gnome
whether it's actually acting as the desktop or not?  It's quite possible for
Gnome to be installed but not not used as the desktop.  I see two options:

1) a pref (no UI) that enables Gnome URL handling - distributors/embedders could
enable this pref in their version of Mozilla if mozdev is unwilling to do so

2) Mozilla checks to see if Gnome is the desktop and uses the handlers
automatically if it is  (might still want a pref so users can disable Gnome
handling and use the more generic *nix solution currently being developed)

I favour the second option, myself.
Well, how do you check if gnome is running? Checking if it's installed is easy,
but if it's running?
I've played around and the attached C code will invoke the Gnome URL handling
under Linux (it's a standalone program).  I'm not sure if dlopen() is supported
under BSD, etc (anyone?).  My experimentation raises one issue: if the URL is
"bad" it can cause problems.

e.g. "foo://blah.blah.blah"
Because "foo" is not a registered protocol for Gnome, it will be passed to
whatever the default handler is (in my case, Mozilla!).  This could cause a
nasty recursion.  We probably need to check whether Gnome does, in fact, have a
defined handler for that protocol.
Hm, didn't think of that recursion... to find that out, we probably do need to
parse gnome's config files, I don't think that there's a function for this.
Parsing the file is just too plain ugly and creates a horrible level of
dependence.  I think there's a better route:

Gnome offers a command to read values from GConf: gconfigger
There is also the GConf API as well.

However, in Gnome 1.4, it does not appear that those values are stored in GConf.
 The current source for gnome_url_call() shows it looking in GConf for that
info.  Perhaps it's not worth targeting Gnome 1.4 (although I wasn't planning on
running 2.0 anytime soon :) if the information can be so easily obtained in 2.0.

Another possibility is to try to convince the Gnome people to expose some more
functionality.  A "gnome_has_url_handler()" would be one way.  Another
possibility, less drastic, would be to add a "no_default_handler" flag to
"gnome_url_call()", which would stop it from trying its default handler.  I
don't know how approachable they would be in this area.  They have a whole API
devoted to MIME types.  You'd think they wouldn't mind expanding the URL side a
bit (or accepting patches to do this).

I can't help wondering if Galeon would suffer this recursion problem if it were
made the default handler.  If it does, that might add weight to a request for
changes/improvements.  Anyone have it installed right now?  I don't...
gnome 1.4 does not contain GConf, so the value is for sure not stored there.
otoh, maybe gnome_config could be used... as in
gnome_config_get_string("/Gnome/URL Handlers/the_protocol", &string); (not sure
about the exact syntax). Mozilla could get this function using the dlopen
approach (btw, dlopen does work on BSD and other, but not all, Unices. HP-UX's
is called shl_open, iirc, for example)
I'm working on a drop-in component that will be able to interface with GNOME 2
URL handlers via gconf.  Instead of using gnome_url_show(), I'm using the gconf
api to retrieve the handler myself... this will allow for the type of recursion
checking you mention.  The same component will handle helper app associations
(bug 128668).
Depends on: 128668
Keywords: helpwanted
bryner, are you still working on something like this?  
-> bryner.  
Assignee: new-network-bugs → bryner
fixed by my checkin for bug 128668 (for GTK2, anyway).
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: