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 --- src/pacman/callback.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src/pacman/callback.c') diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 2540b73c..340a3a1c 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -288,6 +288,54 @@ void cb_event(alpm_event_t *event) } } break; + case ALPM_EVENT_PACNEW_CREATED: + { + alpm_event_pacnew_created_t *e = (alpm_event_pacnew_created_t *) event; + if(on_progress) { + char *string = NULL; + pm_sprintf(&string, ALPM_LOG_WARNING, _("%s installed as %s.pacnew\n"), + e->file, e->file); + if(string != NULL) { + output = alpm_list_add(output, string); + } + } else { + pm_printf(ALPM_LOG_WARNING, _("%s installed as %s.pacnew\n"), + e->file, e->file); + } + } + break; + case ALPM_EVENT_PACSAVE_CREATED: + { + alpm_event_pacsave_created_t *e = (alpm_event_pacsave_created_t *) event; + if(on_progress) { + char *string = NULL; + pm_sprintf(&string, ALPM_LOG_WARNING, _("%s saved as %s.pacsave\n"), + e->file, e->file); + if(string != NULL) { + output = alpm_list_add(output, string); + } + } else { + pm_printf(ALPM_LOG_WARNING, _("%s saved as %s.pacsave\n"), + e->file, e->file); + } + } + break; + case ALPM_EVENT_PACORIG_CREATED: + { + alpm_event_pacorig_created_t *e = (alpm_event_pacorig_created_t *) event; + if(on_progress) { + char *string = NULL; + pm_sprintf(&string, ALPM_LOG_WARNING, _("%s saved as %s.pacorig\n"), + e->file, e->file); + if(string != NULL) { + output = alpm_list_add(output, string); + } + } else { + pm_printf(ALPM_LOG_WARNING, _("%s saved as %s.pacorig\n"), + e->file, e->file); + } + } + break; /* all the simple done events, with fallthrough for each */ case ALPM_EVENT_FILECONFLICTS_DONE: case ALPM_EVENT_CHECKDEPS_DONE: -- cgit v1.2.3-24-g4f1b