diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 36 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.h | 1 |
2 files changed, 32 insertions, 5 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 71c812efe2..f4abb45319 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -231,7 +231,7 @@ public: virtual void setActive(bool) {} protected: - void updateList() + void update() { mCallback(); } @@ -239,6 +239,30 @@ protected: callback_t mCallback; }; +/** + * Update buttons on changes in our friend relations (STORM-557). + */ +class LLButtonsUpdater : public LLPanelPeople::Updater, public LLFriendObserver +{ +public: + LLButtonsUpdater(callback_t cb) + : LLPanelPeople::Updater(cb) + { + LLAvatarTracker::instance().addObserver(this); + } + + ~LLButtonsUpdater() + { + LLAvatarTracker::instance().removeObserver(this); + } + + /*virtual*/ void changed(U32 mask) + { + (void) mask; + update(); + } +}; + class LLAvatarListUpdater : public LLPanelPeople::Updater, public LLEventTimer { public: @@ -306,7 +330,7 @@ public: if (mMask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE)) { - updateList(); + update(); } // Stop updates. @@ -421,7 +445,7 @@ public: if (val) { // update immediately and start regular updates - updateList(); + update(); mEventTimer.start(); } else @@ -433,7 +457,7 @@ public: /*virtual*/ BOOL tick() { - updateList(); + update(); return FALSE; } private: @@ -450,7 +474,7 @@ public: LLRecentListUpdater(callback_t cb) : LLAvatarListUpdater(cb, 0) { - LLRecentPeople::instance().setChangedCallback(boost::bind(&LLRecentListUpdater::updateList, this)); + LLRecentPeople::instance().setChangedCallback(boost::bind(&LLRecentListUpdater::update, this)); } }; @@ -475,11 +499,13 @@ LLPanelPeople::LLPanelPeople() mFriendListUpdater = new LLFriendListUpdater(boost::bind(&LLPanelPeople::updateFriendList, this)); mNearbyListUpdater = new LLNearbyListUpdater(boost::bind(&LLPanelPeople::updateNearbyList, this)); mRecentListUpdater = new LLRecentListUpdater(boost::bind(&LLPanelPeople::updateRecentList, this)); + mButtonsUpdater = new LLButtonsUpdater(boost::bind(&LLPanelPeople::updateButtons, this)); mCommitCallbackRegistrar.add("People.addFriend", boost::bind(&LLPanelPeople::onAddFriendButtonClicked, this)); } LLPanelPeople::~LLPanelPeople() { + delete mButtonsUpdater; delete mNearbyListUpdater; delete mFriendListUpdater; delete mRecentListUpdater; diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 4412aed062..b496bb3779 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -152,6 +152,7 @@ private: Updater* mFriendListUpdater; Updater* mNearbyListUpdater; Updater* mRecentListUpdater; + Updater* mButtonsUpdater; LLMenuButton* mNearbyGearButton; LLMenuButton* mFriendsGearButton; |