status_t ActivityView::SaveState(BMessage& state) const { status_t status = state.AddBool("show legend", fShowLegend); if (status != B_OK) return status; status = state.AddInt64("refresh interval", fRefreshInterval); if (status != B_OK) return status; status = state.AddData("history background color", B_RGB_COLOR_TYPE, &fHistoryBackgroundColor, sizeof(rgb_color)); if (status != B_OK) return status; for (int32 i = 0; i < fSources.CountItems(); i++) { DataSource* source = fSources.ItemAt(i); if (!source->PerCPU() || source->CPU() == 0) status = state.AddString("source", source->InternalName()); if (status != B_OK) return status; BString name = source->Name(); name << " color"; rgb_color color = source->Color(); state.AddData(name.String(), B_RGB_COLOR_TYPE, &color, sizeof(rgb_color)); } return B_OK; }