Skip to content

Commit

Permalink
feat: show info on how to enable the daemon if it is not running
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-zlobintsev committed Nov 1, 2023
1 parent df28a63 commit 12de47a
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions lact-gui/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,44 @@ impl App {
app.window.show();

if app.daemon_client.embedded {
show_error(&app.window, anyhow!(
"Could not connect to daemon, running in embedded mode. \n\
let text = "Could not connect to daemon, running in embedded mode. \n\
Please make sure the lactd service is running. \n\
Using embedded mode, you will not be able to change any settings."
));
Using embedded mode, you will not be able to change any settings. \n\
\n\
To enable the daemon, run the following command:";

let text_label = Label::new(Some(text));
let enable_label = Entry::builder()
.text("sudo systemctl enable --now lactd")
.editable(false)
.build();

let vbox = Box::builder()
.orientation(Orientation::Vertical)
.margin_top(10)
.margin_bottom(10)
.margin_start(10)
.margin_end(10)
.build();

let close_button = Button::builder().label("Close").build();

vbox.append(&text_label);
vbox.append(&enable_label);
vbox.append(&close_button);

let diag = MessageDialog::builder()
.title("Daemon info")
.message_type(MessageType::Warning)
.child(&vbox)
.transient_for(&app.window)
.build();

close_button.connect_clicked(clone!(@strong diag => move |_| diag.hide()));

diag.run_async(|diag, _| {
diag.hide();
})
}
}));

Expand Down

0 comments on commit 12de47a

Please sign in to comment.