summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c4984e3)
raw | patch | inline | side by side (parent: c4984e3)
author | Max Kellermann <max@duempel.org> | |
Thu, 11 Jun 2009 14:32:39 +0000 (16:32 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 11 Jun 2009 14:32:39 +0000 (16:32 +0200) |
src/screen.c | patch | blob | history |
diff --git a/src/screen.c b/src/screen.c
index a3587b0004eca7e658f821c9c7d9d70d39ceb88e..b8102d670916608c410f373805cf345f3928bae0 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
}
#endif
+static inline int
+get_volume(const struct mpd_Status *status)
+{
+ return status != NULL
+ ? status->volume
+ : MPD_STATUS_NO_VOLUME;
+}
+
static void
paint_top_window2(const char *header, mpdclient_t *c)
{
+ int volume;
char flags[5];
WINDOW *w = screen.top_window.w;
char buf[32];
#endif
}
- if (c->status == NULL || c->status->volume == MPD_STATUS_NO_VOLUME) {
+ volume = get_volume(c->status);
+ if (volume == MPD_STATUS_NO_VOLUME)
g_snprintf(buf, 32, _("Volume n/a"));
- } else {
- g_snprintf(buf, 32, _("Volume %d%%"), c->status->volume);
- }
+ else
+ g_snprintf(buf, 32, _("Volume %d%%"), volume);
+
colors_use(w, COLOR_TITLE);
mvwaddstr(w, 0, screen.top_window.cols - utf8_width(buf), buf);