seriously, pygtk does some weird things. Make the url handler even more defensive about which scheme it chooses. Closes LP #554571
This commit is contained in:
parent
bd3da1e8ff
commit
da8df9daa2
|
@ -1180,10 +1180,20 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
||||||
|
|
||||||
def open_url(self, url, prepare=False):
|
def open_url(self, url, prepare=False):
|
||||||
"""Open a given URL, conditionally unpacking it from a VTE match"""
|
"""Open a given URL, conditionally unpacking it from a VTE match"""
|
||||||
|
oldstyle = False
|
||||||
|
|
||||||
if prepare == True:
|
if prepare == True:
|
||||||
url = self.prepare_url(url)
|
url = self.prepare_url(url)
|
||||||
dbg('open_url: URL: %s (prepared: %s)' % (url, prepare))
|
dbg('open_url: URL: %s (prepared: %s)' % (url, prepare))
|
||||||
if gtk.gtk_version < (2, 14, 0):
|
|
||||||
|
if gtk.gtk_version < (2, 14, 0) or \
|
||||||
|
not hasattr(gtk, 'show_uri') or \
|
||||||
|
not hasattr(gtk.gdk, 'CURRENT_TIME'):
|
||||||
|
oldstyle = True
|
||||||
|
|
||||||
|
if oldstyle == False:
|
||||||
|
gtk.show_uri(None, url, gtk.gdk.CURRENT_TIME)
|
||||||
|
else:
|
||||||
dbg('Old gtk (%s,%s,%s), calling xdg-open' % gtk.gtk_version)
|
dbg('Old gtk (%s,%s,%s), calling xdg-open' % gtk.gtk_version)
|
||||||
try:
|
try:
|
||||||
subprocess.Popen(["xdg-open", url])
|
subprocess.Popen(["xdg-open", url])
|
||||||
|
@ -1191,9 +1201,6 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
||||||
dbg('xdg-open did not work, falling back to webbrowser.open')
|
dbg('xdg-open did not work, falling back to webbrowser.open')
|
||||||
import webbrowser
|
import webbrowser
|
||||||
webbrowser.open(url)
|
webbrowser.open(url)
|
||||||
else:
|
|
||||||
# Shiny new Gtk+, so we hope they have a sane setup
|
|
||||||
gtk.show_uri(None, url, gtk.gdk.CURRENT_TIME)
|
|
||||||
|
|
||||||
def paste_clipboard(self, primary=False):
|
def paste_clipboard(self, primary=False):
|
||||||
"""Paste one of the two clipboards"""
|
"""Paste one of the two clipboards"""
|
||||||
|
|
Loading…
Reference in New Issue