diff options
author | Max Kellermann <max@musicpd.org> | 2020-01-18 22:14:50 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-01-18 22:21:27 +0100 |
commit | ac126ede229bcf424fa9472fd04902a5c5a61966 (patch) | |
tree | 945df07e1407980c653b85c0e8a833a1edaaac40 | |
parent | 7732db0aeed32cf0c609dda9fd0b029478d7c0db (diff) |
client/Client: emit idle flags in SetPartition()
-rw-r--r-- | src/client/Client.cxx | 20 | ||||
-rw-r--r-- | src/client/Client.hxx | 6 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/client/Client.cxx b/src/client/Client.cxx index 974723055..642f27d5a 100644 --- a/src/client/Client.cxx +++ b/src/client/Client.cxx @@ -22,6 +22,7 @@ #include "Partition.hxx" #include "Instance.hxx" #include "BackgroundCommand.hxx" +#include "IdleFlags.hxx" #include "config.h" Client::~Client() noexcept @@ -61,6 +62,25 @@ Client::OnBackgroundCommandFinished() noexcept timeout_event.Schedule(client_timeout); } +void +Client::SetPartition(Partition &new_partition) noexcept +{ + if (partition == &new_partition) + return; + + partition = &new_partition; + + /* set idle flags for those subsystems which are specific to + the current partition to force the client to reload its + state */ + idle_flags |= IDLE_PLAYLIST|IDLE_PLAYER|IDLE_MIXER|IDLE_OUTPUT|IDLE_OPTIONS; + /* note: we're not using IdleAdd() here because we don't need + to notify the client; the method is only used while this + client's "partition" command is handled, which means the + client is currently active and doesn't need to be woken + up */ +} + Instance & Client::GetInstance() noexcept { diff --git a/src/client/Client.hxx b/src/client/Client.hxx index 4ce7757f1..01d232e9c 100644 --- a/src/client/Client.hxx +++ b/src/client/Client.hxx @@ -234,11 +234,7 @@ public: return *partition; } - void SetPartition(Partition &new_partition) noexcept { - partition = &new_partition; - - // TODO: set various idle flags? - } + void SetPartition(Partition &new_partition) noexcept; gcc_pure Instance &GetInstance() noexcept; |