From cfaff6e0c14d29f07246386695bce0188ce6f44b Mon Sep 17 00:00:00 2001 From: Olivier Brunel Date: Wed, 12 Feb 2014 16:32:30 +0100 Subject: Add events on pacnew/pacsave/pacorig file creation ALPM still adds a warning to the log, but doesn't emit an event about said warning, instead using a specific event to let the frontend what happened/how to inform the user. Note that there are 2 cases for installing a .pacnew file, to not overwrite user changes and because file is in NoUpgrade. In the later case the warning was a bit different: it happened before and said "extracting" instead of "installed." Now both happen after and are phrased the same. Signed-off-by: Olivier Brunel Signed-off-by: Allan McRae --- lib/libalpm/alpm.h | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'lib/libalpm/alpm.h') diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 5fc9c0d2..b0adb95d 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -350,7 +350,15 @@ typedef enum _alpm_event_type_t { /** Key downloading is finished. */ ALPM_EVENT_KEY_DOWNLOAD_DONE, /** A log message was emitted; See alpm_event_log_t for arguments. */ - ALPM_EVENT_LOG + ALPM_EVENT_LOG, + /** A .pacnew file was created; See alpm_event_pacnew_created_t for arguments. */ + ALPM_EVENT_PACNEW_CREATED, + /** A .pacsave file was created; See alpm_event_pacsave_created_t for + * arguments */ + ALPM_EVENT_PACSAVE_CREATED, + /** A .pacorig file was created; See alpm_event_pacorig_created_t for + * arguments */ + ALPM_EVENT_PACORIG_CREATED } alpm_event_type_t; /** Events. @@ -442,6 +450,37 @@ typedef struct _alpm_event_pkgdownload_t { const char *file; } alpm_event_pkgdownload_t; +typedef struct _alpm_event_pacnew_created_t { + /** Type of event. */ + alpm_event_type_t type; + /** Whether the creation was result of a NoUpgrade or not */ + int from_noupgrade; + /** Old package. */ + alpm_pkg_t *oldpkg; + /** New Package. */ + alpm_pkg_t *newpkg; + /** Filename of the file without the .pacnew suffix */ + const char *file; +} alpm_event_pacnew_created_t; + +typedef struct _alpm_event_pacsave_created_t { + /** Type of event. */ + alpm_event_type_t type; + /** Old package. */ + alpm_pkg_t *oldpkg; + /** Filename of the file without the .pacsave suffix. */ + const char *file; +} alpm_event_pacsave_created_t; + +typedef struct _alpm_event_pacorig_created_t { + /** Type of event. */ + alpm_event_type_t type; + /** New package. */ + alpm_pkg_t *newpkg; + /** Filename of the file without the .pacorig suffix. */ + const char *file; +} alpm_event_pacorig_created_t; + /** Event callback. */ typedef void (*alpm_cb_event)(alpm_event_t *); -- cgit v1.2.3-24-g4f1b