diff --git a/hammond-gtk/src/app.rs b/hammond-gtk/src/app.rs index 0a0dd7c..76663f9 100644 --- a/hammond-gtk/src/app.rs +++ b/hammond-gtk/src/app.rs @@ -9,6 +9,7 @@ use gtk; use gtk::prelude::*; use gtk::SettingsExt as GtkSettingsExt; +use crossbeam_channel::{unbounded, Sender}; use hammond_data::Podcast; use appnotif::{InAppNotification, UndoState}; @@ -19,11 +20,8 @@ use utils; use widgets::{about_dialog, mark_all_notif, remove_show_notif}; use std::rc::Rc; -use std::sync::mpsc::{channel, Sender}; use std::sync::Arc; -use std::cell::RefCell; - #[derive(Debug, Clone)] pub enum Action { RefreshAllViews, @@ -63,8 +61,7 @@ impl App { utils::cleanup(cleanup_date); application.connect_startup(clone!(settings => move |app| { - let (sender, receiver) = channel(); - let receiver = Rc::new(RefCell::new(receiver)); + let (sender, receiver) = unbounded(); let refresh = SimpleAction::new("refresh", None); refresh.connect_activate(clone!(sender => move |_, _| { @@ -145,9 +142,7 @@ impl App { gtk::timeout_add(50, clone!(sender, receiver => move || { // Uses receiver, content, header, sender, overlay - let act = receiver.borrow().try_recv(); - //let act: Result = Ok(Action::RefreshAllViews); - match act { + match receiver.try_recv() { Ok(Action::RefreshAllViews) => content.update(), Ok(Action::RefreshShowsView) => content.update_shows_view(), Ok(Action::RefreshWidgetIfSame(id)) => diff --git a/hammond-gtk/src/headerbar.rs b/hammond-gtk/src/headerbar.rs index 3929ca7..9e1dee3 100644 --- a/hammond-gtk/src/headerbar.rs +++ b/hammond-gtk/src/headerbar.rs @@ -7,10 +7,9 @@ use failure::Error; use failure::ResultExt; use url::Url; +use crossbeam_channel::Sender; use hammond_data::{dbqueries, Source}; -use std::sync::mpsc::Sender; - use app::Action; use stacks::Content; use utils::{itunes_to_rss, refresh}; diff --git a/hammond-gtk/src/stacks/content.rs b/hammond-gtk/src/stacks/content.rs index a7deb6c..c63d640 100644 --- a/hammond-gtk/src/stacks/content.rs +++ b/hammond-gtk/src/stacks/content.rs @@ -1,6 +1,7 @@ use gtk; use gtk::prelude::*; +use crossbeam_channel::Sender; use failure::Error; use app::Action; @@ -8,7 +9,6 @@ use stacks::{HomeStack, ShowStack}; use std::cell::RefCell; use std::rc::Rc; -use std::sync::mpsc::Sender; #[derive(Debug, Clone)] pub struct Content { diff --git a/hammond-gtk/src/stacks/home.rs b/hammond-gtk/src/stacks/home.rs index 1974168..25eabdf 100644 --- a/hammond-gtk/src/stacks/home.rs +++ b/hammond-gtk/src/stacks/home.rs @@ -2,6 +2,7 @@ use gtk; use gtk::prelude::*; use gtk::StackTransitionType; +use crossbeam_channel::Sender; use failure::Error; use hammond_data::dbqueries::is_episodes_populated; use hammond_data::errors::DataError; @@ -10,7 +11,6 @@ use app::Action; use widgets::{EmptyView, HomeView}; use std::rc::Rc; -use std::sync::mpsc::Sender; #[derive(Debug, Clone, Copy)] enum State { diff --git a/hammond-gtk/src/stacks/populated.rs b/hammond-gtk/src/stacks/populated.rs index e791ca5..a4048a9 100644 --- a/hammond-gtk/src/stacks/populated.rs +++ b/hammond-gtk/src/stacks/populated.rs @@ -2,6 +2,7 @@ use gtk; use gtk::prelude::*; use gtk::StackTransitionType; +use crossbeam_channel::Sender; use failure::Error; use hammond_data::dbqueries; @@ -11,7 +12,6 @@ use app::Action; use widgets::{ShowWidget, ShowsView}; use std::rc::Rc; -use std::sync::mpsc::Sender; use std::sync::Arc; #[derive(Debug, Clone, Copy)] diff --git a/hammond-gtk/src/stacks/show.rs b/hammond-gtk/src/stacks/show.rs index e00cc35..7c52c6c 100644 --- a/hammond-gtk/src/stacks/show.rs +++ b/hammond-gtk/src/stacks/show.rs @@ -1,6 +1,7 @@ use gtk; use gtk::prelude::*; +use crossbeam_channel::Sender; use failure::Error; use hammond_data::dbqueries::is_podcasts_populated; @@ -11,7 +12,6 @@ use widgets::EmptyView; use std::cell::RefCell; use std::rc::Rc; -use std::sync::mpsc::Sender; #[derive(Debug, Clone, Copy)] pub enum ShowState { diff --git a/hammond-gtk/src/utils.rs b/hammond-gtk/src/utils.rs index b858c73..2ad7c82 100644 --- a/hammond-gtk/src/utils.rs +++ b/hammond-gtk/src/utils.rs @@ -8,6 +8,7 @@ use gtk::prelude::*; use gtk::{IsA, Widget}; use chrono::prelude::*; +use crossbeam_channel::Sender; use failure::Error; use rayon; use regex::Regex; @@ -24,9 +25,8 @@ use hammond_data::Source; use hammond_downloader::downloader; use std::collections::{HashMap, HashSet}; -use std::sync::mpsc::*; -use std::sync::Arc; -use std::sync::{Mutex, RwLock}; +use std::sync::mpsc::channel; +use std::sync::{Arc, Mutex, RwLock}; use app::Action; diff --git a/hammond-gtk/src/widgets/episode.rs b/hammond-gtk/src/widgets/episode.rs index 5b314b4..5e2bf4e 100644 --- a/hammond-gtk/src/widgets/episode.rs +++ b/hammond-gtk/src/widgets/episode.rs @@ -2,6 +2,7 @@ use glib; use gtk; use gtk::prelude::*; +use crossbeam_channel::Sender; use failure::Error; use humansize::FileSize; use open; @@ -19,7 +20,6 @@ use std::cell::RefCell; use std::ops::DerefMut; use std::path::Path; use std::rc::Rc; -use std::sync::mpsc::Sender; use std::sync::{Arc, Mutex}; #[derive(Debug)] diff --git a/hammond-gtk/src/widgets/home_view.rs b/hammond-gtk/src/widgets/home_view.rs index b0321c5..6c9687d 100644 --- a/hammond-gtk/src/widgets/home_view.rs +++ b/hammond-gtk/src/widgets/home_view.rs @@ -4,6 +4,7 @@ use failure::Error; use gtk; use gtk::prelude::*; +use crossbeam_channel::Sender; use hammond_data::dbqueries; use hammond_data::EpisodeWidgetQuery; use send_cell::SendCell; @@ -13,7 +14,6 @@ use utils::{self, lazy_load_full}; use widgets::EpisodeWidget; use std::rc::Rc; -use std::sync::mpsc::Sender; use std::sync::Mutex; lazy_static! { diff --git a/hammond-gtk/src/widgets/show.rs b/hammond-gtk/src/widgets/show.rs index 71adc24..fda112b 100644 --- a/hammond-gtk/src/widgets/show.rs +++ b/hammond-gtk/src/widgets/show.rs @@ -2,6 +2,7 @@ use glib; use gtk; use gtk::prelude::*; +use crossbeam_channel::{SendError, Sender}; use failure::Error; use html2pango::markup_from_raw; use open; @@ -18,7 +19,6 @@ use utils::{self, lazy_load}; use widgets::EpisodeWidget; use std::rc::Rc; -use std::sync::mpsc::{SendError, Sender}; use std::sync::{Arc, Mutex}; lazy_static! { diff --git a/hammond-gtk/src/widgets/shows_view.rs b/hammond-gtk/src/widgets/shows_view.rs index 7516026..bf390cf 100644 --- a/hammond-gtk/src/widgets/shows_view.rs +++ b/hammond-gtk/src/widgets/shows_view.rs @@ -1,6 +1,7 @@ use gtk; use gtk::prelude::*; +use crossbeam_channel::Sender; use failure::Error; use send_cell::SendCell; @@ -11,7 +12,6 @@ use app::Action; use utils::{self, get_ignored_shows, lazy_load, set_image_from_path}; use std::rc::Rc; -use std::sync::mpsc::Sender; use std::sync::Arc; use std::sync::Mutex;