Refactor ExpandoMenuBar::BuildItems a bit
This commit is contained in:
@@ -533,6 +533,9 @@ TExpandoMenuBar::MouseUp(BPoint where)
|
|||||||
void
|
void
|
||||||
TExpandoMenuBar::BuildItems()
|
TExpandoMenuBar::BuildItems()
|
||||||
{
|
{
|
||||||
|
RemoveItems(0, CountItems(), true);
|
||||||
|
// remove all items
|
||||||
|
|
||||||
BMessenger self(this);
|
BMessenger self(this);
|
||||||
TBarApp::Subscribe(self, &fTeamList);
|
TBarApp::Subscribe(self, &fTeamList);
|
||||||
|
|
||||||
@@ -554,28 +557,25 @@ TExpandoMenuBar::BuildItems()
|
|||||||
}
|
}
|
||||||
float itemHeight = -1.0f;
|
float itemHeight = -1.0f;
|
||||||
|
|
||||||
RemoveItems(0, CountItems(), true);
|
|
||||||
// remove all items
|
|
||||||
|
|
||||||
if (settings->sortRunningApps)
|
if (settings->sortRunningApps)
|
||||||
fTeamList.SortItems(CompareByName);
|
fTeamList.SortItems(CompareByName);
|
||||||
|
|
||||||
int32 count = fTeamList.CountItems();
|
int32 count = fTeamList.CountItems();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
// add them again
|
// add items back
|
||||||
BarTeamInfo* barInfo = (BarTeamInfo*)fTeamList.ItemAt(i);
|
BarTeamInfo* barInfo = (BarTeamInfo*)fTeamList.ItemAt(i);
|
||||||
|
|
||||||
if ((barInfo->flags & B_BACKGROUND_APP) == 0
|
if ((barInfo->flags & B_BACKGROUND_APP) == 0
|
||||||
&& strcasecmp(barInfo->sig, kDeskbarSignature) != 0) {
|
&& strcasecmp(barInfo->sig, kDeskbarSignature) != 0) {
|
||||||
|
TTeamMenuItem* item = new TTeamMenuItem(barInfo->teams,
|
||||||
|
barInfo->icon, barInfo->name, barInfo->sig, itemWidth,
|
||||||
|
itemHeight, fDrawLabel, fVertical);
|
||||||
|
|
||||||
if (settings->trackerAlwaysFirst
|
if (settings->trackerAlwaysFirst
|
||||||
&& !strcmp(barInfo->sig, kTrackerSignature)) {
|
&& strcmp(barInfo->sig, kTrackerSignature) == 0) {
|
||||||
AddItem(new TTeamMenuItem(barInfo->teams, barInfo->icon,
|
AddItem(item, 0);
|
||||||
barInfo->name, barInfo->sig, itemWidth, itemHeight,
|
} else
|
||||||
fDrawLabel, fVertical), 0);
|
AddItem(item);
|
||||||
} else {
|
|
||||||
AddItem(new TTeamMenuItem(barInfo->teams, barInfo->icon,
|
|
||||||
barInfo->name, barInfo->sig, itemWidth, itemHeight,
|
|
||||||
fDrawLabel, fVertical));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user