From: Ivy Foster <ivy.fos...@gmail.com>

Signed-off-by: Ivy Foster <ivy.fos...@gmail.com>
---
 src/pacman/callback.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index ab3e14f..9c29e6d 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -173,6 +173,8 @@ static int number_length(size_t n)
 /* callback to handle messages/notifications from libalpm transactions */
 void cb_event(alpm_event_t *event)
 {
+       const unsigned short cols = getcols();
+
        if(config->print) {
                return;
        }
@@ -344,6 +346,22 @@ void cb_event(alpm_event_t *event)
                                }
                        }
                        break;
+               case ALPM_EVENT_PKGDOWNLOAD_START:
+                       {
+                               if(config->noprogressbar || cols == 0) {
+                                       alpm_event_pkgdownload_t *e = 
&event->pkgdownload;
+                                       printf(_("downloading %s...\n"), 
e->file);
+                               }
+                       }
+                       break;
+               case ALPM_EVENT_DATABASE_REFRESH_START:
+                       {
+                               if(config->noprogressbar || cols == 0) {
+                                       alpm_event_database_refresh_t *e = 
&event->database_refresh;
+                                       printf(_("downloading %s...\n"), 
e->dbname);
+                               }
+                       }
+                       break;
                /* all the simple done events, with fallthrough for each */
                case ALPM_EVENT_FILECONFLICTS_DONE:
                case ALPM_EVENT_CHECKDEPS_DONE:
@@ -362,9 +380,10 @@ void cb_event(alpm_event_t *event)
                case ALPM_EVENT_HOOK_DONE:
                case ALPM_EVENT_HOOK_RUN_DONE:
                /* we can safely ignore those as well */
-               case ALPM_EVENT_PKGDOWNLOAD_START:
                case ALPM_EVENT_PKGDOWNLOAD_DONE:
                case ALPM_EVENT_PKGDOWNLOAD_FAILED:
+               case ALPM_EVENT_DATABASE_REFRESH_DONE:
+               case ALPM_EVENT_DATABASE_REFRESH_FAILED:
                        /* nothing */
                        break;
        }
@@ -679,10 +698,6 @@ void cb_dl_progress(const char *filename, off_t 
file_xfered, off_t file_total)
        const unsigned short cols = getcols();
 
        if(config->noprogressbar || cols == 0 || file_total == -1) {
-               if(file_xfered == 0) {
-                       printf(_("downloading %s...\n"), filename);
-                       fflush(stdout);
-               }
                return;
        }
 
-- 
2.9.0

Reply via email to