summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-06-02 06:10:30 +0200
committerDan McGee <dan@archlinux.org>2008-06-04 22:38:53 +0200
commitfe781e4ce4ace4410bbc8bec441140cfc323d262 (patch)
treecdb570aeb1e475bf3c5543d6548fd4ea26e871db /lib/libalpm/handle.c
parent0669c9bfac7aead01f1400444e691d542f7645c2 (diff)
downloadpacman-fe781e4ce4ace4410bbc8bec441140cfc323d262.tar.gz
pacman-fe781e4ce4ace4410bbc8bec441140cfc323d262.tar.xz
Reimplement TotalDownload functionality
Add a new totaldlcb callback function to libalpm and make pacman utilize it when the TotalDownload option is enabled. This callback function is pretty simple- it is meant to be called once at the beginning of a "list download" action, and once at the end (with value 0 to indicate the list has been finished). The frontend is responsible for keeping track of adding individual file download amounts to the total xfered amount in order to display some sort of overall progress. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index c01dd551..af1cc78b 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -115,6 +115,15 @@ alpm_cb_download SYMEXPORT alpm_option_get_dlcb()
return handle->dlcb;
}
+alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb()
+{
+ if (handle == NULL) {
+ pm_errno = PM_ERR_HANDLE_NULL;
+ return NULL;
+ }
+ return handle->totaldlcb;
+}
+
const char SYMEXPORT *alpm_option_get_root()
{
if (handle == NULL) {
@@ -268,6 +277,15 @@ void SYMEXPORT alpm_option_set_dlcb(alpm_cb_download cb)
handle->dlcb = cb;
}
+void SYMEXPORT alpm_option_set_totaldlcb(alpm_cb_totaldl cb)
+{
+ if (handle == NULL) {
+ pm_errno = PM_ERR_HANDLE_NULL;
+ return;
+ }
+ handle->totaldlcb = cb;
+}
+
int SYMEXPORT alpm_option_set_root(const char *root)
{
struct stat st;