show warning message if podman and docker are not installed
Some checks failed
Publish Release / Publish binaries (push) Has been cancelled
Some checks failed
Publish Release / Publish binaries (push) Has been cancelled
This commit is contained in:
parent
ea4382957e
commit
fac9aad9b4
3 changed files with 42 additions and 3 deletions
|
@ -40,6 +40,11 @@
|
|||
<url type="help">https://dvlv.github.io/BoxBuddyRS</url>
|
||||
|
||||
<releases>
|
||||
<release version="2.2.13" date="2024-09-28">
|
||||
<description>
|
||||
<p>Added detection for a system without Podman or Docker</p>
|
||||
</description>
|
||||
</release>
|
||||
<release version="2.2.12" date="2024-09-09">
|
||||
<description>
|
||||
<p>Translation Updates</p>
|
||||
|
|
25
src/main.rs
25
src/main.rs
|
@ -28,7 +28,7 @@ use utils::{
|
|||
get_download_dir_path, get_my_deb_boxes, get_my_rpm_boxes, get_rpm_distros,
|
||||
get_supported_terminals, get_supported_terminals_list, get_terminal_and_separator_arg,
|
||||
has_distrobox_installed, has_file_extension, has_home_or_host_access, has_host_access,
|
||||
set_up_localisation,
|
||||
has_podman_or_docker_installed, set_up_localisation,
|
||||
};
|
||||
const APP_ID: &str = "io.github.dvlv.boxbuddyrs";
|
||||
|
||||
|
@ -100,7 +100,11 @@ fn make_window(app: &Application) -> ApplicationWindow {
|
|||
window.set_child(Some(&toast_overlay));
|
||||
|
||||
if has_distrobox_installed() {
|
||||
load_boxes(&scroll_area, &window, Some(0));
|
||||
if has_podman_or_docker_installed() {
|
||||
load_boxes(&scroll_area, &window, Some(0));
|
||||
} else {
|
||||
render_podman_not_installed(&scroll_area);
|
||||
}
|
||||
} else {
|
||||
render_not_installed(&scroll_area);
|
||||
}
|
||||
|
@ -285,6 +289,21 @@ fn render_not_installed(scroll_area: >k::Box) {
|
|||
scroll_area.append(¬_installed_lbl_two);
|
||||
}
|
||||
|
||||
fn render_podman_not_installed(scroll_area: >k::Box) {
|
||||
// TRANSLATORS: Error message
|
||||
let not_installed_lbl = gtk::Label::new(Some(&gettext("Podman / Docker not found!")));
|
||||
not_installed_lbl.add_css_class("title-1");
|
||||
|
||||
// TRANSLATORS: Error message
|
||||
let not_installed_lbl_two = gtk::Label::new(Some(&gettext(
|
||||
"Could not find podman or docker, please install one of them!",
|
||||
)));
|
||||
not_installed_lbl_two.add_css_class("title-2");
|
||||
|
||||
scroll_area.append(¬_installed_lbl);
|
||||
scroll_area.append(¬_installed_lbl_two);
|
||||
}
|
||||
|
||||
fn load_boxes(scroll_area: >k::Box, window: &ApplicationWindow, active_page: Option<u32>) {
|
||||
let tabs = Notebook::new();
|
||||
tabs.set_tab_pos(PositionType::Left);
|
||||
|
@ -869,7 +888,7 @@ fn show_about_popup(window: &ApplicationWindow) {
|
|||
let d = adw::AboutWindow::new();
|
||||
d.set_transient_for(Some(window));
|
||||
d.set_application_name("BoxBuddy");
|
||||
d.set_version("2.2.12");
|
||||
d.set_version("2.2.13");
|
||||
d.set_developer_name("Dvlv");
|
||||
d.set_license_type(gtk::License::MitX11);
|
||||
// TRANSLATORS: Description of the application
|
||||
|
|
15
src/utils.rs
15
src/utils.rs
|
@ -226,6 +226,21 @@ pub fn has_distrobox_installed() -> bool {
|
|||
true
|
||||
}
|
||||
|
||||
/// Whether or not the `podman` or `docker` command can be successfully run
|
||||
pub fn has_podman_or_docker_installed() -> bool {
|
||||
let output = get_command_output("which", Some(&["podman"]));
|
||||
|
||||
if output.contains("no podman in") || output.is_empty() {
|
||||
let docker_output = get_command_output("which", Some(&["docker"]));
|
||||
|
||||
if docker_output.contains("no docker in") || docker_output.is_empty() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
/// Returns a Vec of `TerminalOption`s representing all terminals supported by `BoxBuddy`
|
||||
pub fn get_supported_terminals() -> Vec<TerminalOption> {
|
||||
vec![
|
||||
|
|
Loading…
Reference in a new issue