From 37da18aee8d925ee5cd9f526f2c61d07e9db5b66 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 1 Sep 2011 17:16:56 -0500 Subject: 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 --- lib/libalpm/handle.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'lib/libalpm/handle.h') 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 #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 '/' */ -- cgit v1.2.3-24-g4f1b