summaryrefslogtreecommitdiff
path: root/indra/newview/lloutfitslist.cpp
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-06-03 15:59:44 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-06-03 15:59:44 +0100
commit3d439157dda9600c95e0321e829b3eda9004755b (patch)
tree8f3e590d98b811707c8721825a1765eaf0a662ab /indra/newview/lloutfitslist.cpp
parentd1dd61f61a9e3b281b9519a6f2bc3089b05dbf30 (diff)
parent797c1dbc6ef1c51755dcace98caf0c493cd8f511 (diff)
merge from viewer-public
Diffstat (limited to 'indra/newview/lloutfitslist.cpp')
-rw-r--r--indra/newview/lloutfitslist.cpp55
1 files changed, 26 insertions, 29 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 94bf2f4c7a..77db280487 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -137,11 +137,9 @@ LLOutfitsList::LLOutfitsList()
: LLPanel()
, mAccordion(NULL)
, mListCommands(NULL)
+ , mIsInitialized(false)
{
mCategoriesObserver = new LLInventoryCategoriesObserver();
- gInventory.addObserver(mCategoriesObserver);
-
- gInventory.addObserver(this);
mOutfitMenu = new OutfitContextMenu();
}
@@ -155,11 +153,6 @@ LLOutfitsList::~LLOutfitsList()
gInventory.removeObserver(mCategoriesObserver);
delete mCategoriesObserver;
}
-
- if (gInventory.containsObserver(this))
- {
- gInventory.removeObserver(this);
- }
}
BOOL LLOutfitsList::postBuild()
@@ -170,32 +163,36 @@ BOOL LLOutfitsList::postBuild()
}
//virtual
-void LLOutfitsList::changed(U32 mask)
+void LLOutfitsList::onOpen(const LLSD& /*info*/)
{
- if (!gInventory.isInventoryUsable())
- return;
+ if (!mIsInitialized)
+ {
+ // *TODO: I'm not sure is this check necessary but it never match while developing.
+ if (!gInventory.isInventoryUsable())
+ return;
- const LLUUID outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
- LLViewerInventoryCategory* category = gInventory.getCategory(outfits);
- if (!category)
- return;
+ const LLUUID outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+
+ // *TODO: I'm not sure is this check necessary but it never match while developing.
+ LLViewerInventoryCategory* category = gInventory.getCategory(outfits);
+ if (!category)
+ return;
+
+ gInventory.addObserver(mCategoriesObserver);
- // Start observing changes in "My Outfits" category.
- mCategoriesObserver->addCategory(outfits,
+ // Start observing changes in "My Outfits" category.
+ mCategoriesObserver->addCategory(outfits,
boost::bind(&LLOutfitsList::refreshList, this, outfits));
- // Fetch "My Outfits" contents and refresh the list to display
- // initially fetched items. If not all items are fetched now
- // the observer will refresh the list as soon as the new items
- // arrive.
- category->fetch();
- refreshList(outfits);
-
- // This observer is used to start the initial outfits fetch
- // when inventory becomes usable. It is no longer needed because
- // "My Outfits" category is now observed by
- // LLInventoryCategoriesObserver.
- gInventory.removeObserver(this);
+ // Fetch "My Outfits" contents and refresh the list to display
+ // initially fetched items. If not all items are fetched now
+ // the observer will refresh the list as soon as the new items
+ // arrive.
+ category->fetch();
+ refreshList(outfits);
+
+ mIsInitialized = true;
+ }
}
void LLOutfitsList::refreshList(const LLUUID& category_id)