Skip to content

Commit

Permalink
feat: require 7z binary
Browse files Browse the repository at this point in the history
  • Loading branch information
krypt0nn committed Sep 11, 2024
1 parent e17545f commit 569954d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
26 changes: 21 additions & 5 deletions src/ui/first_run/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl SimpleAsyncComponent for DependenciesApp {

gtk::Label {
set_label: &tr!("missing-dependencies-message"),

set_justify: gtk::Justification::Center,
set_wrap: true,
set_margin_top: 32
Expand All @@ -68,7 +68,7 @@ impl SimpleAsyncComponent for DependenciesApp {
},

gtk::Entry {
set_text: "sudo pacman -Syu git libwebp",
set_text: "sudo pacman -Syu git p7zip libwebp",
set_editable: false
}
},
Expand All @@ -85,7 +85,7 @@ impl SimpleAsyncComponent for DependenciesApp {
},

gtk::Entry {
set_text: "sudo apt install git webp",
set_text: "sudo apt install git p7zip-full webp",
set_editable: false
}
},
Expand All @@ -102,7 +102,7 @@ impl SimpleAsyncComponent for DependenciesApp {
},

gtk::Entry {
set_text: "sudo dnf install git libwebp-tools",
set_text: "sudo dnf install git p7zip libwebp-tools",
set_editable: false
}
},
Expand All @@ -119,6 +119,10 @@ impl SimpleAsyncComponent for DependenciesApp {
set_title: "git"
},

adw::ActionRow {
set_title: "p7zip"
},

adw::ActionRow {
set_title: "libwebp"
}
Expand All @@ -130,7 +134,7 @@ impl SimpleAsyncComponent for DependenciesApp {
add = &adw::PreferencesGroup {
set_valign: gtk::Align::Center,
set_vexpand: true,

gtk::Box {
set_orientation: gtk::Orientation::Horizontal,
set_halign: gtk::Align::Center,
Expand Down Expand Up @@ -202,6 +206,18 @@ impl SimpleAsyncComponent for DependenciesApp {
}
}

// 7z sometimes has different binaries
if !is_available("7z") && !is_available("7za") {
sender.output(Self::Output::Toast {
title: tr!("package-not-available", {
"package" = "7z"
}),
description: None
});

return;
}

sender.output(Self::Output::ScrollToDefaultPaths);
}

Expand Down
7 changes: 4 additions & 3 deletions src/ui/first_run/tos_warning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ impl SimpleAsyncComponent for TosWarningApp {
add = &adw::PreferencesGroup {
set_valign: gtk::Align::Center,
set_vexpand: true,

gtk::Box {
set_orientation: gtk::Orientation::Horizontal,
set_halign: gtk::Align::Center,
set_spacing: 8,

gtk::Button {
set_label: &tr!("continue"),
set_css_classes: &["suggested-action", "pill"],
Expand Down Expand Up @@ -105,7 +105,8 @@ impl SimpleAsyncComponent for TosWarningApp {
"continue" => {
let installed =
is_available("git") &&
is_available("dwebp");
is_available("dwebp") &&
(is_available("7z") || is_available("7za"));

if installed {
sender.output(Self::Output::ScrollToDefaultPaths);
Expand Down

0 comments on commit 569954d

Please sign in to comment.