From 5e26566f486611a49454cd83b0dd7f2dbad20d8b Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Thu, 18 Feb 2010 19:13:14 +0200
Subject: Fixed low bug (EXT-5212) Add "Parcel Properties" and "Coordinates" to
 World->Show.

--HG--
branch : product-engine
---
 indra/newview/lllocationinputctrl.cpp | 20 +++++++++++++++++---
 indra/newview/lllocationinputctrl.h   |  2 ++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index c66d067779..e493c4bf9c 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -358,6 +358,20 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
 	getTextEntry()->setRightMouseUpCallback(boost::bind(&LLLocationInputCtrl::onTextEditorRightClicked,this,_2,_3,_4));
 	updateWidgetlayout();
 
+	// Connecting signal for updating location on "Show Coordinates" setting change.
+	LLControlVariable* coordinates_control = gSavedSettings.getControl("NavBarShowCoordinates").get();
+	if (coordinates_control)
+	{
+		mCoordinatesControlConnection = coordinates_control->getSignal()->connect(boost::bind(&LLLocationInputCtrl::refreshLocation, this));
+	}
+
+	// Connecting signal for updating parcel icons on "Show Parcel Properties" setting change.
+	LLControlVariable* parcel_properties_control = gSavedSettings.getControl("NavBarShowParcelProperties").get();
+	if (parcel_properties_control)
+	{
+		mParcelPropertiesControlConnection = parcel_properties_control->getSignal()->connect(boost::bind(&LLLocationInputCtrl::refreshParcelIcons, this));
+	}
+
 	// - Make the "Add landmark" button updated when either current parcel gets changed
 	//   or a landmark gets created or removed from the inventory.
 	// - Update the location string on parcel change.
@@ -391,6 +405,8 @@ LLLocationInputCtrl::~LLLocationInputCtrl()
 	LLViewerParcelMgr::getInstance()->removeObserver(mParcelChangeObserver);
 	delete mParcelChangeObserver;
 
+	mCoordinatesControlConnection.disconnect();
+	mParcelPropertiesControlConnection.disconnect();
 	mParcelMgrConnection.disconnect();
 	mLocationHistoryConnection.disconnect();
 }
@@ -763,8 +779,7 @@ void LLLocationInputCtrl::refreshParcelIcons()
 	// Our "cursor" moving right to left
 	S32 x = mAddLandmarkBtn->getRect().mLeft;
 
-	static LLUICachedControl<bool> show_properties("NavBarShowParcelProperties", false);
-	if (show_properties)
+	if (gSavedSettings.getBOOL("NavBarShowParcelProperties"))
 	{
 		LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
 
@@ -1008,7 +1023,6 @@ void LLLocationInputCtrl::onLocationContextMenuItemClicked(const LLSD& userdata)
 	{
 		gSavedSettings.setBOOL("NavBarShowParcelProperties",
 			!gSavedSettings.getBOOL("NavBarShowParcelProperties"));
-		refreshParcelIcons();
 	}
 	else if (item == "landmark")
 	{
diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h
index caa62daa1b..4bb41f3bf4 100644
--- a/indra/newview/lllocationinputctrl.h
+++ b/indra/newview/lllocationinputctrl.h
@@ -174,6 +174,8 @@ private:
 	LLRemoveLandmarkObserver*	mRemoveLandmarkObserver;
 	LLParcelChangeObserver*		mParcelChangeObserver;
 
+	boost::signals2::connection	mCoordinatesControlConnection;
+	boost::signals2::connection	mParcelPropertiesControlConnection;
 	boost::signals2::connection	mParcelMgrConnection;
 	boost::signals2::connection	mLocationHistoryConnection;
 	LLUIImage* mLandmarkImageOn;
-- 
cgit v1.2.3