From 178b1b38621b82ad7669633546996bab9d7b8ac9 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Wed, 16 Jan 2013 20:22:00 -0600 Subject: [PATCH] Fix theme loading on non-Windows. --- Source/Core/DolphinWX/Src/ConfigMain.cpp | 11 +++++++++-- Source/Core/DolphinWX/Src/FrameTools.cpp | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index ae07eb78b8..d4777a7907 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -595,7 +595,13 @@ void CConfigMain::CreateGUIControls() // theme selection auto const theme_selection = new wxChoice(DisplayPage, wxID_ANY); - CFileSearch cfs(CFileSearch::XStringVector(1, "*"), CFileSearch::XStringVector(1, File::GetUserPath(D_THEMES_IDX))); + CFileSearch::XStringVector theme_dirs; + theme_dirs.push_back(File::GetUserPath(D_THEMES_IDX)); +#if !defined(_WIN32) + theme_dirs.push_back(SHARED_USER_DIR THEMES_DIR); +#endif + + CFileSearch cfs(CFileSearch::XStringVector(1, "*"), theme_dirs); auto const& sv = cfs.GetFileNames(); std::for_each(sv.begin(), sv.end(), [theme_selection](const std::string& filename) { @@ -603,7 +609,8 @@ void CConfigMain::CreateGUIControls() SplitPath(filename, NULL, &name, &ext); name += ext; - theme_selection->Append(name); + if (-1 == theme_selection->FindString(name)) + theme_selection->Append(name); if (SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name == name) theme_selection->SetSelection(theme_selection->GetCount() - 1); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index f07fcd10f3..eb139bd5c1 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -495,7 +495,14 @@ void CFrame::RecreateToolbar() void CFrame::InitBitmaps() { - wxString dir(File::GetUserPath(D_THEMES_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name + "/"); + std::string theme(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name + "/"); + std::string dir(File::GetUserPath(D_THEMES_IDX) + theme); + +#if !defined(_WIN32) + // If theme does not exist in user's dir load from shared directory + if (!File::Exists(dir)) + dir = SHARED_USER_DIR THEMES_DIR "/" + theme; +#endif m_Bitmaps[Toolbar_FileOpen].LoadFile(dir + "open.png", wxBITMAP_TYPE_PNG); m_Bitmaps[Toolbar_Refresh].LoadFile(dir + "refresh.png", wxBITMAP_TYPE_PNG);