Do mpd status update after every call to noidle if appropriate
This commit is contained in:
1
NEWS
1
NEWS
@@ -18,6 +18,7 @@ ncmpcpp-0.8 (????-??-??)
|
|||||||
* 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).
|
* 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.
|
* Lyrics and last_fm can now be startup screens and are lockable.
|
||||||
* Action 'update_environment' now also synchronizes status with MPD.
|
* Action 'update_environment' now also synchronizes status with MPD.
|
||||||
|
* Fixed an issue that could cause some MPD events to be missed.
|
||||||
|
|
||||||
ncmpcpp-0.7.7 (2016-10-31)
|
ncmpcpp-0.7.7 (2016-10-31)
|
||||||
* Fixed compilation on 32bit platforms.
|
* Fixed compilation on 32bit platforms.
|
||||||
|
|||||||
@@ -189,6 +189,11 @@ int Connection::noidle()
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Connection::setNoidleCallback(NoidleCallback callback)
|
||||||
|
{
|
||||||
|
m_noidle_callback = std::move(callback);
|
||||||
|
}
|
||||||
|
|
||||||
Statistics Connection::getStatistics()
|
Statistics Connection::getStatistics()
|
||||||
{
|
{
|
||||||
prechecks();
|
prechecks();
|
||||||
@@ -846,7 +851,9 @@ void Connection::checkConnection() const
|
|||||||
void Connection::prechecks()
|
void Connection::prechecks()
|
||||||
{
|
{
|
||||||
checkConnection();
|
checkConnection();
|
||||||
noidle();
|
int flags = noidle();
|
||||||
|
if (flags && m_noidle_callback)
|
||||||
|
m_noidle_callback(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::prechecksNoCommandsList()
|
void Connection::prechecksNoCommandsList()
|
||||||
|
|||||||
@@ -480,6 +480,8 @@ typedef Iterator<std::string> StringIterator;
|
|||||||
|
|
||||||
struct Connection
|
struct Connection
|
||||||
{
|
{
|
||||||
|
typedef std::function<void(int)> NoidleCallback;
|
||||||
|
|
||||||
Connection();
|
Connection();
|
||||||
|
|
||||||
void Connect();
|
void Connect();
|
||||||
@@ -582,6 +584,7 @@ struct Connection
|
|||||||
|
|
||||||
void idle();
|
void idle();
|
||||||
int noidle();
|
int noidle();
|
||||||
|
void setNoidleCallback(NoidleCallback callback);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ConnectionDeleter {
|
struct ConnectionDeleter {
|
||||||
@@ -595,6 +598,7 @@ private:
|
|||||||
void prechecksNoCommandsList();
|
void prechecksNoCommandsList();
|
||||||
void checkErrors() const;
|
void checkErrors() const;
|
||||||
|
|
||||||
|
NoidleCallback m_noidle_callback;
|
||||||
std::unique_ptr<mpd_connection, ConnectionDeleter> m_connection;
|
std::unique_ptr<mpd_connection, ConnectionDeleter> m_connection;
|
||||||
bool m_command_list_active;
|
bool m_command_list_active;
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ int main(int argc, char **argv)
|
|||||||
sigignore(SIGPIPE);
|
sigignore(SIGPIPE);
|
||||||
signal(SIGWINCH, sighandler);
|
signal(SIGWINCH, sighandler);
|
||||||
|
|
||||||
|
Mpd.setNoidleCallback(Status::update);
|
||||||
|
|
||||||
NC::initScreen(Config.colors_enabled, Config.mouse_support);
|
NC::initScreen(Config.colors_enabled, Config.mouse_support);
|
||||||
|
|
||||||
Actions::OriginalStatusbarVisibility = Config.statusbar_visibility;
|
Actions::OriginalStatusbarVisibility = Config.statusbar_visibility;
|
||||||
|
|||||||
Reference in New Issue
Block a user