Skip to content

Commit

Permalink
1.3.1: Fix fc-cache
Browse files Browse the repository at this point in the history
D'oh, forgot to loop
  • Loading branch information
mmstick committed Nov 12, 2017
1 parent 72cb57f commit 75be3b1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Michael Aaron Murphy <mmstickman@gmail.com>"]
name = "fontfinder"
version = "1.3.0"
version = "1.3.1"

[[bin]]
name = "fontfinder"
Expand Down
16 changes: 9 additions & 7 deletions src/bin/fc_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
use std::thread;
use std::time::Duration;

pub static RUN_FC_FACHE: AtomicBool = ATOMIC_BOOL_INIT;
pub static RUN_FC_CACHE: AtomicBool = ATOMIC_BOOL_INIT;

pub fn fc_cache_event_loop() {
thread::spawn(|| {
thread::sleep(Duration::from_millis(100));
if RUN_FC_FACHE.swap(false, Ordering::Relaxed) {
let _ = Command::new("fc-cache")
.arg("-f")
.spawn()
.map(|mut child| child.wait());
loop {
thread::sleep(Duration::from_millis(100));
if RUN_FC_CACHE.swap(false, Ordering::Relaxed) {
let _ = Command::new("fc-cache")
.arg("-f")
.spawn()
.map(|mut child| child.wait());
}
}
});
}
6 changes: 3 additions & 3 deletions src/bin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extern crate webkit2gtk;
mod fc_cache;
mod gtk_ui;

use self::fc_cache::{fc_cache_event_loop, RUN_FC_FACHE};
use self::fc_cache::{fc_cache_event_loop, RUN_FC_CACHE};
use fontfinder::{dirs, fonts, html, FontError};
use fontfinder::fonts::FontsList;
use gtk::*;
Expand Down Expand Up @@ -210,7 +210,7 @@ fn main() {
uninstall.set_visible(true);
console_panel.set_visible(true);
font.container.set_visible(installed.get_active());
RUN_FC_FACHE.store(true, Ordering::Relaxed);
RUN_FC_CACHE.store(true, Ordering::Relaxed);
let _ = str::from_utf8(&string).map(|s| update_console(&console, s));
update_console(&console, &format!("{} installed\n", &font.family));
}
Expand Down Expand Up @@ -238,7 +238,7 @@ fn main() {
uninstall.set_visible(false);
install.set_visible(true);
console_panel.set_visible(true);
RUN_FC_FACHE.store(true, Ordering::Relaxed);
RUN_FC_CACHE.store(true, Ordering::Relaxed);
let _ = str::from_utf8(&string).map(|s| update_console(&console, s));
update_console(&console, &format!("{} uninstalled\n", &font.family));
}
Expand Down

0 comments on commit 75be3b1

Please sign in to comment.