From 19d1deead8eec30bd1af3b68d33e24d4bf74f99e Mon Sep 17 00:00:00 2001 From: Nikita Podvirnyi Date: Mon, 27 May 2024 14:20:47 +0200 Subject: [PATCH] feat: list missing dependencies on non-standard distros Hello NixOS! --- .idea/.gitignore | 8 ++++++++ .idea/an-anime-game-launcher.iml | 11 ++++++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ .vscode/extensions.json | 9 -------- .vscode/launch.json | 26 ------------------------ .vscode/settings.json | 10 --------- src/ui/first_run/dependencies.rs | 35 ++++++++++++++++++++++++++++---- 8 files changed, 64 insertions(+), 49 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/an-anime-game-launcher.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml delete mode 100644 .vscode/extensions.json delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/settings.json diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/an-anime-game-launcher.iml b/.idea/an-anime-game-launcher.iml new file mode 100644 index 0000000..cf84ae4 --- /dev/null +++ b/.idea/an-anime-game-launcher.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2f2654c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index f8d40f3..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "recommendations": [ - "vivaxy.vscode-conventional-commits", - "gruntfuggly.todo-tree", - "rust-lang.rust-analyzer", - "bungcip.better-toml", - "serayuzgur.crates" - ] -} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 1d21b2f..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "lldb", - "request": "launch", - "name": "Debug", - "cargo": { - "args": [ - "build", - "--bin=anime-game-launcher", - "--package=anime-game-launcher" - ], - "filter": { - "name": "anime-game-launcher", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9210ffa..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "conventionalCommits.scopes": [ - "tracing", - "core", - "ui", - "i18n" - ], - "editor.tabCompletion": "on", - "diffEditor.codeLens": true -} \ No newline at end of file diff --git a/src/ui/first_run/dependencies.rs b/src/ui/first_run/dependencies.rs index e43883a..0f5490e 100644 --- a/src/ui/first_run/dependencies.rs +++ b/src/ui/first_run/dependencies.rs @@ -10,7 +10,8 @@ use super::main::FirstRunAppMsg; pub struct DependenciesApp { show_arch: bool, show_debian: bool, - show_fedora: bool + show_fedora: bool, + show_list: bool } #[derive(Debug, Clone)] @@ -21,9 +22,9 @@ pub enum DependenciesAppMsg { #[relm4::component(async, pub)] impl SimpleAsyncComponent for DependenciesApp { - type Init = (); type Input = DependenciesAppMsg; type Output = FirstRunAppMsg; + type Init = (); view! { adw::PreferencesPage { @@ -104,6 +105,28 @@ impl SimpleAsyncComponent for DependenciesApp { set_text: "sudo dnf install git xdelta p7zip", set_editable: false } + }, + + gtk::Box { + set_orientation: gtk::Orientation::Vertical, + set_spacing: 16, + + #[watch] + set_visible: model.show_list, + + adw::PreferencesGroup { + adw::ActionRow { + set_title: "git" + }, + + adw::ActionRow { + set_title: "xdelta3" + }, + + adw::ActionRow { + set_title: "p7zip" + } + } } } }, @@ -138,7 +161,7 @@ impl SimpleAsyncComponent for DependenciesApp { async fn init(_init: Self::Init, root: Self::Root, _sender: AsyncComponentSender) -> AsyncComponentParts { let distro = whatadistro::identify(); - let model = Self { + let mut model = Self { show_arch: match &distro { Some(distro) => distro.is_similar("arch"), None => false @@ -152,9 +175,13 @@ impl SimpleAsyncComponent for DependenciesApp { show_fedora: match &distro { Some(distro) => distro.is_similar("fedora"), None => false - } + }, + + show_list: false }; + model.show_list = !model.show_arch && !model.show_debian && !model.show_fedora; + let widgets = view_output!(); AsyncComponentParts { model, widgets }