diff options
author | Josh Matthews <josh@joshmatthews.net> | 2016-04-16 09:05:59 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2016-04-16 15:00:31 -0400 |
commit | d09a497aa5d0e167e69ae57f50d7933cad2b8a0c (patch) | |
tree | c0929588e434389c0da5e7d7a0050c824e8c31ac | |
parent | 7bd23815184bfa675bde040231199722c703d2f0 (diff) | |
download | servo-d09a497aa5d0e167e69ae57f50d7933cad2b8a0c.tar.gz servo-d09a497aa5d0e167e69ae57f50d7933cad2b8a0c.zip |
Disable tinyfiledialogs on non-OS X and Linux platforms.
-rw-r--r-- | components/net/Cargo.toml | 6 | ||||
-rw-r--r-- | components/net/http_loader.rs | 7 | ||||
-rw-r--r-- | components/net/lib.rs | 1 |
3 files changed, 11 insertions, 3 deletions
diff --git a/components/net/Cargo.toml b/components/net/Cargo.toml index f5ec9bac7a1..5d1a100ecdb 100644 --- a/components/net/Cargo.toml +++ b/components/net/Cargo.toml @@ -32,9 +32,6 @@ git = "https://github.com/servo/ipc-channel" [dependencies.webrender_traits] git = "https://github.com/servo/webrender_traits" -[dependencies.tinyfiledialogs] -git = "https://github.com/jdm/tinyfiledialogs" - [dependencies] cookie = "0.2" flate2 = "0.2.0" @@ -51,3 +48,6 @@ unicase = "1.4.0" url = {version = "0.5.7", features = ["heap_size"]} uuid = { version = "0.2", features = ["v4"] } websocket = "0.16.1" + +[target.'cfg(any(target_os = "macos", target_os = "linux"))'.dependencies] +tinyfiledialogs = {git = "https://github.com/jdm/tinyfiledialogs"} diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 6578a83b8c2..25ff130dc26 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -41,6 +41,7 @@ use std::sync::mpsc::Sender; use std::sync::{Arc, RwLock}; use time; use time::Tm; +#[cfg(any(target_os = "macos", target_os = "linux"))] use tinyfiledialogs; use url::Url; use util::resource_files::resources_dir_path; @@ -702,10 +703,16 @@ pub trait UIProvider { } impl UIProvider for TFDProvider { + #[cfg(any(target_os = "macos", target_os = "linux"))] fn input_username_and_password(&self) -> (Option<String>, Option<String>) { (tinyfiledialogs::input_box("Enter username", "Username:", ""), tinyfiledialogs::input_box("Enter password", "Password:", "")) } + + #[cfg(not(any(target_os = "macos", target_os = "linux")))] + fn input_username_and_password(&self) -> (Option<String>, Option<String>) { + (None, None) + } } struct TFDProvider; diff --git a/components/net/lib.rs b/components/net/lib.rs index 4b638e79e4d..a784485f887 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -29,6 +29,7 @@ extern crate openssl; extern crate rustc_serialize; extern crate threadpool; extern crate time; +#[cfg(any(target_os = "macos", target_os = "linux"))] extern crate tinyfiledialogs; extern crate unicase; extern crate url; |