diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 71c812efe25229a9c6fa2184d67c2ae2c9278c44..f4abb45319e3411378b85e332978082af26d0d8b 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -231,7 +231,7 @@ class LLPanelPeople::Updater virtual void setActive(bool) {} protected: - void updateList() + void update() { mCallback(); } @@ -239,6 +239,30 @@ class LLPanelPeople::Updater 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 @@ class LLFriendListUpdater : public LLAvatarListUpdater, public LLFriendObserver if (mMask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE)) { - updateList(); + update(); } // Stop updates. @@ -421,7 +445,7 @@ class LLNearbyListUpdater : public LLAvatarListUpdater if (val) { // update immediately and start regular updates - updateList(); + update(); mEventTimer.start(); } else @@ -433,7 +457,7 @@ class LLNearbyListUpdater : public LLAvatarListUpdater /*virtual*/ BOOL tick() { - updateList(); + update(); return FALSE; } private: @@ -450,7 +474,7 @@ class LLRecentListUpdater : public LLAvatarListUpdater, public boost::signals2:: 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 4412aed0628b2aab30c266a22b088d0b4d73eb5e..b496bb3779ec132c8da2235cf80d5dbbd9950fad 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -152,6 +152,7 @@ class LLPanelPeople Updater* mFriendListUpdater; Updater* mNearbyListUpdater; Updater* mRecentListUpdater; + Updater* mButtonsUpdater; LLMenuButton* mNearbyGearButton; LLMenuButton* mFriendsGearButton;