diff --git a/.gitignore b/.gitignore index bea7283..a9e7e1f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ bin/ obj/ out/ yahoo.html -.vs/ \ No newline at end of file +.vs/ +/buypeeb.sln diff --git a/MainWindow.cs b/MainWindow.cs index a45493e..14eef48 100755 --- a/MainWindow.cs +++ b/MainWindow.cs @@ -26,6 +26,7 @@ using System.Threading.Tasks; using System.Net; using System.Diagnostics; using Gtk; +using System.Linq; namespace Buypeeb { public struct ItemColumns { @@ -369,6 +370,25 @@ namespace Buypeeb { private void ButtonClearEndedClicked(object sender, EventArgs a) { Console.WriteLine("ButtonClearEndedClicked"); + var md = this.OkCancelDialogue("Are you sure you want to remove all ended auctions from the list?"); + var r = (ResponseType)md.Run(); + md.Dispose(); + if (r != ResponseType.Ok) { + return; + } + + var removeMe = new List(); + foreach(var item in this.settings.watchlist) { + if (!item.Value.available) { + removeMe.Add(item.Key); + } + } + + foreach(var id in removeMe) { + this.settings.watchlist.Remove(id); + } + + this.RenderList(); } private void ButtonClearAllClicked(object sender, EventArgs a) { diff --git a/ui/main.glade b/ui/main.glade index 8ff9364..5e0c417 100644 --- a/ui/main.glade +++ b/ui/main.glade @@ -115,7 +115,7 @@ True - False + True False Clear ended Clear ended