mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-03 06:38:52 +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,
|
profile_delete_confirm_dialog,
|
||||||
root_win: init.root_win.clone(),
|
root_win: init.root_win.clone(),
|
||||||
profile_editor: None,
|
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,
|
tracker: 0,
|
||||||
};
|
};
|
||||||
let widgets = view_output!();
|
let widgets = view_output!();
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
use crate::{stateless_action, withclones};
|
use crate::{
|
||||||
use gtk::prelude::*;
|
stateless_action,
|
||||||
|
ui::build_window::{BuildWindow, BuildWindowMsg, BuildWindowOutMsg},
|
||||||
|
withclones,
|
||||||
|
};
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
|
use gtk::prelude::*;
|
||||||
use relm4::{
|
use relm4::{
|
||||||
actions::{ActionGroupName, RelmAction, RelmActionGroup},
|
actions::{ActionGroupName, RelmAction, RelmActionGroup},
|
||||||
new_action_group, new_stateless_action,
|
new_action_group, new_stateless_action,
|
||||||
|
@ -24,17 +28,23 @@ pub enum StardustViewMsg {
|
||||||
FlatlandRepoChanged(String),
|
FlatlandRepoChanged(String),
|
||||||
|
|
||||||
AddClient,
|
AddClient,
|
||||||
|
|
||||||
|
CancelBuild,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum StardustViewOutMsg {}
|
pub enum StardustViewOutMsg {}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct StardustViewInit {}
|
pub struct StardustViewInit {
|
||||||
|
pub root_win: gtk::Window,
|
||||||
|
}
|
||||||
|
|
||||||
#[tracker::track]
|
#[tracker::track]
|
||||||
pub struct StardustView {
|
pub struct StardustView {
|
||||||
stardust_service_active: bool,
|
stardust_service_active: bool,
|
||||||
|
#[tracker::do_not_track]
|
||||||
|
build_window: Controller<BuildWindow>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[relm4::component(pub)]
|
#[relm4::component(pub)]
|
||||||
|
@ -231,19 +241,24 @@ impl SimpleComponent for StardustView {
|
||||||
match message {
|
match message {
|
||||||
Self::Input::BuildStardust => {
|
Self::Input::BuildStardust => {
|
||||||
println!("Build");
|
println!("Build");
|
||||||
},
|
self.build_window.sender().emit(BuildWindowMsg::Present);
|
||||||
|
}
|
||||||
Self::Input::UpdateStardust => {
|
Self::Input::UpdateStardust => {
|
||||||
println!("Update");
|
println!("Update");
|
||||||
},
|
self.build_window.sender().emit(BuildWindowMsg::Present);
|
||||||
|
}
|
||||||
|
Self::Input::CancelBuild => {
|
||||||
|
println!("Cancel Build");
|
||||||
|
}
|
||||||
Self::Input::StartClicked => {
|
Self::Input::StartClicked => {
|
||||||
println!("Start");
|
println!("Start");
|
||||||
},
|
}
|
||||||
Self::Input::StopClicked => {
|
Self::Input::StopClicked => {
|
||||||
println!("Stop");
|
println!("Stop");
|
||||||
},
|
}
|
||||||
Self::Input::RestartClicked => {
|
Self::Input::RestartClicked => {
|
||||||
println!("Restart");
|
println!("Restart");
|
||||||
},
|
}
|
||||||
Self::Input::AutostartChanged(val) => {
|
Self::Input::AutostartChanged(val) => {
|
||||||
println!("Autostart: {}", val);
|
println!("Autostart: {}", val);
|
||||||
}
|
}
|
||||||
|
@ -278,6 +293,12 @@ impl SimpleComponent for StardustView {
|
||||||
) -> ComponentParts<Self> {
|
) -> ComponentParts<Self> {
|
||||||
let model = Self {
|
let model = Self {
|
||||||
stardust_service_active: false,
|
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,
|
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 }
|
ComponentParts { model, widgets }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue