From: Kalle Wallin Date: Sat, 27 Mar 2004 23:14:00 +0000 (+0000) Subject: Moved random,repeat notification from main.c X-Git-Tag: v0.12_alpha1~635 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=77992b5b09fb048809922d01a8a25885d2ec2685;p=ncmpc.git Moved random,repeat notification from main.c git-svn-id: https://svn.musicpd.org/ncmpc/trunk@520 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- diff --git a/main.c b/main.c index f4e0f1d..0bfcb74 100644 --- a/main.c +++ b/main.c @@ -105,8 +105,6 @@ main(int argc, const char *argv[]) while( connected || options->reconnect ) { command_t cmd; - static int repeat = -1; - static int random = -1; if( connected && counter==0 ) { @@ -115,33 +113,18 @@ main(int argc, const char *argv[]) { connected=0; screen_status_printf("Lost connection to %s", options->host); + doupdate(); mpd_closeConnection(mpc->connection); mpc->connection = NULL; } else mpd_finishCommand(mpc->connection); counter=10; - - if( repeat<0 ) - { - repeat = mpc->status->repeat; - random = mpc->status->random; - } - if( repeat != mpc->status->repeat ) - screen_status_printf("Repeat is %s", - mpc->status->repeat ? "On" : "Off"); - if( random != mpc->status->random ) - screen_status_printf("Random is %s", - mpc->status->random ? "On" : "Off"); - - repeat = mpc->status->repeat; - random = mpc->status->random; } + if( connected ) { - - screen_update(mpc); if( (cmd=get_keyboard_command()) != CMD_NONE ) { @@ -163,6 +146,7 @@ main(int argc, const char *argv[]) connected=1; counter=0; } + doupdate(); } if( counter>0 ) diff --git a/screen.c b/screen.c index 1745784..7e3e51d 100644 --- a/screen.c +++ b/screen.c @@ -407,9 +407,27 @@ screen_paint(mpd_client_t *c) void screen_update(mpd_client_t *c) { + static int repeat = -1; + static int random = -1; + if( !screen->painted ) return screen_paint(c); + if( repeat<0 ) + { + repeat = c->status->repeat; + random = c->status->random; + } + if( repeat != c->status->repeat ) + screen_status_printf("Repeat is %s", + c->status->repeat ? "On" : "Off"); + if( random != c->status->random ) + screen_status_printf("Random is %s", + c->status->random ? "On" : "Off"); + + repeat = c->status->repeat; + random = c->status->random; + switch(screen->mode) { case SCREEN_PLAY_WINDOW: