mirror of
https://github.com/13hannes11/toolbx-tuner.git
synced 2024-09-03 23:21:00 +02:00
remove all code and start with relm4 0.6
This commit is contained in:
52
src/main.rs
52
src/main.rs
@@ -1,17 +1,47 @@
|
||||
use std::collections::VecDeque;
|
||||
#[rustfmt::skip]
|
||||
mod config;
|
||||
mod app;
|
||||
mod modals;
|
||||
mod setup;
|
||||
|
||||
use relm4::gtk::{Application, ApplicationWindow};
|
||||
use relm4::{factory::FactoryVecDeque, RelmApp};
|
||||
use ui::app::model::AppModel;
|
||||
use util::toolbx::ToolbxContainer;
|
||||
use gtk::prelude::ApplicationExt;
|
||||
use relm4::{
|
||||
actions::{AccelsPlus, RelmAction, RelmActionGroup},
|
||||
gtk, main_application, RelmApp,
|
||||
};
|
||||
|
||||
mod ui;
|
||||
mod util;
|
||||
use app::App;
|
||||
use setup::setup;
|
||||
|
||||
relm4::new_action_group!(AppActionGroup, "app");
|
||||
relm4::new_stateless_action!(QuitAction, AppActionGroup, "quit");
|
||||
|
||||
fn main() {
|
||||
let mut model = AppModel {
|
||||
toolboxes: FactoryVecDeque::new(),
|
||||
// Enable logging
|
||||
tracing_subscriber::fmt()
|
||||
.with_span_events(tracing_subscriber::fmt::format::FmtSpan::FULL)
|
||||
.with_max_level(tracing::Level::INFO)
|
||||
.init();
|
||||
|
||||
setup();
|
||||
|
||||
let app = main_application();
|
||||
app.set_resource_base_path(Some("/org/kuchelmeister/ToolboxTuner/"));
|
||||
|
||||
let mut actions = RelmActionGroup::<AppActionGroup>::new();
|
||||
|
||||
let quit_action = {
|
||||
let app = app.clone();
|
||||
RelmAction::<QuitAction>::new_stateless(move |_| {
|
||||
app.quit();
|
||||
})
|
||||
};
|
||||
let app = RelmApp::new(model);
|
||||
app.run();
|
||||
actions.add_action(quit_action);
|
||||
actions.register_for_main_application();
|
||||
|
||||
app.set_accelerators_for_action::<QuitAction>(&["<Control>q"]);
|
||||
|
||||
let app = RelmApp::from_app(app);
|
||||
|
||||
app.run::<App>(());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user