Tracker & Deskbar: Use BStringList instead of BObjectList<BString>.

It's more efficient, and conveys ownership semantics more clearly.

Change-Id: Ia42b018faaa7c8c7347020afbf1be9dfafe0fed8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8913
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2025-02-06 00:06:32 +00:00
committed by waddlesplash
parent 49d3b2a142
commit 3e245f7b20
8 changed files with 82 additions and 103 deletions
+4 -3
View File
@@ -46,6 +46,7 @@ All rights reserved.
#include <Roster.h>
#include <Screen.h>
#include <String.h>
#include <StringList.h>
#include "icons.h"
#include "BarApp.h"
@@ -1019,7 +1020,7 @@ TBarView::AppCanHandleTypes(const char* signature)
}
if (!signature || strlen(signature) == 0
|| !fCachedTypesList || fCachedTypesList->CountItems() == 0)
|| !fCachedTypesList || fCachedTypesList->CountStrings() == 0)
return false;
if (strcasecmp(signature, kTrackerSignature) == 0) {
@@ -1042,9 +1043,9 @@ TBarView::AppCanHandleTypes(const char* signature)
// supports anything in the list
// only one item needs to match in the list of refs
int32 count = fCachedTypesList->CountItems();
int32 count = fCachedTypesList->CountStrings();
for (int32 i = 0 ; i < count ; i++) {
if (fileinfo.IsSupportedType(fCachedTypesList->ItemAt(i)->String()))
if (fileinfo.IsSupportedType(fCachedTypesList->StringAt(i).String()))
return true;
}
+3 -3
View File
@@ -126,7 +126,7 @@ public:
TrackingHookData* GetTrackingHookData();
bool Dragging() const;
const BMessage* DragMessage() const;
BObjectList<BString>* CachedTypesList() const;
BStringList* CachedTypesList() const;
bool AppCanHandleTypes(const char* signature);
void SetDragOverride(bool);
bool DragOverride();
@@ -209,7 +209,7 @@ private:
bigtime_t fPulseRate;
bool fRefsRcvdOnly;
BMessage* fDragMessage;
BObjectList<BString>* fCachedTypesList;
BStringList* fCachedTypesList;
TrackingHookData fTrackingHookData;
uint32 fMaxRecentDocs;
@@ -250,7 +250,7 @@ TBarView::DragMessage() const
}
inline BObjectList<BString>*
inline BStringList*
TBarView::CachedTypesList() const
{
return fCachedTypesList;