Tracker: Use NodeRef in update thumb message

... now that Add/FindNodeRef have been added.

Tested by generating thumbnails on read-only BFS file system.

Change-Id: I94d85f4edfb6f26fc88dcb7b85d9d36629062f6b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5485
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
John Scipione 2022-07-18 18:28:41 -04:00 committed by waddlesplash
parent 75e66d6135
commit 7e677cae2c
2 changed files with 4 additions and 11 deletions

View File

@ -237,10 +237,8 @@ GenerateThumbnailJob::Execute()
if (!thumbnailWritten) {
// send Tracker a message to tell it to update the thumbnail
BMessage message(kUpdateThumbnail);
if (message.AddInt32("device", fNodeRef.device) == B_OK
&& message.AddUInt64("node", fNodeRef.node) == B_OK) {
if (message.AddNodeRef("noderef", &fNodeRef) == B_OK)
be_app->PostMessage(&message);
}
}
return B_OK;

View File

@ -621,13 +621,8 @@ TTracker::MessageReceived(BMessage* message)
{
// message passed from generator thread
// update icon on passed-in node_ref
dev_t device;
ino_t inode;
// call this inode so we can call the node_ref node
if (message->FindInt32("device", (int32*)&device) == B_OK
&& message->FindUInt64("node", (uint64*)&inode) == B_OK) {
const node_ref node = node_ref(device, inode);
node_ref noderef;
if (message->FindNodeRef("noderef", &noderef) == B_OK) {
// cycle through open windows to find the node's pose
// TODO find a faster way
AutoLock<WindowList> lock(&fWindowList);
@ -646,7 +641,7 @@ TTracker::MessageReceived(BMessage* message)
if (poseView == NULL)
continue;
BPose* pose = poseView->FindPose(&node);
BPose* pose = poseView->FindPose(&noderef);
if (pose != NULL) {
poseView->UpdateIcon(pose);
break; // updated pose icon, exit loop