Commit 1769177a authored by Sophie Herold's avatar Sophie Herold

Add some more status output

Fixes #17
parent 19a014a4
Pipeline #206892 passed with stage
in 19 minutes and 57 seconds
......@@ -916,6 +916,8 @@ This might take a while.</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label">&lt;placeholder&gt;</property>
<property name="ellipsize">end</property>
<property name="single-line-mode">True</property>
<attributes>
<attribute name="scale" value="0.90000000000000002"/>
</attributes>
......
......@@ -369,7 +369,9 @@ fn add_exclude() {
}
pub fn refresh_statusx() {
main_ui().backup_run().set_sensitive(true);
if let Some(communication) = BACKUP_COMMUNICATION.load().get_active() {
main_ui().backup_run().set_sensitive(false);
refresh_status(communication);
} else if let Some(backup) = SETTINGS.load().backups.get_active() {
refresh_offline(&backup.last_run);
......@@ -450,7 +452,7 @@ pub fn refresh_status(communication: &borg::Communication) -> Continue {
main_ui().archive_progress().set_fraction(fraction);
main_ui()
.status_subtext()
.set_text(&format!("{:.1} % finished", fraction * 100.0))
.set_text(&gettext!("{:.1} % finished", fraction * 100.0))
} else {
main_ui().archive_progress().hide();
}
......@@ -466,10 +468,18 @@ pub fn refresh_status(communication: &borg::Communication) -> Continue {
}
Progress::Message {
message: Some(ref message),
ref msgid,
..
} => {
stack.set_visible_child_name("message");
main_ui().message().set_text(message);
if msgid.as_ref().map(|x| x.starts_with("cache.")) == Some(true) {
main_ui()
.status_subtext()
.set_text(&gettext("Updating repository information"));
} else {
main_ui().status_subtext().set_text(message);
}
}
Progress::Percent {
current: Some(current),
......@@ -478,10 +488,12 @@ pub fn refresh_status(communication: &borg::Communication) -> Continue {
..
} => {
stack.set_visible_child_name("percent");
main_ui()
.progress()
.set_fraction(current as f64 / total as f64);
let fraction = current as f64 / total as f64;
main_ui().progress().set_fraction(fraction);
main_ui().percent_message().set_text(message);
main_ui()
.status_subtext()
.set_text(&gettext!("{:.1} % prepared", fraction * 100.0))
}
// TODO: cover progress message?
_ => {}
......
......@@ -132,7 +132,14 @@ fn add_repo_list_activated(row: &gtk::ListBoxRow, ui: Rc<builder::NewBackup>) {
ui.add_button().show();
ui.add_button().grab_default();
} else {
add_repo_config_local(std::path::Path::new(&name), ui);
let path = match glib::filename_from_uri(&name) {
Ok((path, _)) => path,
Err(err) => {
ui::utils::dialog_error(format!("URI conversion: {:?}", err));
return;
}
};
add_repo_config_local(std::path::Path::new(&path), ui);
}
}
......@@ -358,7 +365,22 @@ fn insert_backup_config_encryption_unknown(
) {
let mut borg = borg::Borg::new(config.clone());
borg.set_password(Zeroizing::new(vec![]));
config.encrypted = borg.peak().is_err();
// TODO: This is not async
if let Err(err) = borg.peak() {
if matches!(err, shared::BorgErr::PasswordMissing)
|| err.has_borg_msgid(&shared::MsgId::PassphraseWrong)
{
config.encrypted = true;
} else {
ui::utils::dialog_error(gettext!(
"There was an error with the specified repository:\n\n{}",
err
));
return;
}
}
insert_backup_config_password_unknown(config, ui);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment