From 909c6ec59474e5c826b2a445e2583d5a7c6f0a52 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Sun, 29 Jun 2014 21:07:55 -0400 Subject: [PATCH] Refresh sorting of topmenu after (re)LoadTopMenuConfig (bug 6032, r=psychonic). --- extensions/topmenus/TopMenu.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/extensions/topmenus/TopMenu.cpp b/extensions/topmenus/TopMenu.cpp index 18d8e512d0..2d21c07acb 100644 --- a/extensions/topmenus/TopMenu.cpp +++ b/extensions/topmenus/TopMenu.cpp @@ -1077,6 +1077,9 @@ bool TopMenu::LoadConfiguration(const char *file, char *error, size_t maxlength) return false; } + m_SerialNo++; + m_bCatsNeedResort = true; + return true; } @@ -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 {