From 4052c59420cf7884579d320969140c00bffb4a5d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 1 Oct 2009 22:12:47 +0200 Subject: [PATCH] screen: moved status message functions to screen_message.c --- Makefile.am | 2 ++ src/list_window.c | 2 +- src/main.c | 1 + src/player_command.c | 2 +- src/screen.c | 21 +-------------------- src/screen.h | 2 -- src/screen_artist.c | 2 ++ src/screen_browser.c | 2 ++ src/screen_browser.h | 2 +- src/screen_client.c | 2 +- src/screen_file.c | 2 ++ src/screen_keydef.c | 1 + src/screen_lyrics.c | 1 + src/screen_message.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/screen_message.h | 29 +++++++++++++++++++++++++++++ src/screen_outputs.c | 2 +- src/screen_play.c | 1 + src/screen_search.c | 2 ++ src/screen_utils.c | 1 + 19 files changed, 92 insertions(+), 27 deletions(-) create mode 100644 src/screen_message.c create mode 100644 src/screen_message.h diff --git a/Makefile.am b/Makefile.am index 65620e3..52b5953 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,7 @@ ncmpc_headers = \ src/progress_bar.h \ src/status_bar.h \ src/screen.h \ + src/screen_message.h \ src/screen_interface.h \ src/screen_list.h \ src/screen_utils.h \ @@ -79,6 +80,7 @@ src_ncmpc_SOURCES = \ src/progress_bar.c \ src/status_bar.c \ src/screen.c \ + src/screen_message.c \ src/screen_list.c \ src/screen_utils.c \ src/screen_client.c \ diff --git a/src/list_window.c b/src/list_window.c index 9f3bfc7..ca857b8 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -24,7 +24,7 @@ #include "match.h" #include "command.h" #include "colors.h" -#include "screen.h" +#include "screen_message.h" #include "i18n.h" #include diff --git a/src/main.c b/src/main.c index 43e0dd7..8abdcbd 100644 --- a/src/main.c +++ b/src/main.c @@ -26,6 +26,7 @@ #include "ncu.h" #include "screen.h" #include "screen_utils.h" +#include "screen_message.h" #include "strfsong.h" #include "i18n.h" #include "player_command.h" diff --git a/src/player_command.c b/src/player_command.c index 3d6d75a..fbd77c4 100644 --- a/src/player_command.c +++ b/src/player_command.c @@ -20,9 +20,9 @@ #include "player_command.h" #include "mpdclient.h" #include "options.h" -#include "screen.h" #include "i18n.h" #include "screen_client.h" +#include "screen_message.h" int seek_id = -1; int seek_target_time; diff --git a/src/screen.c b/src/screen.c index f988cb0..a7c46b9 100644 --- a/src/screen.c +++ b/src/screen.c @@ -21,6 +21,7 @@ #include "screen_interface.h" #include "screen_list.h" #include "screen_utils.h" +#include "screen_message.h" #include "config.h" #include "i18n.h" #include "charset.h" @@ -43,7 +44,6 @@ #include #include -#include #include #include #include @@ -242,25 +242,6 @@ screen_resize(struct mpdclient *c) screen_paint(c); } -void -screen_status_message(const char *msg) -{ - status_bar_message(&screen.status_bar, msg); -} - -void -screen_status_printf(const char *format, ...) -{ - char *msg; - va_list ap; - - va_start(ap,format); - msg = g_strdup_vprintf(format,ap); - va_end(ap); - screen_status_message(msg); - g_free(msg); -} - void screen_init(struct mpdclient *c) { diff --git a/src/screen.h b/src/screen.h index 245be77..b948647 100644 --- a/src/screen.h +++ b/src/screen.h @@ -63,8 +63,6 @@ extern struct screen screen; void screen_init(struct mpdclient *c); void screen_exit(void); void screen_resize(struct mpdclient *c); -void screen_status_message(const char *msg); -void screen_status_printf(const char *format, ...); void screen_paint(struct mpdclient *c); void screen_update(struct mpdclient *c); void screen_cmd(struct mpdclient *c, command_t cmd); diff --git a/src/screen_artist.c b/src/screen_artist.c index eb1e449..89fc55e 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -19,6 +19,8 @@ #include "screen_artist.h" #include "screen_interface.h" +#include "screen_message.h" +#include "screen.h" #include "i18n.h" #include "charset.h" #include "mpdclient.h" diff --git a/src/screen_browser.c b/src/screen_browser.c index 9577123..deb9e48 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -21,6 +21,8 @@ #include "screen_file.h" #include "screen_song.h" #include "screen_lyrics.h" +#include "screen_message.h" +#include "screen.h" #include "i18n.h" #include "options.h" #include "charset.h" diff --git a/src/screen_browser.h b/src/screen_browser.h index 57a575b..2b02fbd 100644 --- a/src/screen_browser.h +++ b/src/screen_browser.h @@ -20,7 +20,7 @@ #ifndef SCREEN_BROWSER_H #define SCREEN_BROWSER_H -#include "screen.h" +#include "command.h" #include "config.h" #include diff --git a/src/screen_client.c b/src/screen_client.c index d442cab..2d39a29 100644 --- a/src/screen_client.c +++ b/src/screen_client.c @@ -19,7 +19,7 @@ #include "screen_client.h" #include "screen_utils.h" -#include "screen.h" +#include "screen_message.h" #include "mpdclient.h" #include "i18n.h" #include "charset.h" diff --git a/src/screen_file.c b/src/screen_file.c index 47efc9b..b4dc24d 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -20,6 +20,8 @@ #include "screen_file.h" #include "screen_browser.h" #include "screen_interface.h" +#include "screen_message.h" +#include "screen.h" #include "config.h" #include "i18n.h" #include "charset.h" diff --git a/src/screen_keydef.c b/src/screen_keydef.c index 30f85ac..d93757a 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -19,6 +19,7 @@ #include "screen_keydef.h" #include "screen_interface.h" +#include "screen_message.h" #include "i18n.h" #include "conf.h" #include "screen.h" diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 928a42e..7c3d637 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -19,6 +19,7 @@ #include "screen_lyrics.h" #include "screen_interface.h" +#include "screen_message.h" #include "screen_file.h" #include "screen_song.h" #include "i18n.h" diff --git a/src/screen_message.c b/src/screen_message.c new file mode 100644 index 0000000..99b3deb --- /dev/null +++ b/src/screen_message.c @@ -0,0 +1,42 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2009 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_message.h" +#include "screen.h" + +#include + +void +screen_status_message(const char *msg) +{ + status_bar_message(&screen.status_bar, msg); +} + +void +screen_status_printf(const char *format, ...) +{ + char *msg; + va_list ap; + + va_start(ap,format); + msg = g_strdup_vprintf(format,ap); + va_end(ap); + screen_status_message(msg); + g_free(msg); +} diff --git a/src/screen_message.h b/src/screen_message.h new file mode 100644 index 0000000..4eed37a --- /dev/null +++ b/src/screen_message.h @@ -0,0 +1,29 @@ +/* ncmpc (Ncurses MPD Client) + * (c) 2004-2009 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. + */ + +#ifndef NCMPC_SCREEN_MESSAGE_H +#define NCMPC_SCREEN_MESSAGE_H + +void +screen_status_message(const char *msg); + +void +screen_status_printf(const char *format, ...); + +#endif diff --git a/src/screen_outputs.c b/src/screen_outputs.c index 7f64bd0..cd3a443 100644 --- a/src/screen_outputs.c +++ b/src/screen_outputs.c @@ -19,8 +19,8 @@ #include "screen_outputs.h" #include "screen_interface.h" +#include "screen_message.h" #include "i18n.h" -#include "screen.h" #include "list_window.h" #include "mpdclient.h" diff --git a/src/screen_play.c b/src/screen_play.c index f1af519..39fdf03 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -20,6 +20,7 @@ #include "screen_play.h" #include "screen_interface.h" #include "screen_file.h" +#include "screen_message.h" #include "config.h" #include "i18n.h" #include "charset.h" diff --git a/src/screen_search.c b/src/screen_search.c index d7e49aa..5434738 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -19,6 +19,8 @@ #include "screen_search.h" #include "screen_interface.h" +#include "screen_message.h" +#include "screen.h" #include "i18n.h" #include "options.h" #include "charset.h" diff --git a/src/screen_utils.c b/src/screen_utils.c index 063893e..6cd7232 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -18,6 +18,7 @@ */ #include "screen_utils.h" +#include "screen_message.h" #include "screen.h" #include "mpdclient.h" #include "config.h" -- 2.30.2