diff options
author | Cho <cho@lindenlab.com> | 2013-07-04 02:43:09 +0100 |
---|---|---|
committer | Cho <cho@lindenlab.com> | 2013-07-04 02:43:09 +0100 |
commit | f7a1f7b784fff0579e4d1fecd8265d0f960bd7f4 (patch) | |
tree | e30d627358e228441f299b722f4ad34756cd9fa1 /indra/newview | |
parent | 85824ebc0931d4ac89e375b35dbccd1295746e31 (diff) |
Replaced content change callback with an event in LLFacebookConnect for ACME-648 (more or less)
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfacebookconnect.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llfacebookconnect.h | 7 | ||||
-rwxr-xr-x | indra/newview/llpanelpeople.cpp | 10 | ||||
-rwxr-xr-x | indra/newview/llpanelpeople.h | 2 |
4 files changed, 11 insertions, 23 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 816947827c..30ebedca25 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -41,6 +41,7 @@ #include "llevents.h" boost::scoped_ptr<LLEventPump> LLFacebookConnect::sStateWatcher(new LLEventStream("FacebookConnectState")); +boost::scoped_ptr<LLEventPump> LLFacebookConnect::sContentWatcher(new LLEventStream("FacebookConnectContent")); // Local functions void log_facebook_connect_error(const std::string& request, U32 status, const std::string& reason, const std::string& code, const std::string& description) @@ -413,10 +414,7 @@ void LLFacebookConnect::storeContent(const LLSD& content) mGeneration++; mContent = content; - if(mContentUpdatedCallback) - { - mContentUpdatedCallback(); - } + sContentWatcher->post(content); } const LLSD& LLFacebookConnect::getContent() const @@ -441,12 +439,3 @@ void LLFacebookConnect::setConnectionState(LLFacebookConnect::EConnectionState c mConnectionState = connection_state; } - - - - - - - - - diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h index a06e53b90e..7b6eb3644f 100644 --- a/indra/newview/llfacebookconnect.h +++ b/indra/newview/llfacebookconnect.h @@ -54,8 +54,6 @@ public: FB_POST_FAILED = 6 }; - typedef boost::function<void()> content_updated_callback_t; - void connectToFacebook(const std::string& auth_code = ""); // Initiate the complete FB connection. Please use checkConnectionToFacebook() in normal use. void disconnectFromFacebook(); // Disconnect from the FBC service. void checkConnectionToFacebook(bool auto_connect = false); // Check if an access token is available on the FBC service. If not, call connectToFacebook(). @@ -66,8 +64,6 @@ public: void sharePhoto(LLPointer<LLImageFormatted> image, const std::string& caption); void updateStatus(const std::string& message); - void setContentUpdatedCallback(content_updated_callback_t cb) { mContentUpdatedCallback = cb;} - void clearContent(); void storeContent(const LLSD& content); const LLSD& getContent() const; @@ -90,9 +86,8 @@ private: LLSD mContent; S32 mGeneration; - content_updated_callback_t mContentUpdatedCallback; - static boost::scoped_ptr<LLEventPump> sStateWatcher; + static boost::scoped_ptr<LLEventPump> sContentWatcher; }; #endif // LL_LLFACEBOOKCONNECT_H diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 8c8cad0743..766335c982 100755 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -781,7 +781,7 @@ void LLPanelPeople::updateFriendList() showFriendsAccordionsIfNeeded(); } -void LLPanelPeople::updateSuggestedFriendList() +bool LLPanelPeople::updateSuggestedFriendList() { if (LLFacebookConnect::instance().generation() != mFacebookListGeneration) { @@ -814,6 +814,8 @@ void LLPanelPeople::updateSuggestedFriendList() mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches()); showFriendsAccordionsIfNeeded(); } + + return false; } void LLPanelPeople::updateNearbyList() @@ -855,7 +857,8 @@ void LLPanelPeople::updateFacebookList(bool visible) { if (visible) { - LLFacebookConnect::instance().setContentUpdatedCallback(boost::bind(&LLPanelPeople::updateSuggestedFriendList, this)); + LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLPanelPeople"); // just in case it is already listening + LLEventPumps::instance().obtain("FacebookConnectContent").listen("LLPanelPeople", boost::bind(&LLPanelPeople::updateSuggestedFriendList, this)); if (mTryToConnectToFbc) { @@ -866,6 +869,7 @@ void LLPanelPeople::updateFacebookList(bool visible) } else { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLPanelPeople"); // just in case it is already listening LLEventPumps::instance().obtain("FacebookConnectState").listen("LLPanelPeople", boost::bind(&LLPanelPeople::onConnectedToFacebook, this, _1)); LLFacebookConnect::instance().checkConnectionToFacebook(); } @@ -878,7 +882,7 @@ void LLPanelPeople::updateFacebookList(bool visible) } else { - LLFacebookConnect::instance().setContentUpdatedCallback(NULL); + LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLPanelPeople"); } } diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index c6ee7b8165..b746835dfb 100755 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -76,7 +76,7 @@ private: // methods indirectly called by the updaters void updateFriendListHelpText(); void updateFriendList(); - void updateSuggestedFriendList(); + bool updateSuggestedFriendList(); void updateNearbyList(); void updateRecentList(); void updateFacebookList(bool visible); |