From faf0287cf5170e1c7008fc42184a7a98a9235a38 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Fri, 15 Aug 2014 16:54:30 +0200 Subject: [PATCH] Simplify code to reload section icons when skin changes --- src/menu.cpp | 4 +--- src/surfacecollection.h | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/menu.cpp b/src/menu.cpp index 6e43b8c..a834faf 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -140,9 +140,7 @@ void Menu::skinUpdated() { //reload section icons vector::size_type i = 0; for (string sectionName : sections) { - string sectionIcon = "sections/" + sectionName + ".png"; - if (!gmenu2x->sc.getSkinFilePath(sectionIcon).empty()) - gmenu2x->sc.add("skin:" + sectionIcon); + gmenu2x->sc["skin:sections/" + sectionName + ".png"]; for (Link *&link : links[i]) { link->loadIcon(); diff --git a/src/surfacecollection.h b/src/surfacecollection.h index 12a434d..63d093b 100644 --- a/src/surfacecollection.h +++ b/src/surfacecollection.h @@ -44,7 +44,6 @@ public: void debug(); - OffscreenSurface *add(const std::string &path); OffscreenSurface *addSkinRes(const std::string &path, bool useDefault = true); void del(const std::string &path); void clear(); @@ -55,6 +54,8 @@ public: OffscreenSurface *skinRes(const std::string &key, bool useDefault = true); private: + OffscreenSurface *add(const std::string &path); + SurfaceHash surfaces; std::string skin; };