Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Delete settings category if it already exists in CSettingsGroup::AddC…

…ategory()
  • Loading branch information...
commit bdef87ba1ef399498b4b1da561d50437385f8ab8 1 parent 6db72f9
@garbear garbear authored
Showing with 19 additions and 7 deletions.
  1. +18 −0 xbmc/settings/GUISettings.cpp
  2. +1 −7 xbmc/settings/GUISettings.h
View
18 xbmc/settings/GUISettings.cpp
@@ -226,6 +226,24 @@ CSettingAddon::CSettingAddon(int iOrder, const char *strSetting, int iLabel, con
{
}
+CSettingsCategory* CSettingsGroup::AddCategory(const char *strCategory, int labelID)
+{
+ // Remove the category if it already exists
+ for (vecSettingsCategory::iterator it = m_vecCategories.begin(); it != m_vecCategories.end(); it++)
+ {
+ if ((*it)->m_strCategory.Equals(strCategory))
+ {
+ delete (*it);
+ m_vecCategories.erase(it);
+ break;
+ }
+ }
+ CSettingsCategory *pCategory = new CSettingsCategory(strCategory, labelID);
+ if (pCategory)
+ m_vecCategories.push_back(pCategory);
+ return pCategory;
+}
+
void CSettingsGroup::GetCategories(vecSettingsCategory &vecCategories)
{
vecCategories.clear();
View
8 xbmc/settings/GUISettings.h
@@ -436,13 +436,7 @@ class CSettingsGroup
m_vecCategories.clear();
};
- CSettingsCategory* AddCategory(const char *strCategory, int labelID)
- {
- CSettingsCategory *pCategory = new CSettingsCategory(strCategory, labelID);
- if (pCategory)
- m_vecCategories.push_back(pCategory);
- return pCategory;
- }
+ CSettingsCategory* AddCategory(const char *strCategory, int labelID);
void GetCategories(vecSettingsCategory &vecCategories);
int GetLabelID() { return m_labelID; };
int GetGroupID() { return m_groupID; };
Please sign in to comment.
Something went wrong with that request. Please try again.