Compare commits
2 commits
9c983d82f4
...
5103ff4241
Author | SHA1 | Date | |
---|---|---|---|
5103ff4241 | |||
ef39809d13 |
1 changed files with 19 additions and 9 deletions
|
@ -270,7 +270,7 @@ namespace Buypeeb {
|
|||
}
|
||||
}
|
||||
|
||||
private void UpdateItem(string id, bool refilterWhenDone = false) {
|
||||
private void UpdateItem(string id, bool renderListWhenDone = false) {
|
||||
var item = this.settings.watchlist[id];
|
||||
if (item.updatedRecently) {
|
||||
// the item has been updated recently, and force is not true
|
||||
|
@ -284,9 +284,10 @@ namespace Buypeeb {
|
|||
this.UpdateThread(id);
|
||||
}).ContinueWith(task => {
|
||||
taskLimit.Release();
|
||||
if (refilterWhenDone) {
|
||||
var m = (TreeModelFilter)this.itemTreeView.Model;
|
||||
m.Refilter();
|
||||
if (renderListWhenDone) {
|
||||
Gtk.Application.Invoke(delegate {
|
||||
this.RenderList();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -441,6 +442,11 @@ namespace Buypeeb {
|
|||
}
|
||||
|
||||
private void RenderList() {
|
||||
string id = null;
|
||||
if (this.selectedItem != null) {
|
||||
id = this.selectedItem.id;
|
||||
}
|
||||
|
||||
this.items.Clear();
|
||||
var values = this.settings.watchlist.Values;
|
||||
IOrderedEnumerable<YahooAuctionsItem> sorted;
|
||||
|
@ -481,6 +487,14 @@ namespace Buypeeb {
|
|||
|
||||
var m = (TreeModelFilter)this.itemTreeView.Model;
|
||||
m.Refilter();
|
||||
|
||||
if (id != null) {
|
||||
// attempt to reselect the item we were just looking at
|
||||
var pathAndIter = this.GetRow(id);
|
||||
if (pathAndIter.path != null) {
|
||||
this.itemTreeView.Selection.SelectPath(pathAndIter.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// event handlers
|
||||
|
@ -498,7 +512,7 @@ namespace Buypeeb {
|
|||
// TODO: better. do better.
|
||||
Regex rx = new Regex(@"^http.+yahoo.+");
|
||||
if (rx.IsMatch(url)) {
|
||||
this.UpdateItem(this.settings.Watch(url, name).id);
|
||||
this.UpdateItem(this.settings.Watch(url, name).id, true);
|
||||
this.RenderList();
|
||||
}
|
||||
else {
|
||||
|
@ -730,11 +744,7 @@ namespace Buypeeb {
|
|||
|
||||
if (this.settings.displayFavouritesAtTopOfList) {
|
||||
var id = this.selectedItem.id;
|
||||
// re-render the list, to ensure the favourites get pushed to the top
|
||||
this.RenderList();
|
||||
// attempt to reselect the item we were just looking at
|
||||
var pathAndIter = this.GetRow(id);
|
||||
this.itemTreeView.Selection.SelectPath(pathAndIter.path);
|
||||
}
|
||||
else {
|
||||
// i don't know why this is necessary
|
||||
|
|
Loading…
Reference in a new issue