[Haiku-commits] r31307 - haiku/trunk/src/kits/tracker

anevilyak at BerliOS anevilyak at mail.berlios.de
Mon Jun 29 02:06:01 CEST 2009


Author: anevilyak
Date: 2009-06-29 02:06:00 +0200 (Mon, 29 Jun 2009)
New Revision: 31307
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31307&view=rev

Modified:
   haiku/trunk/src/kits/tracker/PoseView.cpp
Log:
Fix a number of problems in PoseView:

1) If a node was filtered out by the ref filter, PoseView effectively wiped out all evidence that it ever knew the node existed and stopped listening for changes on it. Consequently, it would never notice if an attribute change such as updating the file's type made the file now eligible to be viewed. Now we keep watching the node and keep it on the zombie list until such time as it passes the filter (if ever).
2) Refresh() cleared the pose list, but not the inserted nodes list. Consequently, any nodes that were already visible before calling Refresh() would not be readded.

This fixes various problems seen in the file panels in WonderBrush (and probably others), such as the file panel initially coming up empty sometimes, and also it not noticing new screenshots,

This closes ticket #1717.



Modified: haiku/trunk/src/kits/tracker/PoseView.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/PoseView.cpp	2009-06-28 23:41:48 UTC (rev 31306)
+++ haiku/trunk/src/kits/tracker/PoseView.cpp	2009-06-29 00:06:00 UTC (rev 31307)
@@ -1631,9 +1631,7 @@
 	for (int32 modelIndex = 0; modelIndex < count; modelIndex++) {
 		Model *model = models[modelIndex];
 
-
 		// pose adopts model and deletes it when done
-
 		if (fInsertedNodes.find(*(model->NodeRef())) != fInsertedNodes.end()
 			|| FindZombie(model->NodeRef())) {
 			watch_node(model->NodeRef(), B_STOP_WATCHING, this);
@@ -1641,9 +1639,8 @@
 			if (resultingPoses)
 				resultingPoses[modelIndex] = NULL;
 			continue;
-		} else {
+		} else 
 			fInsertedNodes.insert(*(model->NodeRef()));
-		}
 
 		if ((clipboardMode = FSClipboardFindNodeMode(model, false, true)) != 0
 			&& !HasPosesInClipboard()) {
@@ -5103,17 +5100,14 @@
 	// get saved pose info out of attribute
 	PoseInfo poseInfo;
 	ReadPoseInfo(model, &poseInfo);
-
 	if (!ShouldShowPose(model, &poseInfo)
 		// filter out undesired poses
 		|| (model->IsSymLink() && !CreateSymlinkPoseTarget(model))) {
 		// model is a symlink, cache up the symlink target or scrap
 		// everything if target is invisible
-		watch_node(model->NodeRef(), B_STOP_WATCHING, this);
-		delete model;
+		fZombieList->AddItem(model);
 		return NULL;
 	}
-
 	return CreatePose(model, &poseInfo, true, indexPtr);
 }
 
@@ -5266,8 +5260,9 @@
 
 	int32 index;
 	BPose *pose = fPoseList->DeepFindPose(&itemNode, &index);
+	attr_info info;
+	memset(&info, 0, sizeof(attr_info));
 	if (pose) {
-		attr_info info;
 		BPoint loc(0, index * fListElemHeight);
 
 		Model *model = pose->TargetModel();
@@ -5290,7 +5285,6 @@
 
 		if (result == B_OK) {
 			if (attrName && model->Node()) {
-				info.type = 0;
 					// the call below might fail if the attribute has been removed
 				model->Node()->GetAttrInfo(attrName, &info);
 				pose->UpdateWidgetAndModel(model, attrName, info.type, index, loc, this);
@@ -5319,8 +5313,21 @@
 		// pose might be in zombie state if we're copying...
 		Model *zombie = FindZombie(&itemNode, &index);
 		if (zombie) {
-			PRINT(("converting model %s from a zombie\n", zombie->Name()));
-			ConvertZombieToPose(zombie, index);
+			if (attrName) {
+				zombie->AttrChanged(attrName);
+				if (strcmp(attrName, kAttrMIMEType) == 0) {
+					zombie->Node()->GetAttrInfo(attrName, &info);
+					struct stat_beos statBeOS;
+					convert_to_stat_beos(zombie->StatBuf(), &statBeOS);
+					if (fRefFilter->Filter(zombie->EntryRef(), zombie->Node(), &statBeOS,
+						zombie->MimeType())) {
+					PRINT(("converting model %s from a zombie\n", zombie->Name()));
+						ConvertZombieToPose(zombie, index);
+					}
+				} 
+			} else {
+				zombie->StatChanged();
+			}
 		} else {
 			// did not find a pose, probably not entered yet
 			// PRINT(("failed to deliver attr change node monitor - pose not found\n"));
@@ -7732,6 +7739,7 @@
 		return;
 
 	StopWatching();
+	fInsertedNodes.clear();
 	ClearPoses();
 	StartWatching();
 




More information about the Haiku-commits mailing list