diff --git a/clapper_src/filechooser.js b/clapper_src/filechooser.js
index babe4110..f4c51597 100644
--- a/clapper_src/filechooser.js
+++ b/clapper_src/filechooser.js
@@ -1,4 +1,4 @@
-const { Gio, GObject, Gtk } = imports.gi;
+const { GObject, Gtk } = imports.gi;
var FileChooser = GObject.registerClass(
class ClapperFileChooser extends Gtk.FileChooserNative
diff --git a/clapper_src/menu.js b/clapper_src/menu.js
index f9e49b7a..489757e5 100644
--- a/clapper_src/menu.js
+++ b/clapper_src/menu.js
@@ -2,9 +2,11 @@ const { GObject, Gst, Gtk } = imports.gi;
const Misc = imports.clapper_src.misc;
const Prefs = imports.clapper_src.prefs;
const { FileChooser } = imports.clapper_src.filechooser;
+const { UriDialog } = imports.clapper_src.uridialog;
var actions = [
openLocal,
+ openUri,
prefs,
about,
];
@@ -19,6 +21,12 @@ function openLocal(window, appName)
fileChooser.present();
}
+function openUri(window, appName)
+{
+ let uriDialog = new UriDialog(window);
+ uriDialog.present();
+}
+
function prefs(window, appName)
{
let prefsWidget = Prefs.buildPrefsWidget();
diff --git a/clapper_src/uridialog.js b/clapper_src/uridialog.js
new file mode 100644
index 00000000..d7b78bf3
--- /dev/null
+++ b/clapper_src/uridialog.js
@@ -0,0 +1,66 @@
+const { GObject, Gtk, Gst } = imports.gi;
+
+var UriDialog = GObject.registerClass(
+class ClapperUriDialog extends Gtk.Dialog
+{
+ _init(window, appName)
+ {
+ super._init({
+ transient_for: window,
+ title: 'Open URI',
+ default_width: 460,
+ });
+
+ let box = new Gtk.Box({
+ orientation: Gtk.Orientation.HORIZONTAL,
+ valign: Gtk.Align.CENTER,
+ spacing: 6,
+ });
+ box.add_css_class('uridialogbox');
+
+ let linkEntry = new Gtk.Entry({
+ activates_default: true,
+ truncate_multiline: true,
+ width_request: 220,
+ height_request: 36,
+ hexpand: true,
+ });
+ linkEntry.set_placeholder_text("Enter or drop URI here");
+ linkEntry.connect('notify::text', this._onTextNotify.bind(this));
+ box.append(linkEntry);
+
+ let openButton = new Gtk.Button({
+ label: "Open",
+ halign: Gtk.Align.END,
+ sensitive: false,
+ });
+ openButton.connect('clicked', this._onOpenButtonClicked.bind(this));
+ box.append(openButton);
+
+ this.set_child(box);
+ }
+
+ openUri(uri)
+ {
+ let { player } = this.get_transient_for().get_child();
+ player.set_media(uri);
+
+ this.close();
+ }
+
+ _onTextNotify(entry)
+ {
+ let isUriValid = (entry.text.length)
+ ? Gst.uri_is_valid(entry.text)
+ : false;
+
+ let button = entry.get_next_sibling();
+ button.set_sensitive(isUriValid);
+ }
+
+ _onOpenButtonClicked(button)
+ {
+ let entry = button.get_prev_sibling();
+ this.openUri(entry.text);
+ }
+});
diff --git a/css/styles.css b/css/styles.css
index d601b308..daa6b6fd 100644
--- a/css/styles.css
+++ b/css/styles.css
@@ -130,3 +130,8 @@ scale marks {
.prefssubpage header {
background: transparent;
}
+
+/* Open URI Dialog */
+.uridialogbox {
+ margin: 12px;
+}
diff --git a/ui/clapper.ui b/ui/clapper.ui
index 3c61483b..12ff8c02 100644
--- a/ui/clapper.ui
+++ b/ui/clapper.ui
@@ -6,6 +6,10 @@