1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00

remove dead is-front-end-a-gui helper

This commit is contained in:
Wez Furlong 2020-10-03 00:04:50 -07:00
parent 75dca6e972
commit e8bf3a22f5
3 changed files with 5 additions and 20 deletions

View File

@ -427,13 +427,9 @@ fn get_error_window() -> ConnectionUI {
/// If there is no GUI front end, generates a toast notification instead.
pub fn show_configuration_error_message(err: &str) {
log::error!("While (re)loading configuration: {}", err);
if crate::frontend::has_gui_front_end() {
let ui = get_error_window();
let mut wrapped = textwrap::fill(&err, 78);
wrapped.push_str("\n");
ui.output_str(&wrapped);
} else {
crate::toast_notification("Wezterm Configuration", &err);
}
}

View File

@ -2,7 +2,6 @@ use anyhow::Error;
use downcast_rs::{impl_downcast, Downcast};
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
pub mod gui;
@ -12,15 +11,6 @@ thread_local! {
static FRONT_END: RefCell<Option<Rc<dyn FrontEnd>>> = RefCell::new(None);
}
static HAS_GUI_FRONT_END: AtomicBool = AtomicBool::new(false);
/// Returns true if a GUI frontend has been initialized, which implies that
/// it makes sense (and is safe) to use the window crate and associated
/// functionality
pub fn has_gui_front_end() -> bool {
HAS_GUI_FRONT_END.load(Ordering::Acquire)
}
pub fn front_end() -> Option<Rc<dyn FrontEnd>> {
let mut res = None;
FRONT_END.with(|f| {
@ -45,7 +35,6 @@ pub fn try_new(sel: FrontEndSelection) -> Result<Rc<dyn FrontEnd>, Error> {
let front_end = front_end?;
FRONT_END.with(|f| *f.borrow_mut() = Some(Rc::clone(&front_end)));
HAS_GUI_FRONT_END.store(true, Ordering::Release);
Ok(front_end)
}

View File

@ -296,7 +296,7 @@ fn update_checker() {
pub fn start_update_checker() {
static CHECKER_STARTED: AtomicBool = AtomicBool::new(false);
if crate::frontend::has_gui_front_end() && configuration().check_for_updates {
if configuration().check_for_updates {
if CHECKER_STARTED.compare_and_swap(false, true, Ordering::Relaxed) == false {
std::thread::Builder::new()
.name("update_checker".into())