Code

configure.ac: disable -Wdeclaration-after-statement
[ncmpc.git] / src / screen.c
index 4abb35a429e0af46b3a45bfdc67bb96f9917bea1..9bbfda742ff2a32afd7c82d78ac26cd03e02af86 100644 (file)
@@ -1,5 +1,5 @@
 /* ncmpc (Ncurses MPD Client)
- * (c) 2004-2009 The Music Player Daemon Project
+ * (c) 2004-2010 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
 
  * This program is free software; you can redistribute it and/or modify
@@ -158,16 +158,14 @@ update_progress_window(struct mpdclient *c, bool repaint)
 {
        unsigned elapsed, duration;
 
-       if (c->song != NULL && seek_id == (int)mpd_song_get_id(c->song))
+       if (c->status == NULL)
+               elapsed = 0;
+       else if (seek_id >= 0 && seek_id == mpd_status_get_song_id(c->status))
                elapsed = seek_target_time;
-       else if (c->status != NULL)
-               elapsed = mpd_status_get_elapsed_time(c->status);
        else
-               elapsed = 0;
+               elapsed = mpd_status_get_elapsed_time(c->status);
 
-       duration = c->status != NULL &&
-               (mpd_status_get_state(c->status) == MPD_STATE_PLAY ||
-                mpd_status_get_state(c->status) == MPD_STATE_PAUSE)
+       duration = mpdclient_is_playing(c)
                ? mpd_status_get_total_time(c->status)
                : 0;