Move the download manager to the gtk crate.

This commit is contained in:
Jordan Petridis 2018-01-05 22:02:06 +02:00
parent e9dd297bf3
commit 13ba2762ad
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
7 changed files with 23 additions and 30 deletions

1
Cargo.lock generated
View File

@ -599,7 +599,6 @@ dependencies = [
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hammond-data 0.1.0", "hammond-data 0.1.0",
"hyper 0.11.10 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.10 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 1.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 1.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -12,7 +12,6 @@ mime_guess = "1.8.3"
reqwest = "0.8.2" reqwest = "0.8.2"
tempdir = "0.3.5" tempdir = "0.3.5"
glob = "0.2.11" glob = "0.2.11"
lazy_static = "1.0.0"
[dependencies.diesel] [dependencies.diesel]
features = ["sqlite"] features = ["sqlite"]

View File

@ -7,8 +7,6 @@ extern crate glob;
extern crate hammond_data; extern crate hammond_data;
extern crate hyper; extern crate hyper;
#[macro_use] #[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log; extern crate log;
extern crate mime_guess; extern crate mime_guess;
extern crate reqwest; extern crate reqwest;
@ -16,4 +14,3 @@ extern crate tempdir;
pub mod downloader; pub mod downloader;
pub mod errors; pub mod errors;
pub mod manager;

View File

@ -5,9 +5,9 @@ use gtk::prelude::*;
use gio::{ActionMapExt, ApplicationExt, ApplicationExtManual, SimpleActionExt}; use gio::{ActionMapExt, ApplicationExt, ApplicationExtManual, SimpleActionExt};
use hammond_data::utils::checkup; use hammond_data::utils::checkup;
use hammond_downloader::manager::Manager;
use hammond_data::Source; use hammond_data::Source;
use manager::Manager;
use headerbar::Header; use headerbar::Header;
use content::Content; use content::Content;
use utils; use utils;

View File

@ -53,6 +53,7 @@ mod content;
mod app; mod app;
mod utils; mod utils;
mod manager;
mod static_resource; mod static_resource;
use app::App; use app::App;

View File

@ -1,31 +1,30 @@
use hammond_data::Episode; // use hammond_data::Episode;
use hammond_data::dbqueries; use hammond_data::dbqueries;
use hammond_downloader::downloader::get_episode;
use downloader::get_episode;
use std::collections::HashSet; use std::collections::HashSet;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::path::PathBuf; // use std::path::PathBuf;
use std::thread; use std::thread;
struct DonwloadInstance { // struct DonwloadInstance {
uri: String, // uri: String,
// FIXME: MAKE ME A PATHBUF // // FIXME: MAKE ME A PATHBUF
local_uri: Option<String>, // local_uri: Option<String>,
downloaded_bytes: u64, // downloaded_bytes: u64,
total_bytes: u64, // total_bytes: u64,
} // }
impl DonwloadInstance { // impl DonwloadInstance {
fn new(url: &str, total_bytes: u64) -> Self { // fn new(url: &str, total_bytes: u64) -> Self {
DonwloadInstance { // DonwloadInstance {
uri: url.into(), // uri: url.into(),
local_uri: None, // local_uri: None,
downloaded_bytes: 0, // downloaded_bytes: 0,
total_bytes, // total_bytes,
} // }
} // }
} // }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
// FIXME: privacy stuff // FIXME: privacy stuff
@ -70,7 +69,7 @@ impl Manager {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use downloader; use hammond_downloader::downloader;
use diesel::Identifiable; use diesel::Identifiable;

View File

@ -14,10 +14,8 @@ use hammond_data::errors::*;
use hammond_downloader::downloader; use hammond_downloader::downloader;
use app::DOWNLOADS_MANAGER; use app::DOWNLOADS_MANAGER;
use app::Action; use app::Action;
use std::thread;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use std::path::Path; use std::path::Path;