diff --git a/NEWS b/NEWS index 0a644fe5..2e63906a 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ ncmpcpp-0.8 (????-??-??) * Added 'statusbar_time_color' and 'player_state_color' configuration variables for further customization of statusbar. * Format information can now be attached to selected color variables in the configuration file. Because of that variable 'progressbar_boldness' is now deprecated in favor of extended 'progressbar_color' and 'progressbar_elapsed_color' (for more information see example configuration file). * Lyrics and last_fm can now be startup screens and are lockable. +* Action 'update_environment' now also synchronizes status with MPD. ncmpcpp-0.7.7 (2016-10-31) * Fixed compilation on 32bit platforms. diff --git a/src/actions.cpp b/src/actions.cpp index cf866295..c77466cc 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -330,7 +330,7 @@ UpdateEnvironment::UpdateEnvironment() , m_past(boost::posix_time::from_time_t(0)) { } -void UpdateEnvironment::run(bool update_timer, bool refresh_window) +void UpdateEnvironment::run(bool update_timer, bool refresh_window, bool mpd_sync) { using Global::Timer; @@ -352,11 +352,19 @@ void UpdateEnvironment::run(bool update_timer, bool refresh_window) if (refresh_window) myScreen->refreshWindow(); + + // We want to synchronize with MPD during execution of an action chain. + if (mpd_sync) + { + int flags = Mpd.noidle(); + if (flags) + Status::update(flags); + } } void UpdateEnvironment::run() { - run(true, true); + run(true, true, true); } bool MouseEvent::canBeRun() diff --git a/src/actions.h b/src/actions.h index 3bbffac9..e24ce27b 100644 --- a/src/actions.h +++ b/src/actions.h @@ -231,7 +231,7 @@ struct UpdateEnvironment: BaseAction { UpdateEnvironment(); - void run(bool update_status, bool refresh_window); + void run(bool update_status, bool refresh_window, bool mpd_sync); private: boost::posix_time::ptime m_past; diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 963301ef..552f15fa 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -161,8 +161,7 @@ int main(int argc, char **argv) auto input = NC::Key::None; auto connect_attempt = boost::posix_time::from_time_t(0); auto update_environment = static_cast( - Actions::get(Actions::Type::UpdateEnvironment) - ); + Actions::get(Actions::Type::UpdateEnvironment)); while (!Actions::ExitMainLoop) { @@ -196,7 +195,7 @@ int main(int argc, char **argv) run_resize_screen = false; } - update_environment.run(!key_pressed, key_pressed); + update_environment.run(!key_pressed, key_pressed, false); input = readKey(*wFooter); key_pressed = input != NC::Key::None;