fixing #1721
This commit is contained in:
parent
63b25f039e
commit
23ea0af3a6
1 changed files with 20 additions and 17 deletions
|
@ -696,10 +696,10 @@ Ptr<Glib::ustring>::Ref
|
||||||
ScratchpadWindow :: getContents(void) throw ()
|
ScratchpadWindow :: getContents(void) throw ()
|
||||||
{
|
{
|
||||||
std::ostringstream contentsStream;
|
std::ostringstream contentsStream;
|
||||||
Gtk::TreeModel::const_reverse_iterator it;
|
Gtk::TreeModel::const_iterator it;
|
||||||
|
|
||||||
for (it = treeModel->children().rbegin();
|
for (it = treeModel->children().begin();
|
||||||
it != treeModel->children().rend(); ++it) {
|
it != treeModel->children().end(); ++it) {
|
||||||
Gtk::TreeRow row = *it;
|
Gtk::TreeRow row = *it;
|
||||||
Ptr<Playable>::Ref playable = row[modelColumns.playableColumn];
|
Ptr<Playable>::Ref playable = row[modelColumns.playableColumn];
|
||||||
contentsStream << playable->getId()->getId() << " ";
|
contentsStream << playable->getId()->getId() << " ";
|
||||||
|
@ -718,23 +718,26 @@ void
|
||||||
ScratchpadWindow :: setContents(Ptr<const Glib::ustring>::Ref contents)
|
ScratchpadWindow :: setContents(Ptr<const Glib::ustring>::Ref contents)
|
||||||
throw ()
|
throw ()
|
||||||
{
|
{
|
||||||
std::istringstream contentsStream(contents->raw());
|
std::vector<UniqueId::IdType> contentsVector;
|
||||||
Ptr<Playable>::Ref playable;
|
std::istringstream contentsStream(*contents);
|
||||||
|
while (!contentsStream.eof()) {
|
||||||
|
UniqueId::IdType nextItem;
|
||||||
|
contentsStream >> nextItem;
|
||||||
|
if (contentsStream.fail()) {
|
||||||
|
contentsStream.clear();
|
||||||
|
contentsStream.ignore();
|
||||||
|
} else {
|
||||||
|
contentsVector.push_back(nextItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
treeModel->clear();
|
treeModel->clear();
|
||||||
|
std::vector<UniqueId::IdType>::reverse_iterator it;
|
||||||
|
|
||||||
while (!contentsStream.eof()) {
|
for (it = contentsVector.rbegin(); it != contentsVector.rend(); ++it) {
|
||||||
UniqueId::IdType idValue;
|
Ptr<const UniqueId>::Ref id(new const UniqueId(*it));
|
||||||
Ptr<const UniqueId>::Ref id;
|
|
||||||
|
|
||||||
contentsStream >> idValue;
|
|
||||||
if (contentsStream.fail()) {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
id.reset(new const UniqueId(idValue));
|
|
||||||
addItem(id);
|
addItem(id);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue