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.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'lib/libalpm/handle.c') diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index b9d71db8..bc968c72 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -166,6 +166,24 @@ alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb(alpm_handle_t *handle) return handle->totaldlcb; } +alpm_cb_event SYMEXPORT alpm_option_get_eventcb(alpm_handle_t *handle) +{ + CHECK_HANDLE(handle, return NULL); + return handle->eventcb; +} + +alpm_cb_conv SYMEXPORT alpm_option_get_convcb(alpm_handle_t *handle) +{ + CHECK_HANDLE(handle, return NULL); + return handle->convcb; +} + +alpm_cb_progress SYMEXPORT alpm_option_get_progresscb(alpm_handle_t *handle) +{ + CHECK_HANDLE(handle, return NULL); + return handle->progresscb; +} + const char SYMEXPORT *alpm_option_get_root(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); @@ -290,6 +308,27 @@ int SYMEXPORT alpm_option_set_totaldlcb(alpm_handle_t *handle, alpm_cb_totaldl c return 0; } +int SYMEXPORT alpm_option_set_eventcb(alpm_handle_t *handle, alpm_cb_event cb) +{ + CHECK_HANDLE(handle, return -1); + handle->eventcb = cb; + return 0; +} + +int SYMEXPORT alpm_option_set_convcb(alpm_handle_t *handle, alpm_cb_conv cb) +{ + CHECK_HANDLE(handle, return -1); + handle->convcb = cb; + return 0; +} + +int SYMEXPORT alpm_option_set_progresscb(alpm_handle_t *handle, alpm_cb_progress cb) +{ + CHECK_HANDLE(handle, return -1); + handle->progresscb = cb; + return 0; +} + static char *canonicalize_path(const char *path) { char *new_path; size_t len; -- cgit v1.2.3-2-g168b