diff --git a/src/ui/stardust/stardust_view.rs b/src/ui/stardust/stardust_view.rs index 0a6e151..b93a653 100644 --- a/src/ui/stardust/stardust_view.rs +++ b/src/ui/stardust/stardust_view.rs @@ -20,6 +20,10 @@ pub enum StardustViewMsg { OverlayPriorityChanged(u32), DisableControllerChanged(bool), RepoChanged(String), + FlatlandEnabledChanged(bool), + FlatlandRepoChanged(String), + + AddClient, } #[derive(Debug)] @@ -166,6 +170,56 @@ impl SimpleComponent for StardustView { } }, }, + gtk::Label { + add_css_class: "title-3", + set_label: "Clients", + set_hexpand: true, + set_xalign: 0.0, + }, + gtk::ListBox { + add_css_class: "boxed-list", + set_selection_mode: gtk::SelectionMode::None, + // builtin clients + adw::ExpanderRow { + set_title: "Flatland", + set_subtitle_lines: 0, + set_subtitle: "A panel item UI so you can interact with your apps using virtual touchscreens", + add_suffix: flatland_switch = >k::Switch { + set_halign: gtk::Align::Center, + set_valign: gtk::Align::Center, + set_hexpand: false, + set_vexpand: false, + connect_activate[sender] => move |sw| { + sender.input(Self::Input::FlatlandEnabledChanged(sw.is_active())); + }, + }, + #[chain(flags(gtk::glib::BindingFlags::BIDIRECTIONAL).build())] + bind_property: ("enable-expansion", &flatland_switch, "active"), + add_row: flatland_repo_entryrow = &adw::EntryRow { + set_title: "Repository#git ref", + // TODO: settings + // set_text: model.settings.clients.builtin.flatland.repo, + set_text: "https://github.com/StardustXR/flatland#main", + connect_changed[sender] => move |row| { + sender.input(Self::Input::FlatlandRepoChanged(row.text().into())); + }, + }, + }, + adw::ActionRow { + set_tooltip_text: Some("Add new client..."), + set_activatable: true, + set_child: Some(>k::Image::builder() + .icon_name("list-add-symbolic") + .margin_start(12) + .margin_end(12) + .margin_top(12) + .margin_bottom(12) + .build()), + connect_activated[sender] => move |_| { + sender.input(Self::Input::AddClient) + } + }, + }, } } } @@ -205,6 +259,15 @@ impl SimpleComponent for StardustView { Self::Input::RepoChanged(val) => { println!("RepoChanged: {}", val); } + Self::Input::FlatlandRepoChanged(val) => { + println!("FlatlandRepoChanged: {}", val); + } + Self::Input::FlatlandEnabledChanged(val) => { + println!("FlatlandEnabledChanged: {}", val); + } + Self::Input::AddClient => { + println!("AddClient"); + } }; }