better hooks support

This commit is contained in:
guinux 2016-02-06 09:33:07 +01:00
parent d777a60c7a
commit e53a71fc3a
2 changed files with 16 additions and 2 deletions

View File

@ -834,7 +834,7 @@ private void cb_event (Alpm.Event.Data data) {
break;
case Alpm.Event.Type.HOOK_RUN_START:
details += data.hook_run_name;
details += data.hook_run_desc;
details += data.hook_run_desc ?? "";
details += data.hook_run_position.to_string ();
details += data.hook_run_total.to_string ();
break;

View File

@ -685,7 +685,21 @@ namespace Pamac {
}
break;
case Alpm.Event.Type.HOOK_RUN_START:
msg = "%s:%s %s/%s".printf (details[0], details[1], details[2], details[3]);
string textbar = "%s/%s".printf (details[2], details[3]);
if (textbar != previous_textbar) {
previous_textbar = textbar;
progress_dialog.progressbar.set_text (textbar);
}
float fraction = (float) int.parse (details[2]) / int.parse (details[3]);
if (fraction != previous_percent) {
previous_percent = fraction;
progress_dialog.progressbar.set_fraction (fraction);
}
if (details[1] != "") {
msg = details[1] + ":";
} else {
msg = details[0] + ":";
}
progress_dialog.spawn_in_term ({"echo", msg});
break;
case Alpm.Event.Type.CHECKDEPS_START: