From 694d86d1a31e23bb55904f09a7945e919c467ac8 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Thu, 31 Oct 2013 13:35:36 -0700 Subject: Show 'browser-' URIs in system browser If the URI scheme starts with 'browser-', then show the corresponding URI without 'browser-' in the system default browser. e.g. shows browser-http://google.com as http://google.com in the system browser. [endlessm/eos-sdk#383] --- wikipedia/WikipediaWebView.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'wikipedia') diff --git a/wikipedia/WikipediaWebView.js b/wikipedia/WikipediaWebView.js index 8630c78..b898ba6 100644 --- a/wikipedia/WikipediaWebView.js +++ b/wikipedia/WikipediaWebView.js @@ -1,4 +1,6 @@ +const Gdk = imports.gi.Gdk; const Gio = imports.gi.Gio; +const GLib = imports.gi.GLib; const Gtk = imports.gi.Gtk; const GObject = imports.gi.GObject; const Lang = imports.lang; @@ -143,6 +145,13 @@ const WikipediaWebView = new Lang.Class({ let title = decodeURI(suffix.replace("_", " ", 'g')); this.loadArticleByTitle(title); return true; + } else if (GLib.uri_parse_scheme(uri).startsWith('browser-')) { + // Open everything that starts with 'browser-' in the system + // browser + let realURI = uri.slice('browser-'.length); + printerr('Showing', realURI); + Gtk.show_uri(null, realURI, Gdk.CURRENT_TIME); + return true; // handled } } return false; // not handled, default behavior -- cgit v1.2.3