X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fscreen.c;h=6f1ac95f3bab6f4eac1d55b24021ed3841703dfc;hb=9eedd15314515b6d9f51aa64926c14d8bda3a99a;hp=2d8ab6a955782c69ce62d8dc4c048b9b40213a39;hpb=d63eae4117d54bdbcecefeab59f09c0a97d98b79;p=ncmpc.git diff --git a/src/screen.c b/src/screen.c index 2d8ab6a..6f1ac95 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1,27 +1,27 @@ /* ncmpc (Ncurses MPD Client) - * (c) 2004-2010 The Music Player Daemon Project + * (c) 2004-2017 The Music Player Daemon Project * Project homepage: http://musicpd.org - + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ + */ #include "screen.h" #include "screen_interface.h" #include "screen_list.h" #include "screen_utils.h" -#include "screen_message.h" +#include "screen_status.h" #include "config.h" #include "i18n.h" #include "charset.h" @@ -39,6 +39,7 @@ #include "screen_keydef.h" #include "screen_lyrics.h" #include "screen_outputs.h" +#include "screen_chat.h" #include @@ -131,18 +132,17 @@ static void screen_next_mode(struct mpdclient *c, int offset) { int max = g_strv_length(options.screen_list); - int current, next; - const struct screen_functions *sf; /* find current screen */ - current = find_configured_screen(screen_get_name(mode_fn)); - next = current + offset; + int current = find_configured_screen(screen_get_name(mode_fn)); + int next = current + offset; if (next<0) next = max-1; else if (next>=max) next = 0; - sf = screen_lookup_name(options.screen_list[next]); + const struct screen_functions *sf = + screen_lookup_name(options.screen_list[next]); if (sf != NULL) screen_switch(sf, c); } @@ -156,8 +156,7 @@ paint_top_window(const char *header, const struct mpdclient *c) static void update_progress_window(struct mpdclient *c, bool repaint) { - unsigned elapsed, duration; - + unsigned elapsed; if (c->status == NULL) elapsed = 0; else if (seek_id >= 0 && seek_id == mpd_status_get_song_id(c->status)) @@ -165,7 +164,7 @@ update_progress_window(struct mpdclient *c, bool repaint) else elapsed = mpd_status_get_elapsed_time(c->status); - duration = mpdclient_is_playing(c) + unsigned duration = mpdclient_is_playing(c) ? mpd_status_get_total_time(c->status) : 0; @@ -202,7 +201,7 @@ screen_resize(struct mpdclient *c) { if (COLS