Partition: add method EmitIdle()
Prepare for moving idle events to class Partition. Right now, it's just a wrapper for idle_add().
This commit is contained in:
parent
e52ac0b187
commit
b24a5e0662
@ -77,7 +77,6 @@ Instance::OnDatabaseModified()
|
|||||||
|
|
||||||
stats_invalidate();
|
stats_invalidate();
|
||||||
partition->DatabaseModified(*database);
|
partition->DatabaseModified(*database);
|
||||||
idle_add(IDLE_DATABASE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -102,13 +101,13 @@ Instance::OnDatabaseSongRemoved(const LightSong &song)
|
|||||||
void
|
void
|
||||||
Instance::FoundNeighbor(gcc_unused const NeighborInfo &info)
|
Instance::FoundNeighbor(gcc_unused const NeighborInfo &info)
|
||||||
{
|
{
|
||||||
idle_add(IDLE_NEIGHBOR);
|
partition->EmitIdle(IDLE_NEIGHBOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Instance::LostNeighbor(gcc_unused const NeighborInfo &info)
|
Instance::LostNeighbor(gcc_unused const NeighborInfo &info)
|
||||||
{
|
{
|
||||||
idle_add(IDLE_NEIGHBOR);
|
partition->EmitIdle(IDLE_NEIGHBOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,6 +25,12 @@
|
|||||||
#include "Idle.hxx"
|
#include "Idle.hxx"
|
||||||
#include "GlobalEvents.hxx"
|
#include "GlobalEvents.hxx"
|
||||||
|
|
||||||
|
void
|
||||||
|
Partition::EmitIdle(unsigned mask)
|
||||||
|
{
|
||||||
|
idle_add(mask);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
|
|
||||||
const Database *
|
const Database *
|
||||||
@ -37,6 +43,7 @@ void
|
|||||||
Partition::DatabaseModified(const Database &db)
|
Partition::DatabaseModified(const Database &db)
|
||||||
{
|
{
|
||||||
playlist.DatabaseModified(db);
|
playlist.DatabaseModified(db);
|
||||||
|
EmitIdle(IDLE_DATABASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -75,5 +82,5 @@ Partition::OnMixerVolumeChanged(gcc_unused Mixer &mixer, gcc_unused int volume)
|
|||||||
InvalidateHardwareVolume();
|
InvalidateHardwareVolume();
|
||||||
|
|
||||||
/* notify clients */
|
/* notify clients */
|
||||||
idle_add(IDLE_MIXER);
|
EmitIdle(IDLE_MIXER);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,8 @@ struct Partition final : private PlayerListener, private MixerListener {
|
|||||||
outputs(*this),
|
outputs(*this),
|
||||||
pc(*this, outputs, buffer_chunks, buffered_before_play) {}
|
pc(*this, outputs, buffer_chunks, buffered_before_play) {}
|
||||||
|
|
||||||
|
void EmitIdle(unsigned mask);
|
||||||
|
|
||||||
void ClearQueue() {
|
void ClearQueue() {
|
||||||
playlist.Clear(pc);
|
playlist.Clear(pc);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "ReplayGainConfig.hxx"
|
#include "ReplayGainConfig.hxx"
|
||||||
#include "Idle.hxx"
|
|
||||||
#include "config/Param.hxx"
|
#include "config/Param.hxx"
|
||||||
#include "config/ConfigGlobal.hxx"
|
#include "config/ConfigGlobal.hxx"
|
||||||
#include "system/FatalError.hxx"
|
#include "system/FatalError.hxx"
|
||||||
@ -74,8 +73,6 @@ replay_gain_set_mode_string(const char *p)
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
idle_add(IDLE_OPTIONS);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "ClientInternal.hxx"
|
#include "ClientInternal.hxx"
|
||||||
|
#include "Partition.hxx"
|
||||||
#include "Idle.hxx"
|
#include "Idle.hxx"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -40,7 +41,7 @@ Client::Subscribe(const char *channel)
|
|||||||
|
|
||||||
++num_subscriptions;
|
++num_subscriptions;
|
||||||
|
|
||||||
idle_add(IDLE_SUBSCRIPTION);
|
partition.EmitIdle(IDLE_SUBSCRIPTION);
|
||||||
|
|
||||||
return Client::SubscribeResult::OK;
|
return Client::SubscribeResult::OK;
|
||||||
}
|
}
|
||||||
@ -57,7 +58,7 @@ Client::Unsubscribe(const char *channel)
|
|||||||
subscriptions.erase(i);
|
subscriptions.erase(i);
|
||||||
--num_subscriptions;
|
--num_subscriptions;
|
||||||
|
|
||||||
idle_add(IDLE_SUBSCRIPTION);
|
partition.EmitIdle(IDLE_SUBSCRIPTION);
|
||||||
|
|
||||||
assert((num_subscriptions == 0) ==
|
assert((num_subscriptions == 0) ==
|
||||||
subscriptions.empty());
|
subscriptions.empty());
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "mixer/Volume.hxx"
|
#include "mixer/Volume.hxx"
|
||||||
#include "Partition.hxx"
|
#include "Partition.hxx"
|
||||||
#include "Instance.hxx"
|
#include "Instance.hxx"
|
||||||
|
#include "Idle.hxx"
|
||||||
#include "AudioFormat.hxx"
|
#include "AudioFormat.hxx"
|
||||||
#include "ReplayGainConfig.hxx"
|
#include "ReplayGainConfig.hxx"
|
||||||
|
|
||||||
@ -348,6 +349,7 @@ handle_replay_gain_mode(Client &client, Request args, Response &r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
client.partition.outputs.SetReplayGainMode(replay_gain_get_real_mode(client.playlist.queue.random));
|
client.partition.outputs.SetReplayGainMode(replay_gain_get_real_mode(client.playlist.queue.random));
|
||||||
|
client.partition.EmitIdle(IDLE_OPTIONS);
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ handle_mount(Client &client, Request args, Response &r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
composite.Mount(local_uri, storage);
|
composite.Mount(local_uri, storage);
|
||||||
idle_add(IDLE_MOUNT);
|
client.partition.EmitIdle(IDLE_MOUNT);
|
||||||
|
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
Database *_db = client.partition.instance.database;
|
Database *_db = client.partition.instance.database;
|
||||||
@ -249,7 +249,7 @@ handle_mount(Client &client, Request args, Response &r)
|
|||||||
|
|
||||||
// TODO: call Instance::OnDatabaseModified()?
|
// TODO: call Instance::OnDatabaseModified()?
|
||||||
// TODO: trigger database update?
|
// TODO: trigger database update?
|
||||||
idle_add(IDLE_DATABASE);
|
client.partition.EmitIdle(IDLE_DATABASE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ handle_unmount(Client &client, Request args, Response &r)
|
|||||||
|
|
||||||
if (db.Unmount(local_uri))
|
if (db.Unmount(local_uri))
|
||||||
// TODO: call Instance::OnDatabaseModified()?
|
// TODO: call Instance::OnDatabaseModified()?
|
||||||
idle_add(IDLE_DATABASE);
|
client.partition.EmitIdle(IDLE_DATABASE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ handle_unmount(Client &client, Request args, Response &r)
|
|||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
idle_add(IDLE_MOUNT);
|
client.partition.EmitIdle(IDLE_MOUNT);
|
||||||
|
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user