diff options
| author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-02-26 09:50:56 +0000 |
|---|---|---|
| committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-02-26 09:50:56 +0000 |
| commit | 044e020bcb7e1dd94f689ba6977bcb07a87d8a35 (patch) | |
| tree | cf549fa816d92f90fc5de775cba08d91d30874be /indra/newview/lllocationinputctrl.cpp | |
| parent | 9f079954af9ca80498bf6953d65cc7e77e956f26 (diff) | |
| parent | 92facf86d6bf1a7acecdc6e536ac2ad7bcdfdd96 (diff) | |
PE merge.
Diffstat (limited to 'indra/newview/lllocationinputctrl.cpp')
| -rw-r--r-- | indra/newview/lllocationinputctrl.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 5f233bece0..0ea4b1f6da 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -52,7 +52,6 @@ #include "llinventoryobserver.h" #include "lllandmarkactions.h" #include "lllandmarklist.h" -#include "lllocationhistory.h" #include "llteleporthistory.h" #include "llsidetray.h" #include "llslurl.h" @@ -377,9 +376,10 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) // - Update the location string on parcel change. mParcelMgrConnection = LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback( boost::bind(&LLLocationInputCtrl::onAgentParcelChange, this)); - - mLocationHistoryConnection = LLLocationHistory::getInstance()->setLoadedCallback( - boost::bind(&LLLocationInputCtrl::onLocationHistoryLoaded, this)); + // LLLocationHistory instance is being created before the location input control, so we have to update initial state of button manually. + mButton->setEnabled(LLLocationHistory::instance().getItemCount() > 0); + mLocationHistoryConnection = LLLocationHistory::getInstance()->setChangedCallback( + boost::bind(&LLLocationInputCtrl::onLocationHistoryChanged, this,_1)); mRemoveLandmarkObserver = new LLRemoveLandmarkObserver(this); mAddLandmarkObserver = new LLAddLandmarkObserver(this); @@ -620,9 +620,13 @@ void LLLocationInputCtrl::onLandmarkLoaded(LLLandmark* lm) updateAddLandmarkButton(); } -void LLLocationInputCtrl::onLocationHistoryLoaded() +void LLLocationInputCtrl::onLocationHistoryChanged(LLLocationHistory::EChangeType event) { - rebuildLocationHistory(); + if(event == LLLocationHistory::LOAD) + { + rebuildLocationHistory(); + } + mButton->setEnabled(LLLocationHistory::instance().getItemCount() > 0); } void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data) @@ -893,7 +897,7 @@ void LLLocationInputCtrl::positionMaturityIcon() mMaturityIcon->setVisible(rect.mRight < mTextEntry->getRect().getWidth() - right_pad); } -void LLLocationInputCtrl::rebuildLocationHistory(std::string filter) +void LLLocationInputCtrl::rebuildLocationHistory(const std::string& filter) { LLLocationHistory::location_list_t filtered_items; const LLLocationHistory::location_list_t* itemsp = NULL; |
