mirror of
https://github.com/MeexReay/bRAC.git
synced 2025-09-13 23:47:39 +03:00
refactor: remove cargo warnings
This commit is contained in:
parent
21af7e2b8b
commit
213b812e28
@ -3,6 +3,7 @@ use std::collections::HashMap;
|
|||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::hash::{DefaultHasher, Hasher};
|
use std::hash::{DefaultHasher, Hasher};
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::sync::atomic::AtomicU64;
|
use std::sync::atomic::AtomicU64;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use std::sync::{atomic::Ordering, mpsc::channel, Arc, RwLock};
|
use std::sync::{atomic::Ordering, mpsc::channel, Arc, RwLock};
|
||||||
@ -12,10 +13,9 @@ use std::time::{Duration, SystemTime};
|
|||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use clap::crate_version;
|
use clap::crate_version;
|
||||||
|
|
||||||
use libadwaita::gdk::{MemoryTexture, Texture};
|
use libadwaita::gdk::Texture;
|
||||||
use libadwaita::glib::Variant;
|
|
||||||
use libadwaita::gtk::gdk_pixbuf::InterpType;
|
use libadwaita::gtk::gdk_pixbuf::InterpType;
|
||||||
use libadwaita::gtk::{Adjustment, Image, MenuButton};
|
use libadwaita::gtk::{Adjustment, MenuButton};
|
||||||
use libadwaita::{
|
use libadwaita::{
|
||||||
self as adw, ActionRow, Avatar, ButtonRow, EntryRow, HeaderBar, PreferencesDialog, PreferencesGroup, PreferencesPage, SpinRow, SwitchRow
|
self as adw, ActionRow, Avatar, ButtonRow, EntryRow, HeaderBar, PreferencesDialog, PreferencesGroup, PreferencesPage, SpinRow, SwitchRow
|
||||||
};
|
};
|
||||||
@ -49,6 +49,15 @@ use super::{
|
|||||||
on_send_message, parse_message, print_message, recv_tick, sanitize_message, SERVER_LIST,
|
on_send_message, parse_message, print_message, recv_tick, sanitize_message, SERVER_LIST,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub fn try_save_config(path: PathBuf, config: &Config) {
|
||||||
|
match save_config(path, config) {
|
||||||
|
Ok(_) => {},
|
||||||
|
Err(e) => {
|
||||||
|
println!("save config error: {e}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct UiModel {
|
struct UiModel {
|
||||||
is_dark_theme: bool,
|
is_dark_theme: bool,
|
||||||
chat_box: GtkBox,
|
chat_box: GtkBox,
|
||||||
@ -261,7 +270,7 @@ fn open_settings(ctx: Arc<Context>, app: &Application) {
|
|||||||
dialog.close();
|
dialog.close();
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
ctx.set_config(&config);
|
ctx.set_config(&config);
|
||||||
save_config(get_config_path(), &config);
|
try_save_config(get_config_path(), &config);
|
||||||
open_settings(ctx, &app);
|
open_settings(ctx, &app);
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
@ -523,7 +532,7 @@ fn open_settings(ctx: Arc<Context>, app: &Application) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
ctx.set_config(&config);
|
ctx.set_config(&config);
|
||||||
save_config(get_config_path(), &config);
|
try_save_config(get_config_path(), &config);
|
||||||
update_window_title(ctx.clone());
|
update_window_title(ctx.clone());
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -638,7 +647,7 @@ fn build_ui(ctx: Arc<Context>, app: &Application) -> UiModel {
|
|||||||
let mut config = ctx.config.read().unwrap().clone();
|
let mut config = ctx.config.read().unwrap().clone();
|
||||||
config.host = url.clone();
|
config.host = url.clone();
|
||||||
ctx.set_config(&config);
|
ctx.set_config(&config);
|
||||||
save_config(get_config_path(), &config);
|
try_save_config(get_config_path(), &config);
|
||||||
update_window_title(ctx.clone());
|
update_window_title(ctx.clone());
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user