Fixed login panel grid combo not staying in sync when adding/removing grids from the grid manager

Cinders 2013-03-29 15:41:22 -06:00
parent 494ed8b347
commit ad2bd6747f
3 changed files with 29 additions and 28 deletions

View File

@ -3553,6 +3553,7 @@ void LLPanelPreferenceOpensim::addedGrid(bool success)
if (success)
{
onClickClearGrid();
LLPanelLogin::updateServerCombo();
}
refreshGridList(success);
}
@ -3597,6 +3598,7 @@ bool LLPanelPreferenceOpensim::removeGridCB(const LLSD& notification, const LLSD
getChild<LLUICtrl>("grid_management_panel")->setEnabled(FALSE);
/*mGridListChanged =*/ LLGridManager::getInstance()->addGridListChangedCallback(boost::bind(&LLPanelPreferenceOpensim::refreshGridList, this, _1));
LLGridManager::getInstance()->removeGrid(grid);
LLPanelLogin::updateServerCombo();
}
return false;
}

View File

@ -1325,39 +1325,38 @@ void LLPanelLogin::onSelectUser()
// static
void LLPanelLogin::updateServerCombo()
{
if (sInstance)
{
if (!sInstance) return;
#ifdef OPENSIM
//LLGridManager::getInstance()->addGridListChangedCallback(&LLPanelLogin::gridListChanged);
LLGridManager::getInstance()->addGridListChangedCallback(&LLPanelLogin::gridListChanged);
#endif // OPENSIM
// We add all of the possible values, sorted, and then add a bar and the current value at the top
LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
server_choice_combo->removeall();
// We add all of the possible values, sorted, and then add a bar and the current value at the top
LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
server_choice_combo->removeall();
std::string current_grid = LLGridManager::getInstance()->getGrid();
std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
std::string current_grid = LLGridManager::getInstance()->getGrid();
std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
for (std::map<std::string, std::string>::iterator grid_choice = known_grids.begin();
grid_choice != known_grids.end();
grid_choice++)
for (std::map<std::string, std::string>::iterator grid_choice = known_grids.begin();
grid_choice != known_grids.end();
grid_choice++)
{
if (!grid_choice->first.empty() && current_grid != grid_choice->first)
{
if (!grid_choice->first.empty() && current_grid != grid_choice->first)
{
LL_DEBUGS("AppInit") << "adding " << grid_choice->first << LL_ENDL;
server_choice_combo->add(grid_choice->second, grid_choice->first);
}
LL_DEBUGS("AppInit") << "adding " << grid_choice->first << LL_ENDL;
server_choice_combo->add(grid_choice->second, grid_choice->first);
}
server_choice_combo->sortByName();
server_choice_combo->addSeparator(ADD_TOP);
LL_DEBUGS("AppInit") << "adding current " << current_grid << LL_ENDL;
server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(),
current_grid,
ADD_TOP);
server_choice_combo->selectFirstItem();
update_grid_help();
updateServer();
}
server_choice_combo->sortByName();
server_choice_combo->addSeparator(ADD_TOP);
LL_DEBUGS("AppInit") << "adding current " << current_grid << LL_ENDL;
server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(),
current_grid,
ADD_TOP);
server_choice_combo->selectFirstItem();
update_grid_help();
updateServer();
}
// static

View File

@ -88,6 +88,7 @@ public:
/// to be called from LLStartUp::setStartSLURL
static void onUpdateStartSLURL(const LLSLURL& new_start_slurl);
static void updateServerCombo();
private:
friend class LLPanelLoginListener;
@ -109,7 +110,6 @@ private:
static void onClickForgotPassword(void*);
static void onClickHelp(void*);
static void onPassKey(LLLineEditor* caller, void* user_data);
static void updateServerCombo();
// <FS:CR>
static void onClickRemove(void*);
static void onClickGridMgrHelp(void*);