Keywords in a nutshell: I type "wp Epiphany" and my browser goes to
http://en.wikipedia.org/wiki/Epiphany

The feature request was raised recently (and doubtless previously):
http://mail.gnome.org/archives/epiphany-list/2005-November/msg00021.html

which pointed to a bug report with patch:
http://bugzilla.gnome.org/show_bug.cgi?id=118618


First of all - what is the "right way to do it"?  In particular, which
signal should be caught to do the address re-write?  The above patch
hooks into the "resolve-address" signal.  Alternatively, the
sample-python-location tutorial extension (which listens to the
"ge-location" signal) seems really easy to tweak into the proof of
concept one-pager at the bottom of this e-mail.

Second - what plans do the Epiphany devs have (if any) of "blessing"
this feature (as part of epiphany-extensions, presumably)?  Because I am
hoping to provide it through the deskbar-applet, even if the preferred
browser is Epiphany rather than Firefox (boo, hiss :-).  So, what would
make this part of Epiphany 1.10?  How can I help (I'd be willing to do
some coding/writing)?  Or will I otherwise have to install an Epiphany
extension as part of deskbar-applet, and mess with bookmark storage
(which is itself another discussion)?

thanks,
Nigel.


-------------------------
import epiphany;

keywords = {
        'wp':'http://www.wikipedia.org',
        'wp ':'http://en.wikipedia.org/wiki/%s' }

def location_cb(embed, address, tab):
        if address.startswith('keyword:'):
                k = address[8:].strip()
                i = k.find('%20')
                if i != -1:
                        key = k[:i] + ' '
                        args = k[i+3:]
                        try:
                                embed.load_url(keywords[key] % args)
                        except KeyError, TypeError:
                                # either key was not in the map
                                # keywords, or
                                # the URL did not have a '%s' in it
                                pass
                else:
                        try:
                                embed.load_url(keywords[k])
                        except KeyError:
                                # k was not in the map keywords
                                pass

def attach_tab(window, tab):
        embed = tab.get_embed()
        sig = embed.connect('ge-location', location_cb, tab)
        embed._python_sample_location_sig = sig

def detach_tab(window, tab):
        embed = tab.get_embed()
        sig = embed._python_sample_location_sig
        del embed._python_sample_location_sig
        embed.disconnect(sig)


_______________________________________________
epiphany-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/epiphany-list

Reply via email to