diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-22 11:09:45 +0100 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-22 11:09:45 +0100 |
commit | d1910d93eb1f1e07362e99f68a0f69a664867e0d (patch) | |
tree | f24229d8ef073a1a427f2273f644cefa84380cbd /indra/newview/llinventoryobserver.cpp | |
parent | bf8bcfe4f76f1805a908af0368e334261b764591 (diff) | |
parent | ce8451a2578e09c00ef53b768a5dbb3e87999d0c (diff) |
merge from viewer-trunk
Diffstat (limited to 'indra/newview/llinventoryobserver.cpp')
-rw-r--r-- | indra/newview/llinventoryobserver.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 29d99d328a..03006243f9 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -650,3 +650,35 @@ void LLInventoryTransactionObserver::changed(U32 mask) } } } + +void LLInventoryCategoriesObserver::changed(U32 mask) +{ + if (!mCategoryMap.size()) + return; + + for (category_map_t::iterator iter = mCategoryMap.begin(); + iter != mCategoryMap.end(); + iter++) + { + // Inventory category version is used to find out if some changes + // to a category have been made. + S32 version = gInventory.getCategory((*iter).first)->getVersion(); + if (version != (*iter).second.mVersion) + { + // Update category version in map. + (*iter).second.mVersion = version; + (*iter).second.mCallback(); + } + } +} + +void LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t cb) +{ + S32 version = gInventory.getCategory(cat_id)->getVersion(); + mCategoryMap.insert(category_map_value_t(cat_id, LLCategoryData(cb, version))); +} + +void LLInventoryCategoriesObserver::removeCategory(const LLUUID& cat_id) +{ + mCategoryMap.erase(mCategoryMap.find(cat_id)); +} |