From: Max Kellermann Date: Thu, 1 Oct 2009 20:03:33 +0000 (+0200) Subject: screen: eliminated state macros X-Git-Tag: release-0.16~234 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d5067195b96dfbad5e07e1485fe4f75507b6d558;p=ncmpc.git screen: eliminated state macros Better do it manually. --- diff --git a/src/main.c b/src/main.c index a03b707..43e0dd7 100644 --- a/src/main.c +++ b/src/main.c @@ -81,7 +81,7 @@ update_xterm_title(void) } if (options.xterm_title_format && status && song && - IS_PLAYING(mpd_status_get_state(status))) + mpd_status_get_state(status) == MPD_STATE_PLAY) strfsong(tmp, BUFSIZE, options.xterm_title_format, song); else g_strlcpy(tmp, PACKAGE " version " VERSION, BUFSIZE); diff --git a/src/player_command.c b/src/player_command.c index 085ffa1..3d6d75a 100644 --- a/src/player_command.c +++ b/src/player_command.c @@ -24,8 +24,6 @@ #include "i18n.h" #include "screen_client.h" -#define IS_PAUSED(s) (s==MPD_STATE_PAUSE) - int seek_id = -1; int seek_target_time; @@ -93,7 +91,7 @@ handle_player_command(struct mpdclient *c, command_t cmd) */ case CMD_PAUSE: if (!mpd_run_pause(c->connection, - !IS_PAUSED(mpd_status_get_state(c->status)))) + mpd_status_get_state(c->status) != MPD_STATE_PAUSE)) mpdclient_handle_error(c); break; case CMD_STOP: diff --git a/src/screen.c b/src/screen.c index cf99538..f988cb0 100644 --- a/src/screen.c +++ b/src/screen.c @@ -170,7 +170,8 @@ paint_progress_window(struct mpdclient *c) elapsed = 0; duration = c->status != NULL && - !IS_STOPPED(mpd_status_get_state(c->status)) + (mpd_status_get_state(c->status) == MPD_STATE_PLAY || + mpd_status_get_state(c->status) == MPD_STATE_PAUSE) ? mpd_status_get_total_time(c->status) : 0; diff --git a/src/screen.h b/src/screen.h index 17fc3d4..5ed300f 100644 --- a/src/screen.h +++ b/src/screen.h @@ -37,10 +37,6 @@ #include #endif -#define IS_PLAYING(s) (s==MPD_STATE_PLAY) -#define IS_PAUSED(s) (s==MPD_STATE_PAUSE) -#define IS_STOPPED(s) (!(IS_PLAYING(s) | IS_PAUSED(s))) - #define MAX_SONGNAME_LENGTH 512 struct mpdclient; diff --git a/src/screen_play.c b/src/screen_play.c index ceb1361..f1af519 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -570,7 +570,8 @@ play_update(struct mpdclient *c) playlist_restore_selection(); current_song_id = c->status != NULL && - !IS_STOPPED(mpd_status_get_state(c->status)) + (mpd_status_get_state(c->status) == MPD_STATE_PLAY || + mpd_status_get_state(c->status) == MPD_STATE_PAUSE) ? (int)mpd_status_get_song_id(c->status) : -1; if (current_song_id != prev_song_id) {