Verified Commit 667deef5 authored by Jordan Petridis's avatar Jordan Petridis 🌱

Use a mpmc channel instead of the mspc from the std.

parent aa349aa9
Pipeline #13269 passed with stages
in 56 minutes and 36 seconds
......@@ -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<Action, RecvError> = 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)) =>
......
......@@ -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};
......
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 {
......
......@@ -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 {
......
......@@ -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)]
......
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 {
......
......@@ -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;
......
......@@ -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)]
......
......@@ -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! {
......
......@@ -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! {
......
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment