summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llgrouplist.cpp17
-rw-r--r--indra/newview/llgrouplist.h4
-rw-r--r--indra/newview/llgroupmgr.cpp3
-rw-r--r--indra/newview/llgroupmgr.h1
4 files changed, 24 insertions, 1 deletions
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index 80b706a215..ab9db10f38 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -225,6 +225,11 @@ mGroupID(LLUUID::null)
}
}
+LLGroupListItem::~LLGroupListItem()
+{
+ LLGroupMgr::getInstance()->removeObserver(this);
+}
+
//virtual
BOOL LLGroupListItem::postBuild()
{
@@ -277,8 +282,13 @@ void LLGroupListItem::setName(const std::string& name, const std::string& highli
void LLGroupListItem::setGroupID(const LLUUID& group_id)
{
+ LLGroupMgr::getInstance()->removeObserver(this);
+
+ mID = group_id;
mGroupID = group_id;
setActive(group_id == gAgent.getGroupID());
+
+ LLGroupMgr::getInstance()->addObserver(this);
}
void LLGroupListItem::setGroupIconID(const LLUUID& group_icon_id)
@@ -337,4 +347,11 @@ void LLGroupListItem::onProfileBtnClick()
LLGroupActions::show(mGroupID);
}
+void LLGroupListItem::changed(LLGroupChange gc)
+{
+ LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mID);
+ if(group_data)
+ setGroupIconID(group_data->mInsigniaID);
+}
+
//EOF
diff --git a/indra/newview/llgrouplist.h b/indra/newview/llgrouplist.h
index 41b4d01711..33cfe005b9 100644
--- a/indra/newview/llgrouplist.h
+++ b/indra/newview/llgrouplist.h
@@ -38,6 +38,7 @@
#include "llpanel.h"
#include "llpointer.h"
#include "llstyle.h"
+#include "llgroupmgr.h"
/**
* Auto-updating list of agent groups.
@@ -80,9 +81,11 @@ class LLIconCtrl;
class LLTextBox;
class LLGroupListItem : public LLPanel
+ , public LLGroupMgrObserver
{
public:
LLGroupListItem();
+ ~LLGroupListItem();
/*virtual*/ BOOL postBuild();
/*virtual*/ void setValue(const LLSD& value);
void onMouseEnter(S32 x, S32 y, MASK mask);
@@ -96,6 +99,7 @@ public:
void setGroupIconID(const LLUUID& group_icon_id);
void setGroupIconVisible(bool visible);
+ virtual void changed(LLGroupChange gc);
private:
void setActive(bool active);
void onInfoBtnClick();
diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp
index ebb5feb2bf..af58e81ca4 100644
--- a/indra/newview/llgroupmgr.cpp
+++ b/indra/newview/llgroupmgr.cpp
@@ -758,7 +758,8 @@ void LLGroupMgr::clearGroupData(const LLUUID& group_id)
void LLGroupMgr::addObserver(LLGroupMgrObserver* observer)
{
- mObservers.insert(std::pair<LLUUID, LLGroupMgrObserver*>(observer->getID(), observer));
+ if( observer->getID() != LLUUID::null )
+ mObservers.insert(std::pair<LLUUID, LLGroupMgrObserver*>(observer->getID(), observer));
}
void LLGroupMgr::removeObserver(LLGroupMgrObserver* observer)
diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h
index a0604be57e..487fdd4c5b 100644
--- a/indra/newview/llgroupmgr.h
+++ b/indra/newview/llgroupmgr.h
@@ -45,6 +45,7 @@ class LLGroupMgrObserver
{
public:
LLGroupMgrObserver(const LLUUID& id) : mID(id){};
+ LLGroupMgrObserver() : mID(LLUUID::null){};
virtual ~LLGroupMgrObserver(){};
virtual void changed(LLGroupChange gc) = 0;
const LLUUID& getID() { return mID; }