xref: /haiku/src/bin/pkgman/JobStateListener.cpp (revision c80809a3ab0b0a2ce53ea861a2b00ace24ff452d)
1 /*
2  * Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <stdio.h>
8 
9 #include "JobStateListener.h"
10 #include "pkgman.h"
11 
12 
13 using BPackageKit::BJob;
14 
15 
16 void
17 JobStateListener::JobStarted(BJob* job)
18 {
19 	printf("%s ...\n", job->Title().String());
20 }
21 
22 
23 void
24 JobStateListener::JobSucceeded(BJob* job)
25 {
26 }
27 
28 
29 void
30 JobStateListener::JobFailed(BJob* job)
31 {
32 	BString error = job->ErrorString();
33 	if (error.Length() > 0) {
34 		error.ReplaceAll("\n", "\n*** ");
35 		fprintf(stderr, "%s", error.String());
36 	}
37 	DIE(job->Result(), "failed!");
38 }
39 
40 
41 void
42 JobStateListener::JobAborted(BJob* job)
43 {
44 	DIE(job->Result(), "aborted");
45 }
46