Skip to content

Commit 7c13d21

Browse files
authored
Update actions.rs
1 parent b73ce13 commit 7c13d21

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

source-code/src/actions.rs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// src/actions.rs
2-
use gtk::prelude::*;
31
use gtk::Label;
42
use std::process::Command;
53
use webbrowser;
@@ -21,19 +19,6 @@ impl Actions {
2119
}
2220
}
2321

24-
pub fn run_command_with_feedback(&self, cmd: &str) {
25-
let full_cmd = format!("bash -c '{}'", cmd);
26-
let result = Command::new("pkexec")
27-
.arg(&full_cmd)
28-
.status();
29-
30-
let cmd_name = cmd.split('/').last().unwrap_or(cmd);
31-
match result {
32-
Ok(status) if status.success() => self.update_subtitle(&format!("Uruchomiono: {}.", cmd_name)),
33-
_ => self.update_subtitle(&format!("Błąd podczas uruchamiania: {}.", cmd_name)),
34-
}
35-
}
36-
3722
pub fn open_website(&self) {
3823
if webbrowser::open("https://hackeros-linux-system.github.io/HackerOS-Website/Home-page.html").is_ok() {
3924
self.update_subtitle("Otworzono stronę HackerOS.");
@@ -81,10 +66,9 @@ impl Actions {
8166
pub fn update_system(&self) {
8267
let terminal_cmd = "alacritty -e bash -c \"hacker update; read -p 'Chcesz zamknąć terminal? (t/n) ' answer; if [ \"$answer\" = 't' ]; then exit; else echo 'Terminal pozostanie otwarty.'; read; fi\"";
8368
let result = Command::new("sh")
84-
.arg("-c")
85-
.arg(terminal_cmd)
86-
.status();
87-
69+
.arg("-c")
70+
.arg(terminal_cmd)
71+
.status();
8872
match result {
8973
Ok(status) if status.success() => self.update_subtitle("Rozpoczęto aktualizację systemu w terminalu."),
9074
_ => self.update_subtitle("Błąd podczas uruchamiania aktualizacji systemu."),

0 commit comments

Comments
 (0)