diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-02-23 20:45:52 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-02-23 20:45:52 +0000 |
| commit | 157fcc2665301c168dabc02eec9105db3d860b53 (patch) | |
| tree | 633b56e9ec59b4ff273d8148e7fad1210a64ad03 /python/progress.h | |
| parent | 8bd15f69297702d22bd4dc958f2a0eb221b8e6f9 (diff) | |
| download | python-apt-157fcc2665301c168dabc02eec9105db3d860b53.tar.gz | |
* apt_pkg.GetCache() supports a progress callback now too
Diffstat (limited to 'python/progress.h')
| -rw-r--r-- | python/progress.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/python/progress.h b/python/progress.h new file mode 100644 index 00000000..d653b42d --- /dev/null +++ b/python/progress.h @@ -0,0 +1,29 @@ +#ifndef PROGRESS_H +#define PROGRESS_H + +struct PyOpProgressStruct : public OpProgress +{ + + PyObject *py_update_callback_func; + PyObject *py_update_callback_args; + + virtual void Update() { + if(py_update_callback_func == 0) + return; + + // Build up the argument list... + PyObject *arglist = Py_BuildValue("(fO)", Percent, py_update_callback_args); + + // ...for calling the Python compare function. + PyObject *result = PyEval_CallObject(py_update_callback_func,arglist); + + Py_XDECREF(result); + Py_DECREF(arglist); + + return; + }; + + PyOpProgressStruct() : OpProgress(), py_update_callback_func(0) {}; +}; + +#endif |
