From cd39367ef41bed86c07b4e57f327baa3f5720fb6 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 20 Mar 2017 20:53:39 +0000 Subject: [PATCH] Try to avoid extraneous progress notifications --- frontends/amiga/download.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c index 3f3d96a33..49e756b7c 100644 --- a/frontends/amiga/download.c +++ b/frontends/amiga/download.c @@ -83,6 +83,7 @@ struct gui_download_window { BPTR fh; uint32 size; uint32 downloaded; + uint32 progress; struct dlnode *dln; struct browser_window *bw; struct download_context *ctx; @@ -166,7 +167,7 @@ static struct gui_download_window *gui_download_window_create(download_context * } if((nsoption_bool(download_notify_progress) == true)) { - Notify(ami_gui_get_app_id(), APPNOTIFY_Title, messages_get("NetSurf"), + Notify(ami_gui_get_app_id(), APPNOTIFY_Title, messages_get("amiDownloading"), APPNOTIFY_PubScreenName, "FRONT", APPNOTIFY_Text, dw->fname, APPNOTIFY_DisplayTime, TRUE, @@ -238,9 +239,11 @@ static nserror gui_download_window_data(struct gui_download_window *dw, va[2] = 0; if(dw->size) { - if((nsoption_bool(download_notify_progress) == true)) { + if((nsoption_bool(download_notify_progress) == true) && + (((dw->downloaded * 100) / dw->size) > dw->progress)) { + dw->progress = (uint32)((dw->downloaded * 100) / dw->size); Notify(ami_gui_get_app_id(), - APPNOTIFY_Percentage, (dw->downloaded * 100) / dw->size, + APPNOTIFY_Percentage, dw->progress, TAG_DONE); } else { RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_STATUS], dw->win, NULL, @@ -255,7 +258,7 @@ static nserror gui_download_window_data(struct gui_download_window *dw, if((nsoption_bool(download_notify_progress) == true)) { /* unknown size, not entirely sure how to deal with this atm... */ Notify(ami_gui_get_app_id(), - APPNOTIFY_Percentage, 0, + APPNOTIFY_Percentage, 100, TAG_DONE); } else { RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_STATUS], dw->win, NULL,