mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add rust-alert to the tree and use it to allow a new URL to be navigated to
This commit is contained in:
parent
1eb5c4f7b7
commit
4d7f003cd9
6 changed files with 23 additions and 1 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -85,3 +85,6 @@
|
||||||
[submodule "src/compiler/rust"]
|
[submodule "src/compiler/rust"]
|
||||||
path = src/compiler/rust
|
path = src/compiler/rust
|
||||||
url = https://github.com/mozilla/rust.git
|
url = https://github.com/mozilla/rust.git
|
||||||
|
[submodule "src/support/alert/rust-alert"]
|
||||||
|
path = src/support/alert/rust-alert
|
||||||
|
url = git://github.com/mozilla-servo/rust-alert.git
|
||||||
|
|
1
configure
vendored
1
configure
vendored
|
@ -398,6 +398,7 @@ AUTOCMD="${LIBTOOLIZE} && autoconf && autoheader && automake --add-missing --cop
|
||||||
# Copied from cairo's autogen.sh. Build fails without
|
# Copied from cairo's autogen.sh. Build fails without
|
||||||
|
|
||||||
CFG_SUBMODULES="\
|
CFG_SUBMODULES="\
|
||||||
|
support/alert/rust-alert \
|
||||||
support/azure/rust-azure \
|
support/azure/rust-azure \
|
||||||
support/css/rust-css \
|
support/css/rust-css \
|
||||||
support/geom/rust-geom \
|
support/geom/rust-geom \
|
||||||
|
|
|
@ -103,6 +103,11 @@ DEPS_rust-io-surface += \
|
||||||
rust-core-foundation \
|
rust-core-foundation \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
DEPS_rust-alert += \
|
||||||
|
rust-core-foundation \
|
||||||
|
rust-cocoa \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
DEPS_sharegl += \
|
DEPS_sharegl += \
|
||||||
rust-core-foundation \
|
rust-core-foundation \
|
||||||
rust-io-surface \
|
rust-io-surface \
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
use windowing::{ApplicationMethods, CompositeCallback, LoadUrlCallback, ResizeCallback};
|
use windowing::{ApplicationMethods, CompositeCallback, LoadUrlCallback, ResizeCallback};
|
||||||
use windowing::{WindowMethods};
|
use windowing::{WindowMethods};
|
||||||
|
|
||||||
|
use alert::{Alert, AlertMethods};
|
||||||
use geom::size::Size2D;
|
use geom::size::Size2D;
|
||||||
use glut::glut::{DOUBLE, WindowHeight, WindowWidth};
|
use glut::glut::{DOUBLE, WindowHeight, WindowWidth};
|
||||||
use glut::glut;
|
use glut::glut;
|
||||||
|
@ -116,7 +117,17 @@ impl Window {
|
||||||
fn load_url(&self) {
|
fn load_url(&self) {
|
||||||
match self.load_url_callback {
|
match self.load_url_callback {
|
||||||
None => error!("no URL callback registered, doing nothing"),
|
None => error!("no URL callback registered, doing nothing"),
|
||||||
Some(callback) => callback("http://purple.com/"),
|
Some(callback) => {
|
||||||
|
let mut alert: Alert = AlertMethods::new("Navigate to:");
|
||||||
|
alert.add_prompt();
|
||||||
|
alert.run();
|
||||||
|
let value = alert.prompt_value();
|
||||||
|
if "" == value { // To avoid crashing on Linux.
|
||||||
|
callback("http://purple.com/")
|
||||||
|
} else {
|
||||||
|
callback(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#[license = "MPL"];
|
#[license = "MPL"];
|
||||||
#[crate_type = "lib"];
|
#[crate_type = "lib"];
|
||||||
|
|
||||||
|
extern mod alert;
|
||||||
extern mod azure;
|
extern mod azure;
|
||||||
extern mod geom;
|
extern mod geom;
|
||||||
extern mod gfx (name = "servo_gfx");
|
extern mod gfx (name = "servo_gfx");
|
||||||
|
|
1
src/support/alert/rust-alert
Submodule
1
src/support/alert/rust-alert
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 0cba81aab4858442e9a995cf3b0149d0d116627c
|
Loading…
Add table
Add a link
Reference in a new issue