Refactorings and dead code removal
This commit is contained in:
parent
8049859816
commit
d269924827
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with Fit
|
|||
|
||||
use crate::{
|
||||
app::App,
|
||||
views::{HistoricalView, PlaceholderView, View, ViewName, WelcomeView},
|
||||
views::{HistoricalView, PlaceholderView, View, WelcomeView},
|
||||
};
|
||||
use adw::prelude::*;
|
||||
use chrono::{Duration, Local};
|
||||
|
@ -148,13 +148,11 @@ impl AppWindow {
|
|||
}
|
||||
|
||||
fn on_apply_config(&self, path: PathBuf) {
|
||||
println!("saving configuration");
|
||||
glib::spawn_future_local({
|
||||
let s = self.clone();
|
||||
async move {
|
||||
if s.app.open_db(path.clone()).await.is_ok() {
|
||||
let settings = gio::Settings::new(&s.app_id);
|
||||
let _ = settings.set("series-path", path.to_str().unwrap());
|
||||
let _ = s.settings.set("series-path", path.to_str().unwrap());
|
||||
s.show_historical_view();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,41 +57,8 @@ fn main() {
|
|||
.resource_base_path(RESOURCE_BASE_PATH)
|
||||
.build();
|
||||
|
||||
let runtime = tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
adw_app.connect_activate(move |adw_app| {
|
||||
AppWindow::new(app_id, RESOURCE_BASE_PATH, adw_app, ft_app.clone());
|
||||
|
||||
/*
|
||||
// Spawn a future where the UI will receive messages for the app window. Previously, this
|
||||
// would have been done by creating a glib::MainContext::channel(), but that has been
|
||||
// deprecated since gtk 4.10 in favor of using `async_channel`.
|
||||
glib::spawn_future_local(async move {
|
||||
// The app requests data to start with. This kicks everything off. The response from
|
||||
// the app will cause the window to be updated shortly.
|
||||
let _ = app_tx.send(app::AppInvocation::RequestRecords).await;
|
||||
|
||||
while let Ok(response) = ui_rx.recv().await {
|
||||
window.process_response(response);
|
||||
}
|
||||
});
|
||||
|
||||
// The tokio runtime starts up here and will handle all of the asynchronous operations that
|
||||
// the application needs to do. Messages arrive on `app_rx` and responses will be sent via
|
||||
// `ui_tx`.
|
||||
runtime.spawn({
|
||||
let app = app.clone();
|
||||
async move {
|
||||
while let Ok(invocation) = app_rx.recv().await {
|
||||
let response = app.process_invocation(invocation).await;
|
||||
let _ = ui_tx.send(response).await;
|
||||
}
|
||||
}
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
|
|
@ -25,12 +25,6 @@ pub use placeholder_view::PlaceholderView;
|
|||
mod welcome_view;
|
||||
pub use welcome_view::WelcomeView;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum ViewName {
|
||||
Welcome,
|
||||
Historical,
|
||||
}
|
||||
|
||||
pub enum View {
|
||||
Placeholder(PlaceholderView),
|
||||
Welcome(WelcomeView),
|
||||
|
|
Loading…
Reference in New Issue