mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-04-20 19:44:50 +00:00
feat(stardust): build window
This commit is contained in:
parent
0f0a0f8e68
commit
8e865a2675
2 changed files with 36 additions and 10 deletions
|
@ -662,7 +662,9 @@ impl SimpleComponent for MainView {
|
|||
profile_delete_confirm_dialog,
|
||||
root_win: init.root_win.clone(),
|
||||
profile_editor: None,
|
||||
stardust_view: StardustView::builder().launch(StardustViewInit {}).detach(),
|
||||
stardust_view: StardustView::builder().launch(StardustViewInit {
|
||||
root_win: init.root_win.clone()
|
||||
}).detach(),
|
||||
tracker: 0,
|
||||
};
|
||||
let widgets = view_output!();
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
use crate::{stateless_action, withclones};
|
||||
use gtk::prelude::*;
|
||||
use crate::{
|
||||
stateless_action,
|
||||
ui::build_window::{BuildWindow, BuildWindowMsg, BuildWindowOutMsg},
|
||||
withclones,
|
||||
};
|
||||
use adw::prelude::*;
|
||||
use gtk::prelude::*;
|
||||
use relm4::{
|
||||
actions::{ActionGroupName, RelmAction, RelmActionGroup},
|
||||
new_action_group, new_stateless_action,
|
||||
|
@ -24,17 +28,23 @@ pub enum StardustViewMsg {
|
|||
FlatlandRepoChanged(String),
|
||||
|
||||
AddClient,
|
||||
|
||||
CancelBuild,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum StardustViewOutMsg {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct StardustViewInit {}
|
||||
pub struct StardustViewInit {
|
||||
pub root_win: gtk::Window,
|
||||
}
|
||||
|
||||
#[tracker::track]
|
||||
pub struct StardustView {
|
||||
stardust_service_active: bool,
|
||||
#[tracker::do_not_track]
|
||||
build_window: Controller<BuildWindow>,
|
||||
}
|
||||
|
||||
#[relm4::component(pub)]
|
||||
|
@ -231,19 +241,24 @@ impl SimpleComponent for StardustView {
|
|||
match message {
|
||||
Self::Input::BuildStardust => {
|
||||
println!("Build");
|
||||
},
|
||||
self.build_window.sender().emit(BuildWindowMsg::Present);
|
||||
}
|
||||
Self::Input::UpdateStardust => {
|
||||
println!("Update");
|
||||
},
|
||||
self.build_window.sender().emit(BuildWindowMsg::Present);
|
||||
}
|
||||
Self::Input::CancelBuild => {
|
||||
println!("Cancel Build");
|
||||
}
|
||||
Self::Input::StartClicked => {
|
||||
println!("Start");
|
||||
},
|
||||
}
|
||||
Self::Input::StopClicked => {
|
||||
println!("Stop");
|
||||
},
|
||||
}
|
||||
Self::Input::RestartClicked => {
|
||||
println!("Restart");
|
||||
},
|
||||
}
|
||||
Self::Input::AutostartChanged(val) => {
|
||||
println!("Autostart: {}", val);
|
||||
}
|
||||
|
@ -278,6 +293,12 @@ impl SimpleComponent for StardustView {
|
|||
) -> ComponentParts<Self> {
|
||||
let model = Self {
|
||||
stardust_service_active: false,
|
||||
build_window: BuildWindow::builder()
|
||||
.transient_for(init.root_win)
|
||||
.launch(())
|
||||
.forward(sender.input_sender(), |msg| match msg {
|
||||
BuildWindowOutMsg::CancelBuild => Self::Input::CancelBuild,
|
||||
}),
|
||||
tracker: 0,
|
||||
};
|
||||
|
||||
|
@ -298,7 +319,10 @@ impl SimpleComponent for StardustView {
|
|||
});
|
||||
}
|
||||
|
||||
root.insert_action_group(StardustActionGroup::NAME, Some(&actions.into_action_group()));
|
||||
root.insert_action_group(
|
||||
StardustActionGroup::NAME,
|
||||
Some(&actions.into_action_group()),
|
||||
);
|
||||
|
||||
ComponentParts { model, widgets }
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue