Do an explicit row's update when it's needed.

This should close #7988 this time, hopefully.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42756 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin 2011-09-16 19:31:02 +00:00
parent 909c526903
commit 7a931c68e8
2 changed files with 9 additions and 7 deletions

View File

@ -201,18 +201,19 @@ TeamRow::TeamRow(team_id team)
}
status_t
TeamRow::UpdateInfo(team_info& info)
bool
TeamRow::NeedsUpdate(team_info& info)
{
// Check if we need to rebuilt the row's fields because the team critical
// info (basically, app image running under that team ID) has changed
if (info.argc != fTeamInfo.argc
|| strncmp(info.args, fTeamInfo.args, sizeof(fTeamInfo.args)) != 0) {
return _SetTo(info);
_SetTo(info);
return true;
}
return B_OK;
return false;
}
@ -442,9 +443,10 @@ TeamsListView::_UpdateList()
row = dynamic_cast<TeamRow*>(RowAt(index));
}
if (row != NULL && tmi.team == row->TeamID()) {
if (row != NULL && tmi.team == row->TeamID()
&& row->NeedsUpdate(tmi)) {
// The team image app could have change due after an exec*() call,
row->UpdateInfo(tmi);
UpdateRow(row);
} else if (row == NULL || tmi.team != row->TeamID()) {
// Team not found in previously known teams list: insert a new row
TeamRow* newRow = new(std::nothrow) TeamRow(tmi);

View File

@ -69,7 +69,7 @@ public:
public:
team_id TeamID() const { return fTeamInfo.team; }
status_t UpdateInfo(team_info& info);
bool NeedsUpdate(team_info& info);
virtual void SetEnabled(bool enabled) { fEnabled = enabled; }
bool IsEnabled() const { return fEnabled; }