Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix theme loading on non-Windows.
  • Loading branch information
jordan-woyak committed Jan 17, 2013
1 parent 196c286 commit 178b1b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
11 changes: 9 additions & 2 deletions Source/Core/DolphinWX/Src/ConfigMain.cpp
Expand Up @@ -595,15 +595,22 @@ 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)
{
std::string name, ext;
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);
Expand Down
9 changes: 8 additions & 1 deletion Source/Core/DolphinWX/Src/FrameTools.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 178b1b3

Please sign in to comment.