some fixes for non-unicode locales

This commit is contained in:
Andrzej Rybczak
2009-03-07 13:26:36 +01:00
parent a4599fffe7
commit 3523caa592
4 changed files with 9 additions and 6 deletions

View File

@@ -385,6 +385,7 @@ void Browser::GetDirectory(string dir, string subdir)
parent.song = (Song *) 1; // in that way we assume that's really parent dir
parent.name = slash != string::npos ? dir.substr(0, slash) : "/";
parent.type = itDirectory;
utf_to_locale(parent.name);
w->AddOption(parent);
}

View File

@@ -977,7 +977,7 @@ int main(int argc, char *argv[])
else if (Keypressed(input, Key.UpdateDB))
{
if (myScreen == myBrowser)
Mpd->UpdateDirectory(myBrowser->CurrentDir());
Mpd->UpdateDirectory(locale_to_utf_cpy(myBrowser->CurrentDir()));
# ifdef HAVE_TAGLIB_H
else if (myScreen == myTagEditor && !Config.albums_in_tag_editor)
Mpd->UpdateDirectory(myTagEditor->CurrentDir());
@@ -1077,7 +1077,7 @@ int main(int argc, char *argv[])
}
if (success)
{
Mpd->UpdateDirectory(FindSharedDir(list));
Mpd->UpdateDirectory(locale_to_utf_cpy(FindSharedDir(list)));
ShowMessage("Tags updated succesfully!");
}
FreeSongList(list);
@@ -1098,7 +1098,7 @@ int main(int argc, char *argv[])
(*myLibrary->Songs)[i].Localize();
ShowMessage("Updating tags in '%s'...", (*myLibrary->Songs)[i].GetName().c_str());
string path = Config.mpd_music_dir + (*myLibrary->Songs)[i].GetFile();
TagLib::FileRef f(path.c_str());
TagLib::FileRef f(locale_to_utf_cpy(path).c_str());
if (f.isNull())
{
ShowMessage("Error opening file '%s'!", (*myLibrary->Songs)[i].GetFile().c_str());
@@ -1115,7 +1115,7 @@ int main(int argc, char *argv[])
}
if (success)
{
Mpd->UpdateDirectory(FindSharedDir(myLibrary->Songs));
Mpd->UpdateDirectory(locale_to_utf_cpy(FindSharedDir(myLibrary->Songs)));
ShowMessage("Tags updated succesfully!");
}
}
@@ -1169,7 +1169,7 @@ int main(int argc, char *argv[])
{
ShowMessage("'%s' renamed to '%s'", old_dir.c_str(), new_dir.c_str());
if (!Config.local_browser)
Mpd->UpdateDirectory(FindSharedDir(old_dir, new_dir));
Mpd->UpdateDirectory(locale_to_utf_cpy(FindSharedDir(old_dir, new_dir)));
myBrowser->GetDirectory(myBrowser->CurrentDir());
}
else

View File

@@ -422,6 +422,7 @@ void TagEditor::Update()
Mpd->GetAlbums("", list);
for (TagList::const_iterator it = list.begin(); it != list.end(); it++)
{
SongList l;
Mpd->StartSearch(1);
Mpd->AddSearch(MPD_TAG_ITEM_ALBUM, *it);
@@ -662,7 +663,7 @@ void TagEditor::EnterPressed()
w->Refresh();
w = LeftColumn;
LeftColumn->HighlightColor(Config.active_column_color);
Mpd->UpdateDirectory(FindSharedDir(Tags));
Mpd->UpdateDirectory(locale_to_utf_cpy(FindSharedDir(Tags)));
}
else
Tags->Clear(0);

View File

@@ -94,6 +94,7 @@ class TagEditor : public Screen<Window>
Menu<std::string> *TagTypes;
Menu<MPD::Song> *Tags;
/// NOTICE: this string is always in utf8, no need to convert it
const std::string &CurrentDir() { return itsBrowsedDir; }
static void ReadTags(mpd_Song *);