db/DatabaseListener: pass URI to OnDatabaseSongRemoved()
There's no point in passing a LightSong reference here; the callee is interested only in the URI.
This commit is contained in:
parent
296ee4961e
commit
2edad38c7c
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
#include "db/DatabaseError.hxx"
|
#include "db/DatabaseError.hxx"
|
||||||
#include "db/LightSong.hxx"
|
|
||||||
|
|
||||||
#ifdef ENABLE_SQLITE
|
#ifdef ENABLE_SQLITE
|
||||||
#include "sticker/StickerDatabase.hxx"
|
#include "sticker/StickerDatabase.hxx"
|
||||||
|
@ -57,18 +56,17 @@ Instance::OnDatabaseModified()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Instance::OnDatabaseSongRemoved(const LightSong &song)
|
Instance::OnDatabaseSongRemoved(const char *uri)
|
||||||
{
|
{
|
||||||
assert(database != nullptr);
|
assert(database != nullptr);
|
||||||
|
|
||||||
#ifdef ENABLE_SQLITE
|
#ifdef ENABLE_SQLITE
|
||||||
/* if the song has a sticker, remove it */
|
/* if the song has a sticker, remove it */
|
||||||
if (sticker_enabled())
|
if (sticker_enabled())
|
||||||
sticker_song_delete(song, IgnoreError());
|
sticker_song_delete(uri, IgnoreError());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const auto uri = song.GetURI();
|
partition->DeleteSong(uri);
|
||||||
partition->DeleteSong(uri.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -115,7 +115,7 @@ struct Instance final
|
||||||
private:
|
private:
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
void OnDatabaseModified() override;
|
void OnDatabaseModified() override;
|
||||||
void OnDatabaseSongRemoved(const LightSong &song) override;
|
void OnDatabaseSongRemoved(const char *uri) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
* During database update, a song is about to be removed from
|
* During database update, a song is about to be removed from
|
||||||
* the database because the file has disappeared.
|
* the database because the file has disappeared.
|
||||||
*/
|
*/
|
||||||
virtual void OnDatabaseSongRemoved(const LightSong &song) = 0;
|
virtual void OnDatabaseSongRemoved(const char *uri) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,10 +39,9 @@ UpdateRemoveService::RunDeferred()
|
||||||
{
|
{
|
||||||
const auto uri = removed_song->GetURI();
|
const auto uri = removed_song->GetURI();
|
||||||
FormatDefault(update_domain, "removing %s", uri.c_str());
|
FormatDefault(update_domain, "removing %s", uri.c_str());
|
||||||
|
listener.OnDatabaseSongRemoved(uri.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
listener.OnDatabaseSongRemoved(removed_song->Export());
|
|
||||||
|
|
||||||
/* clear "removed_song" and send signal to update thread */
|
/* clear "removed_song" and send signal to update thread */
|
||||||
remove_mutex.lock();
|
remove_mutex.lock();
|
||||||
removed_song = nullptr;
|
removed_song = nullptr;
|
||||||
|
|
|
@ -57,8 +57,8 @@ public:
|
||||||
cout << "DatabaseModified" << endl;
|
cout << "DatabaseModified" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnDatabaseSongRemoved(const LightSong &song) override {
|
virtual void OnDatabaseSongRemoved(const char *uri) override {
|
||||||
cout << "SongRemoved " << song.GetURI() << endl;
|
cout << "SongRemoved " << uri << endl;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue