X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fmpdclient.h;h=383634fb78398c2e10726ca88d3acc7f03e4cb19;hb=b03ae94c3b283882aa04ad5ffeb7ecd30c3176f0;hp=8309aa3a30519869c3f16af90c7c9bf5879ad219;hpb=681ef857bb2522e93b03ab8b3adb74c76977da65;p=ncmpc.git diff --git a/src/mpdclient.h b/src/mpdclient.h index 8309aa3..383634f 100644 --- a/src/mpdclient.h +++ b/src/mpdclient.h @@ -36,7 +36,7 @@ struct mpdclient { unsigned update_id; /** - * A bit mask of idle events occured since the last update. + * A bit mask of idle events occurred since the last update. */ enum mpd_idle events; }; @@ -57,12 +57,19 @@ mpdclient_is_connected(const struct mpdclient *c) return c->connection != NULL; } +G_GNUC_PURE +static inline bool +mpdclient_is_playing(const struct mpdclient *c) +{ + return c->status != NULL && + (mpd_status_get_state(c->status) == MPD_STATE_PLAY || + mpd_status_get_state(c->status) == MPD_STATE_PAUSE); +} + static inline const struct mpd_song * mpdclient_get_current_song(const struct mpdclient *c) { - return c->song != NULL && c->status != NULL && - (mpd_status_get_state(c->status) == MPD_STATE_PLAY || - mpd_status_get_state(c->status) == MPD_STATE_PAUSE) + return c->song != NULL && mpdclient_is_playing(c) ? c->song : NULL; }