Skip to content

Commit

Permalink
Refresh sorting of topmenu after (re)LoadTopMenuConfig (bug 6032, r=p…
Browse files Browse the repository at this point in the history
…sychonic).
  • Loading branch information
peace-maker authored and psychonic committed Jun 30, 2014
1 parent aedd1eb commit 909c6ec
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions extensions/topmenus/TopMenu.cpp
Expand Up @@ -1077,6 +1077,9 @@ bool TopMenu::LoadConfiguration(const char *file, char *error, size_t maxlength)
return false;
}

m_SerialNo++;
m_bCatsNeedResort = true;

return true;
}

Expand Down Expand Up @@ -1161,6 +1164,17 @@ SMCResult TopMenu::ReadSMC_NewSection(const SMCStates *states, const char *name)
cur_cat->name = m_Config.strings.AddString(name);
m_Config.cats.push_back(cur_cat);
current_parse_state = PARSE_STATE_CATEGORY;

// This category needs reordering now that the sorting file is defining something new for it.
for (unsigned int i = 0; i < (unsigned int)m_Categories.size(); i++)
{
if (strcmp(name, m_Categories[i]->obj->name) == 0)
{
m_Categories[i]->reorder = true;
m_Categories[i]->serial++;
break;
}
}
}
else
{
Expand Down

0 comments on commit 909c6ec

Please sign in to comment.