Replace SendCell with fragile.
SendCell is depricated now and its advised to use the Fragile crate instead. https://github.com/sdroege/send-cell/issues/5
This commit is contained in:
parent
91bea85519
commit
838320785e
11
Cargo.lock
generated
11
Cargo.lock
generated
@ -1519,6 +1519,7 @@ dependencies = [
|
|||||||
"crossbeam-channel 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crossbeam-channel 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"fragile 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gdk 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gdk 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gdk-pixbuf 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gdk-pixbuf 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gio 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gio 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1538,7 +1539,6 @@ dependencies = [
|
|||||||
"rayon 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rayon 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"regex 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"reqwest 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"reqwest 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"send-cell 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"serde_json 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_json 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -1861,14 +1861,6 @@ dependencies = [
|
|||||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "send-cell"
|
|
||||||
version = "0.1.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"fragile 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "0.9.15"
|
version = "0.9.15"
|
||||||
@ -2685,7 +2677,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
|
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
|
||||||
"checksum security-framework 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "dfa44ee9c54ce5eecc9de7d5acbad112ee58755239381f687e564004ba4a2332"
|
"checksum security-framework 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "dfa44ee9c54ce5eecc9de7d5acbad112ee58755239381f687e564004ba4a2332"
|
||||||
"checksum security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "5421621e836278a0b139268f36eee0dc7e389b784dc3f79d8f11aabadf41bead"
|
"checksum security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "5421621e836278a0b139268f36eee0dc7e389b784dc3f79d8f11aabadf41bead"
|
||||||
"checksum send-cell 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "369add9433969659158b4bcc0c471c183889565a00c426f4d1d5447efe17f401"
|
|
||||||
"checksum serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af"
|
"checksum serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af"
|
||||||
"checksum serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)" = "0c3adf19c07af6d186d91dae8927b83b0553d07ca56cbf7f2f32560455c91920"
|
"checksum serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)" = "0c3adf19c07af6d186d91dae8927b83b0553d07ca56cbf7f2f32560455c91920"
|
||||||
"checksum serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)" = "3525a779832b08693031b8ecfb0de81cd71cfd3812088fafe9a7496789572124"
|
"checksum serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)" = "3525a779832b08693031b8ecfb0de81cd71cfd3812088fafe9a7496789572124"
|
||||||
|
|||||||
@ -19,10 +19,10 @@ log = "0.4.3"
|
|||||||
loggerv = "0.7.1"
|
loggerv = "0.7.1"
|
||||||
open = "1.2.1"
|
open = "1.2.1"
|
||||||
rayon = "1.0.2"
|
rayon = "1.0.2"
|
||||||
send-cell = "0.1.3"
|
|
||||||
url = "1.7.1"
|
url = "1.7.1"
|
||||||
failure = "0.1.1"
|
failure = "0.1.1"
|
||||||
failure_derive = "0.1.1"
|
failure_derive = "0.1.1"
|
||||||
|
fragile = "0.2.1"
|
||||||
regex = "1.0.2"
|
regex = "1.0.2"
|
||||||
reqwest = "0.8.6"
|
reqwest = "0.8.6"
|
||||||
serde_json = "1.0.24"
|
serde_json = "1.0.24"
|
||||||
|
|||||||
@ -6,8 +6,8 @@ use gtk;
|
|||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
|
|
||||||
use crossbeam_channel::{unbounded, Receiver, Sender};
|
use crossbeam_channel::{unbounded, Receiver, Sender};
|
||||||
|
use fragile::Fragile;
|
||||||
use podcasts_data::Show;
|
use podcasts_data::Show;
|
||||||
use send_cell::SendCell;
|
|
||||||
|
|
||||||
use headerbar::Header;
|
use headerbar::Header;
|
||||||
use prefs::Prefs;
|
use prefs::Prefs;
|
||||||
@ -57,7 +57,7 @@ pub enum Action {
|
|||||||
RemoveShow(Arc<Show>),
|
RemoveShow(Arc<Show>),
|
||||||
ErrorNotification(String),
|
ErrorNotification(String),
|
||||||
InitEpisode(i32),
|
InitEpisode(i32),
|
||||||
InitShowMenu(SendCell<ShowMenu>),
|
InitShowMenu(Fragile<ShowMenu>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@ -287,8 +287,8 @@ impl App {
|
|||||||
debug_assert!(res.is_ok());
|
debug_assert!(res.is_ok());
|
||||||
}
|
}
|
||||||
Action::InitShowMenu(s) => {
|
Action::InitShowMenu(s) => {
|
||||||
let menu = s.borrow();
|
let menu = &s.get().container;
|
||||||
self.headerbar.set_secondary_menu(&menu.container);
|
self.headerbar.set_secondary_menu(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,6 +60,7 @@ extern crate pretty_assertions;
|
|||||||
|
|
||||||
extern crate chrono;
|
extern crate chrono;
|
||||||
extern crate crossbeam_channel;
|
extern crate crossbeam_channel;
|
||||||
|
extern crate fragile;
|
||||||
extern crate html2text;
|
extern crate html2text;
|
||||||
extern crate humansize;
|
extern crate humansize;
|
||||||
extern crate loggerv;
|
extern crate loggerv;
|
||||||
@ -69,7 +70,6 @@ extern crate podcasts_downloader;
|
|||||||
extern crate rayon;
|
extern crate rayon;
|
||||||
extern crate regex;
|
extern crate regex;
|
||||||
extern crate reqwest;
|
extern crate reqwest;
|
||||||
extern crate send_cell;
|
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
|
||||||
|
|||||||
@ -10,10 +10,10 @@ use gtk::{IsA, Widget};
|
|||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
use crossbeam_channel::{unbounded, Sender};
|
use crossbeam_channel::{unbounded, Sender};
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
|
use fragile::Fragile;
|
||||||
use rayon;
|
use rayon;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use reqwest;
|
use reqwest;
|
||||||
use send_cell::SendCell;
|
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
// use podcasts_data::feed;
|
// use podcasts_data::feed;
|
||||||
@ -213,7 +213,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref CACHED_PIXBUFS: RwLock<HashMap<(i32, u32), Mutex<SendCell<Pixbuf>>>> =
|
static ref CACHED_PIXBUFS: RwLock<HashMap<(i32, u32), Mutex<Fragile<Pixbuf>>>> =
|
||||||
{ RwLock::new(HashMap::new()) };
|
{ RwLock::new(HashMap::new()) };
|
||||||
static ref COVER_DL_REGISTRY: RwLock<HashSet<i32>> = RwLock::new(HashSet::new());
|
static ref COVER_DL_REGISTRY: RwLock<HashSet<i32>> = RwLock::new(HashSet::new());
|
||||||
static ref THREADPOOL: rayon::ThreadPool = rayon::ThreadPoolBuilder::new().build().unwrap();
|
static ref THREADPOOL: rayon::ThreadPool = rayon::ThreadPoolBuilder::new().build().unwrap();
|
||||||
@ -248,12 +248,12 @@ pub fn set_image_from_path(image: >k::Image, show_id: i32, size: u32) -> Resul
|
|||||||
if let Some(guard) = hashmap.get(&(show_id, size)) {
|
if let Some(guard) = hashmap.get(&(show_id, size)) {
|
||||||
guard
|
guard
|
||||||
.lock()
|
.lock()
|
||||||
.map_err(|err| format_err!("SendCell Mutex: {}", err))
|
.map_err(|err| format_err!("Fragile Mutex: {}", err))
|
||||||
.and_then(|sendcell| {
|
.and_then(|fragile| {
|
||||||
sendcell
|
fragile
|
||||||
.try_get()
|
.try_get()
|
||||||
.map(|px| image.set_from_pixbuf(px))
|
.map(|px| image.set_from_pixbuf(px))
|
||||||
.ok_or_else(|| format_err!("Pixbuf was accessed from a different thread"))
|
.map_err(From::from)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@ -278,7 +278,7 @@ pub fn set_image_from_path(image: >k::Image, show_id: i32, size: u32) -> Resul
|
|||||||
if let Ok(path) = path {
|
if let Ok(path) = path {
|
||||||
if let Ok(px) = Pixbuf::new_from_file_at_scale(&path, s, s, true) {
|
if let Ok(px) = Pixbuf::new_from_file_at_scale(&path, s, s, true) {
|
||||||
if let Ok(mut hashmap) = CACHED_PIXBUFS.write() {
|
if let Ok(mut hashmap) = CACHED_PIXBUFS.write() {
|
||||||
hashmap.insert((show_id, size), Mutex::new(SendCell::new(px.clone())));
|
hashmap.insert((show_id, size), Mutex::new(Fragile::new(px.clone())));
|
||||||
image.set_from_pixbuf(&px);
|
image.set_from_pixbuf(&px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,9 +5,9 @@ use gtk;
|
|||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
|
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
|
use fragile::Fragile;
|
||||||
use podcasts_data::dbqueries;
|
use podcasts_data::dbqueries;
|
||||||
use podcasts_data::EpisodeWidgetModel;
|
use podcasts_data::EpisodeWidgetModel;
|
||||||
use send_cell::SendCell;
|
|
||||||
|
|
||||||
use app::Action;
|
use app::Action;
|
||||||
use utils::{self, lazy_load_full};
|
use utils::{self, lazy_load_full};
|
||||||
@ -18,7 +18,7 @@ use std::rc::Rc;
|
|||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref EPISODES_VIEW_VALIGNMENT: Mutex<Option<SendCell<gtk::Adjustment>>> =
|
pub static ref EPISODES_VIEW_VALIGNMENT: Mutex<Option<Fragile<gtk::Adjustment>>> =
|
||||||
Mutex::new(None);
|
Mutex::new(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,11 +126,15 @@ impl HomeView {
|
|||||||
.lock()
|
.lock()
|
||||||
.map_err(|err| format_err!("Failed to lock widget align mutex: {}", err))?;
|
.map_err(|err| format_err!("Failed to lock widget align mutex: {}", err))?;
|
||||||
|
|
||||||
if let Some(ref sendcell) = *guard {
|
if let Some(ref fragile) = *guard {
|
||||||
// Copy the vertical scrollbar adjustment from the old view into the new one.
|
// Copy the vertical scrollbar adjustment from the old view into the new one.
|
||||||
sendcell
|
let res = fragile
|
||||||
.try_get()
|
.try_get()
|
||||||
.map(|x| utils::smooth_scroll_to(&self.scrolled_window, &x));
|
.map(|x| utils::smooth_scroll_to(&self.scrolled_window, &x))
|
||||||
|
.map_err(From::from);
|
||||||
|
|
||||||
|
debug_assert!(res.is_ok());
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -143,7 +147,7 @@ impl HomeView {
|
|||||||
.scrolled_window
|
.scrolled_window
|
||||||
.get_vadjustment()
|
.get_vadjustment()
|
||||||
.ok_or_else(|| format_err!("Could not get the adjustment"))?;
|
.ok_or_else(|| format_err!("Could not get the adjustment"))?;
|
||||||
*guard = Some(SendCell::new(adj));
|
*guard = Some(Fragile::new(adj));
|
||||||
info!("Saved episodes_view alignment.");
|
info!("Saved episodes_view alignment.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ use glib::SignalHandlerId;
|
|||||||
use chrono::NaiveTime;
|
use chrono::NaiveTime;
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
use send_cell::SendCell;
|
use fragile::Fragile;
|
||||||
|
|
||||||
use podcasts_data::{dbqueries, USER_AGENT};
|
use podcasts_data::{dbqueries, USER_AGENT};
|
||||||
use podcasts_data::{EpisodeWidgetModel, ShowCoverModel};
|
use podcasts_data::{EpisodeWidgetModel, ShowCoverModel};
|
||||||
@ -300,25 +300,25 @@ impl PlayerWidget {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// The followign callbacks require `Send` but are handled by the gtk main loop
|
// The followign callbacks require `Send` but are handled by the gtk main loop
|
||||||
let weak = SendCell::new(Rc::downgrade(s));
|
let weak = Fragile::new(Rc::downgrade(s));
|
||||||
|
|
||||||
// Update the duration label and the slider
|
// Update the duration label and the slider
|
||||||
s.player.connect_duration_changed(clone!(weak => move |_, clock| {
|
s.player.connect_duration_changed(clone!(weak => move |_, clock| {
|
||||||
weak.borrow()
|
weak.get()
|
||||||
.upgrade()
|
.upgrade()
|
||||||
.map(|p| p.timer.on_duration_changed(Duration(clock)));
|
.map(|p| p.timer.on_duration_changed(Duration(clock)));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Update the position label and the slider
|
// Update the position label and the slider
|
||||||
s.player.connect_position_updated(clone!(weak => move |_, clock| {
|
s.player.connect_position_updated(clone!(weak => move |_, clock| {
|
||||||
weak.borrow()
|
weak.get()
|
||||||
.upgrade()
|
.upgrade()
|
||||||
.map(|p| p.timer.on_position_updated(Position(clock)));
|
.map(|p| p.timer.on_position_updated(Position(clock)));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Reset the slider to 0 and show a play button
|
// Reset the slider to 0 and show a play button
|
||||||
s.player.connect_end_of_stream(clone!(weak => move |_| {
|
s.player.connect_end_of_stream(clone!(weak => move |_| {
|
||||||
weak.borrow()
|
weak.get()
|
||||||
.upgrade()
|
.upgrade()
|
||||||
.map(|p| p.stop());
|
.map(|p| p.stop());
|
||||||
}));
|
}));
|
||||||
|
|||||||
@ -4,9 +4,9 @@ use gtk::prelude::*;
|
|||||||
|
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
|
use fragile::Fragile;
|
||||||
use html2text;
|
use html2text;
|
||||||
use rayon;
|
use rayon;
|
||||||
use send_cell::SendCell;
|
|
||||||
|
|
||||||
use podcasts_data::dbqueries;
|
use podcasts_data::dbqueries;
|
||||||
use podcasts_data::Show;
|
use podcasts_data::Show;
|
||||||
@ -19,7 +19,7 @@ use std::rc::Rc;
|
|||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref SHOW_WIDGET_VALIGNMENT: Mutex<Option<(i32, SendCell<gtk::Adjustment>)>> =
|
static ref SHOW_WIDGET_VALIGNMENT: Mutex<Option<(i32, Fragile<gtk::Adjustment>)>> =
|
||||||
Mutex::new(None);
|
Mutex::new(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ impl ShowWidget {
|
|||||||
pdw.init(&pd);
|
pdw.init(&pd);
|
||||||
|
|
||||||
let menu = ShowMenu::new(&pd, &pdw.episodes, &sender);
|
let menu = ShowMenu::new(&pd, &pdw.episodes, &sender);
|
||||||
sender.send(Action::InitShowMenu(SendCell::new(menu)));
|
sender.send(Action::InitShowMenu(Fragile::new(menu)));
|
||||||
|
|
||||||
let pdw = Rc::new(pdw);
|
let pdw = Rc::new(pdw);
|
||||||
let res = populate_listbox(&pdw, pd.clone(), sender);
|
let res = populate_listbox(&pdw, pd.clone(), sender);
|
||||||
@ -95,7 +95,7 @@ impl ShowWidget {
|
|||||||
.scrolled_window
|
.scrolled_window
|
||||||
.get_vadjustment()
|
.get_vadjustment()
|
||||||
.ok_or_else(|| format_err!("Could not get the adjustment"))?;
|
.ok_or_else(|| format_err!("Could not get the adjustment"))?;
|
||||||
*guard = Some((oldid, SendCell::new(adj)));
|
*guard = Some((oldid, Fragile::new(adj)));
|
||||||
debug!("Widget Alignment was saved with ID: {}.", oldid);
|
debug!("Widget Alignment was saved with ID: {}.", oldid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ impl ShowWidget {
|
|||||||
.lock()
|
.lock()
|
||||||
.map_err(|err| format_err!("Failed to lock widget align mutex: {}", err))?;
|
.map_err(|err| format_err!("Failed to lock widget align mutex: {}", err))?;
|
||||||
|
|
||||||
if let Some((oldid, ref sendcell)) = *guard {
|
if let Some((oldid, ref fragile)) = *guard {
|
||||||
// Only copy the old scrollbar if both widget's represent the same podcast.
|
// Only copy the old scrollbar if both widget's represent the same podcast.
|
||||||
debug!("PID: {}", pd.id());
|
debug!("PID: {}", pd.id());
|
||||||
debug!("OLDID: {}", oldid);
|
debug!("OLDID: {}", oldid);
|
||||||
@ -118,9 +118,13 @@ impl ShowWidget {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Copy the vertical scrollbar adjustment from the old view into the new one.
|
// Copy the vertical scrollbar adjustment from the old view into the new one.
|
||||||
sendcell
|
let res = fragile
|
||||||
.try_get()
|
.try_get()
|
||||||
.map(|x| utils::smooth_scroll_to(&self.scrolled_window, &x));
|
.map(|x| utils::smooth_scroll_to(&self.scrolled_window, &x))
|
||||||
|
.map_err(From::from);
|
||||||
|
|
||||||
|
debug_assert!(res.is_ok());
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use gtk::prelude::*;
|
|||||||
|
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
use send_cell::SendCell;
|
use fragile::Fragile;
|
||||||
|
|
||||||
use podcasts_data::dbqueries;
|
use podcasts_data::dbqueries;
|
||||||
use podcasts_data::Show;
|
use podcasts_data::Show;
|
||||||
@ -17,7 +17,7 @@ use std::sync::Arc;
|
|||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref SHOWS_VIEW_VALIGNMENT: Mutex<Option<SendCell<gtk::Adjustment>>> = Mutex::new(None);
|
static ref SHOWS_VIEW_VALIGNMENT: Mutex<Option<Fragile<gtk::Adjustment>>> = Mutex::new(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@ -65,11 +65,15 @@ impl ShowsView {
|
|||||||
.lock()
|
.lock()
|
||||||
.map_err(|err| format_err!("Failed to lock widget align mutex: {}", err))?;
|
.map_err(|err| format_err!("Failed to lock widget align mutex: {}", err))?;
|
||||||
|
|
||||||
if let Some(ref sendcell) = *guard {
|
if let Some(ref fragile) = *guard {
|
||||||
// Copy the vertical scrollbar adjustment from the old view into the new one.
|
// Copy the vertical scrollbar adjustment from the old view into the new one.
|
||||||
sendcell
|
let res = fragile
|
||||||
.try_get()
|
.try_get()
|
||||||
.map(|x| utils::smooth_scroll_to(&self.scrolled_window, &x));
|
.map(|x| utils::smooth_scroll_to(&self.scrolled_window, &x))
|
||||||
|
.map_err(From::from);
|
||||||
|
|
||||||
|
debug_assert!(res.is_ok());
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -82,7 +86,7 @@ impl ShowsView {
|
|||||||
.scrolled_window
|
.scrolled_window
|
||||||
.get_vadjustment()
|
.get_vadjustment()
|
||||||
.ok_or_else(|| format_err!("Could not get the adjustment"))?;
|
.ok_or_else(|| format_err!("Could not get the adjustment"))?;
|
||||||
*guard = Some(SendCell::new(adj));
|
*guard = Some(Fragile::new(adj));
|
||||||
info!("Saved episodes_view alignment.");
|
info!("Saved episodes_view alignment.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user