#!/usr/bin/env python # # Copyright (C) 2006 Michael Urman # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # def _location_cb(embed, address): address2 = address.replace('%e2%80%8b', '').replace('%E2%80%8B', '') if address != address2: embed.load_url(address2) def attach_tab(window, tab): embed = tab.get_embed() sig = embed.connect("ge-location", _location_cb) embed._strip_zero_width_space_location_sig = sig def detach_tab(window, tab): embed = tab.get_embed() try: sig = embed._strip_zero_width_space_location_sig except AttributeError: pass else: del embed._strip_zero_width_space_location_sig embed.disconnect(sig)