Skip to content

Commit

Permalink
Don't update last modification time for entries not being modified.
Browse files Browse the repository at this point in the history
(issue #35)
  • Loading branch information
navossoc committed Jan 20, 2020
1 parent 75eddbe commit 9990721
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions YAFD/FaviconDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,17 @@ private void BgWorker_DoWork(object sender, DoWorkEventArgs e)
icons[i] = new PwCustomIcon(uuid, data);
}

// Associate with this entry
entry.CustomIconUuid = uuid;
// Check if icon is the same
if (entry.CustomIconUuid.Equals(uuid))
{
// Avoid updating the entry
entries[i] = null;
}
else
{
// Associate with this entry
entry.CustomIconUuid = uuid;
}

// Icon downloaded with success
Interlocked.Increment(ref progress.Success);
Expand All @@ -154,6 +163,9 @@ private void BgWorker_DoWork(object sender, DoWorkEventArgs e)
// Some other error (network, etc)
Interlocked.Increment(ref progress.Error);
}

// Avoid updating the entry
entries[i] = null;
}
}
}
Expand Down Expand Up @@ -252,6 +264,9 @@ private void BgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventA
// Update entries (avoid cross-thread operation with other plugins)
foreach (PwEntry entry in entries)
{
// You can't touch this (oh-oh oh oh oh-oh-oh)
if (entry == null) continue;

// Save it
entry.Touch(true, false);
}
Expand Down

0 comments on commit 9990721

Please sign in to comment.