mirror of
https://github.com/hinto-janai/gupax.git
synced 2024-12-23 11:29:38 +00:00
update: use [og: State] instead of [state] for Tor bool
This commit is contained in:
parent
52070ae00c
commit
adaa3a8a42
2 changed files with 9 additions and 12 deletions
19
src/gupax.rs
19
src/gupax.rs
|
@ -26,7 +26,7 @@ use std::sync::{Arc,Mutex};
|
||||||
use log::*;
|
use log::*;
|
||||||
|
|
||||||
impl Gupax {
|
impl Gupax {
|
||||||
pub fn show(state: &mut Gupax, width: f32, height: f32, update: &mut Update, version: Version, ctx: &egui::Context, ui: &mut egui::Ui) {
|
pub fn show(state: &mut Gupax, og: &Gupax, width: f32, height: f32, update: &mut Update, version: Version, ctx: &egui::Context, ui: &mut egui::Ui) {
|
||||||
// Update button + Progress bar
|
// Update button + Progress bar
|
||||||
ui.group(|ui| {
|
ui.group(|ui| {
|
||||||
// These are in unnecessary [ui.vertical()]'s
|
// These are in unnecessary [ui.vertical()]'s
|
||||||
|
@ -39,20 +39,17 @@ impl Gupax {
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.set_enabled(!updating);
|
ui.set_enabled(!updating);
|
||||||
if ui.add_sized([width, height], egui::Button::new("Check for updates")).on_hover_text(GUPAX_UPDATE).clicked() {
|
if ui.add_sized([width, height], egui::Button::new("Check for updates")).on_hover_text(GUPAX_UPDATE).clicked() {
|
||||||
update.path_p2pool = state.absolute_p2pool_path.display().to_string();
|
update.path_p2pool = og.absolute_p2pool_path.display().to_string();
|
||||||
update.path_xmrig = state.absolute_xmrig_path.display().to_string();
|
update.path_xmrig = og.absolute_xmrig_path.display().to_string();
|
||||||
update.tor = state.update_via_tor;
|
update.tor = og.update_via_tor;
|
||||||
let u = Arc::new(Mutex::new(update.clone()));
|
let update = Arc::new(Mutex::new(update.clone()));
|
||||||
let u = Arc::clone(&u);
|
|
||||||
let u2 = Arc::new(Mutex::new(update.clone()));
|
|
||||||
let u2 = Arc::clone(&u);
|
|
||||||
thread::spawn(move|| {
|
thread::spawn(move|| {
|
||||||
info!("Spawning update thread...");
|
info!("Spawning update thread...");
|
||||||
match Update::start(u, version) {
|
match Update::start(update.clone(), version) {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
info!("Update | {} ... FAIL", e);
|
info!("Update | {} ... FAIL", e);
|
||||||
*u2.lock().unwrap().msg.lock().unwrap() = format!("{} | {}", MSG_FAILED, e);
|
*update.lock().unwrap().msg.lock().unwrap() = format!("{} | {}", MSG_FAILED, e);
|
||||||
*u2.lock().unwrap().updating.lock().unwrap() = false;
|
*update.lock().unwrap().updating.lock().unwrap() = false;
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
|
@ -605,7 +605,7 @@ impl eframe::App for App {
|
||||||
Status::show(self, self.width, self.height, ctx, ui);
|
Status::show(self, self.width, self.height, ctx, ui);
|
||||||
}
|
}
|
||||||
Tab::Gupax => {
|
Tab::Gupax => {
|
||||||
Gupax::show(&mut self.state.gupax, self.width, self.height, &mut self.update, self.og.version.clone(), ctx, ui);
|
Gupax::show(&mut self.state.gupax, &self.og.gupax, self.width, self.height, &mut self.update, self.og.version.clone(), ctx, ui);
|
||||||
}
|
}
|
||||||
Tab::P2pool => {
|
Tab::P2pool => {
|
||||||
P2pool::show(&mut self.state.p2pool, self.width, self.height, ctx, ui);
|
P2pool::show(&mut self.state.p2pool, self.width, self.height, ctx, ui);
|
||||||
|
|
Loading…
Reference in a new issue