summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/handle.h
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-09-02 00:16:56 +0200
committerDan McGee <dan@archlinux.org>2011-09-03 04:45:03 +0200
commit37da18aee8d925ee5cd9f526f2c61d07e9db5b66 (patch)
tree3ed740826f4463c8779080b07b57adbde1fe5c3b /lib/libalpm/handle.h
parentd88e524e7c6e902dcf1c0afed52def0d8b430b25 (diff)
downloadpacman-37da18aee8d925ee5cd9f526f2c61d07e9db5b66.tar.gz
pacman-37da18aee8d925ee5cd9f526f2c61d07e9db5b66.tar.xz
Move all callbacks up to the handle level
This was just disgusting before, unnecessary to limit these to only usage in a transaction. Still a lot of more room for cleanup but we'll start by attaching them to the handle rather than the transaction we may or may not even want to use these callbacks. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.h')
-rw-r--r--lib/libalpm/handle.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index 9e038581..8ceecd32 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -30,6 +30,25 @@
#include <curl/curl.h>
#endif
+#define EVENT(h, e, d1, d2) \
+do { \
+ if((h)->eventcb) { \
+ (h)->eventcb(e, d1, d2); \
+ } \
+} while(0)
+#define QUESTION(h, q, d1, d2, d3, r) \
+do { \
+ if((h)->convcb) { \
+ (h)->convcb(q, d1, d2, d3, r); \
+ } \
+} while(0)
+#define PROGRESS(h, e, p, per, n, r) \
+do { \
+ if((h)->progresscb) { \
+ (h)->progresscb(e, p, per, n, r); \
+ } \
+} while(0)
+
struct __alpm_handle_t {
/* internal usage */
alpm_db_t *db_local; /* local db pointer */
@@ -48,7 +67,10 @@ struct __alpm_handle_t {
alpm_cb_log logcb; /* Log callback function */
alpm_cb_download dlcb; /* Download callback function */
alpm_cb_totaldl totaldlcb; /* Total download callback function */
- alpm_cb_fetch fetchcb; /* Download file callback function */
+ alpm_cb_fetch fetchcb; /* Download file callback function */
+ alpm_cb_event eventcb;
+ alpm_cb_conv convcb;
+ alpm_cb_progress progresscb;
/* filesystem paths */
char *root; /* Root path, default '/' */