Code

screen: moved screen_interface externs to each screen header
authorMax Kellermann <max@duempel.org>
Thu, 1 Oct 2009 17:40:49 +0000 (19:40 +0200)
committerMax Kellermann <max@duempel.org>
Thu, 1 Oct 2009 17:40:49 +0000 (19:40 +0200)
Make a header for each screen implementation.

24 files changed:
Makefile.am
src/screen.c
src/screen.h
src/screen_artist.c
src/screen_artist.h [new file with mode: 0644]
src/screen_browser.c
src/screen_file.c
src/screen_file.h
src/screen_help.c
src/screen_help.h [new file with mode: 0644]
src/screen_keydef.c
src/screen_keydef.h [new file with mode: 0644]
src/screen_list.c
src/screen_list.h
src/screen_lyrics.c
src/screen_lyrics.h [new file with mode: 0644]
src/screen_outputs.c
src/screen_outputs.h [new file with mode: 0644]
src/screen_play.c
src/screen_play.h
src/screen_search.c
src/screen_search.h [new file with mode: 0644]
src/screen_song.c
src/screen_song.h [new file with mode: 0644]

index 91c83b2961475c470a8b2f895684706315d9ac63..65620e339a240f68ee4812583e81482c41b51c36 100644 (file)
@@ -28,7 +28,6 @@ ncmpc_headers = \
        src/screen.h \
        src/screen_interface.h \
        src/screen_list.h \
-       src/screen_play.h \
        src/screen_utils.h \
        src/screen_client.h \
        src/list_window.h \
@@ -42,8 +41,16 @@ ncmpc_headers = \
        src/ncmpc.h \
        src/defaults.h \
        src/i18n.h \
+       src/screen_help.h \
+       src/screen_play.h \
        src/screen_file.h \
+       src/screen_artist.h \
        src/screen_browser.h \
+       src/screen_search.h \
+       src/screen_song.h \
+       src/screen_keydef.h \
+       src/screen_lyrics.h \
+       src/screen_outputs.h \
        src/screen_text.h \
        src/plugin.h \
        src/lyrics.h \
index 34330ff7a3c8c82472f49a3ee51276660587df2a..cf995383cf361dc0dae0f14e0b517f46ed44675d 100644 (file)
 #include "options.h"
 #include "colors.h"
 #include "player_command.h"
+#include "screen_help.h"
+#include "screen_play.h"
+#include "screen_file.h"
+#include "screen_artist.h"
+#include "screen_search.h"
+#include "screen_song.h"
+#include "screen_keydef.h"
+#include "screen_lyrics.h"
+#include "screen_outputs.h"
 
 #include <mpd/client.h>
 
index b20a6c9449f1a18459ae95fd7e7573833398b6b1..a78ae51a3ce397ad669841e92cd2f91bd339d94b 100644 (file)
@@ -44,6 +44,7 @@
 #define MAX_SONGNAME_LENGTH   512
 
 struct mpdclient;
+struct screen_functions;
 
 struct screen {
        struct title_bar title_bar;
@@ -65,28 +66,6 @@ struct screen {
 
 extern struct screen screen;
 
-extern const struct screen_functions screen_playlist;
-extern const struct screen_functions screen_browse;
-#ifdef ENABLE_ARTIST_SCREEN
-extern const struct screen_functions screen_artist;
-#endif
-extern const struct screen_functions screen_help;
-#ifdef ENABLE_SEARCH_SCREEN
-extern const struct screen_functions screen_search;
-#endif
-#ifdef ENABLE_SONG_SCREEN
-extern const struct screen_functions screen_song;
-#endif
-#ifdef ENABLE_KEYDEF_SCREEN
-extern const struct screen_functions screen_keydef;
-#endif
-#ifdef ENABLE_LYRICS_SCREEN
-extern const struct screen_functions screen_lyrics;
-#endif
-#ifdef ENABLE_OUTPUTS_SCREEN
-extern const struct screen_functions screen_outputs;
-#endif
-
 void screen_init(struct mpdclient *c);
 void screen_exit(void);
 void screen_resize(struct mpdclient *c);
@@ -109,14 +88,4 @@ screen_is_visible(const struct screen_functions *sf);
 int
 screen_get_mouse_event(struct mpdclient *c, unsigned long *bstate, int *row);
 
-#ifdef ENABLE_SONG_SCREEN
-void
-screen_song_switch(struct mpdclient *c, const struct mpd_song *song);
-#endif
-
-#ifdef ENABLE_LYRICS_SCREEN
-void
-screen_lyrics_switch(struct mpdclient *c, const struct mpd_song *song, bool follow);
-#endif
-
 #endif
index d3c182233c9c0ef95b67fb74981c5e25b5ba7d88..eb1e449f491f29159f0a60acac2af32a705c74df 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#include "screen_artist.h"
+#include "screen_interface.h"
 #include "i18n.h"
-#include "options.h"
 #include "charset.h"
 #include "mpdclient.h"
-#include "utils.h"
-#include "strfsong.h"
-#include "command.h"
-#include "screen_interface.h"
 #include "screen_utils.h"
 #include "screen_browser.h"
 #include "filelist.h"
 
-#include <ctype.h>
-#include <stdlib.h>
+#include <assert.h>
 #include <string.h>
 #include <glib.h>
 
diff --git a/src/screen_artist.h b/src/screen_artist.h
new file mode 100644 (file)
index 0000000..60ebd9b
--- /dev/null
@@ -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_ARTIST_H
+#define NCMPC_SCREEN_ARTIST_H
+
+#include "config.h"
+
+#ifdef ENABLE_ARTIST_SCREEN
+extern const struct screen_functions screen_artist;
+#endif
+
+#endif
index 65fefbde084b3bde244d218aac241f150f86b9cf..95771234e06a915baf063eb3ab86c1bcfbc9658e 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "screen_browser.h"
 #include "screen_file.h"
+#include "screen_song.h"
+#include "screen_lyrics.h"
 #include "i18n.h"
 #include "options.h"
 #include "charset.h"
index 53997a5ed8109196827f163a8f3efe560627361d..47efc9b399c8d9620236d6dc48293f45933fe5c0 100644 (file)
 */
 
 #include "screen_file.h"
+#include "screen_browser.h"
 #include "screen_interface.h"
 #include "config.h"
 #include "i18n.h"
-#include "options.h"
 #include "charset.h"
 #include "mpdclient.h"
 #include "filelist.h"
-#include "command.h"
 #include "screen_utils.h"
-#include "screen_browser.h"
 #include "screen_play.h"
 #include "screen_client.h"
 
index 775bc616b1ce77ddbb11cc685ee62fcc5c5894a2..c2e640c698f3da4630923759d4e75ee20fc053e3 100644 (file)
@@ -25,6 +25,8 @@
 struct mpdclient;
 struct mpd_song;
 
+extern const struct screen_functions screen_browse;
+
 bool
 screen_file_goto_song(struct mpdclient *c, const struct mpd_song *song);
 
index 5aa579f9bac7dd2b1e1b7d9673da8e452f8bb5d1..042478a0617287d6ed4f50edc72df3ba2acd99d0 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#include "screen_help.h"
 #include "screen_interface.h"
 #include "config.h"
 #include "i18n.h"
-#include "mpdclient.h"
-#include "command.h"
 #include "screen_utils.h"
 
-#include <stdlib.h>
-#include <string.h>
 #include <glib.h>
 
 typedef struct {
diff --git a/src/screen_help.h b/src/screen_help.h
new file mode 100644 (file)
index 0000000..6323e33
--- /dev/null
@@ -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_HELP_H
+#define NCMPC_SCREEN_HELP_H
+
+#include "config.h"
+
+#ifdef ENABLE_HELP_SCREEN
+extern const struct screen_functions screen_help;
+#endif
+
+#endif
index 5809cd278e46f49fe3313d0d91c5d8d7a16e4caf..30f85ac76e18f378dc4dcc45379cf89e3bf705e5 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#include "screen_keydef.h"
 #include "screen_interface.h"
 #include "i18n.h"
-#include "mpdclient.h"
-#include "options.h"
 #include "conf.h"
-#include "command.h"
 #include "screen.h"
 #include "screen_utils.h"
 
 #include <errno.h>
-#include <stdlib.h>
 #include <string.h>
 #include <glib.h>
 
diff --git a/src/screen_keydef.h b/src/screen_keydef.h
new file mode 100644 (file)
index 0000000..2eb2444
--- /dev/null
@@ -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_KEYDEF_H
+#define NCMPC_SCREEN_KEYDEF_H
+
+#include "config.h"
+
+#ifdef ENABLE_KEYDEF_SCREEN
+extern const struct screen_functions screen_keydef;
+#endif /* ENABLE_KEYDEF_SCREEN */
+
+#endif
index 49f6037800cf2812d62777929e11706bdc568f16..8f218a14fd9ffe834e140e6640b608d93d698712 100644 (file)
 #include "screen_list.h"
 #include "screen_interface.h"
 #include "screen.h"
+#include "screen_help.h"
+#include "screen_play.h"
+#include "screen_file.h"
+#include "screen_artist.h"
+#include "screen_search.h"
+#include "screen_song.h"
+#include "screen_keydef.h"
+#include "screen_lyrics.h"
+#include "screen_outputs.h"
 
 #include <string.h>
 
index 2f9cffdc4275f99c4ba959a22e749e0e540da11e..9f6c926d1660711c1c1875160da3898c24072e79 100644 (file)
 #include <ncurses.h>
 #endif
 
-extern const struct screen_functions screen_playlist;
-extern const struct screen_functions screen_browse;
-#ifdef ENABLE_ARTIST_SCREEN
-extern const struct screen_functions screen_artist;
-#endif
-extern const struct screen_functions screen_help;
-#ifdef ENABLE_SEARCH_SCREEN
-extern const struct screen_functions screen_search;
-#endif
-#ifdef ENABLE_SONG_SCREEN
-extern const struct screen_functions screen_song;
-#endif
-#ifdef ENABLE_KEYDEF_SCREEN
-extern const struct screen_functions screen_keydef;
-#endif
-#ifdef ENABLE_LYRICS_SCREEN
-extern const struct screen_functions screen_lyrics;
-#endif
-#ifdef ENABLE_OUTPUTS_SCREEN
-extern const struct screen_functions screen_outputs;
-#endif
-
+struct screen_functions;
 
 void
 screen_list_init(WINDOW *w, unsigned cols, unsigned rows);
index 054ac6281df2c5dbaa5fca794d77bbdb4a27aab8..928a42ec22fafb2deb966cbe77e3ace3115964ec 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#include "screen_lyrics.h"
 #include "screen_interface.h"
 #include "screen_file.h"
+#include "screen_song.h"
 #include "i18n.h"
 #include "options.h"
 #include "mpdclient.h"
-#include "command.h"
 #include "screen.h"
 #include "lyrics.h"
 #include "screen_text.h"
 
+#include <assert.h>
 #include <sys/stat.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/screen_lyrics.h b/src/screen_lyrics.h
new file mode 100644 (file)
index 0000000..4975165
--- /dev/null
@@ -0,0 +1,40 @@
+/* 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_LYRICS_H
+#define NCMPC_SCREEN_LYRICS_H
+
+#include "config.h"
+
+#ifdef ENABLE_LYRICS_SCREEN
+
+#include <stdbool.h>
+
+struct mpdclient;
+struct mpd_song;
+
+extern const struct screen_functions screen_lyrics;
+
+void
+screen_lyrics_switch(struct mpdclient *c, const struct mpd_song *song,
+                    bool follow);
+
+#endif /* ENABLE_LYRICS_SCREEN */
+
+#endif
index 75b9790b460398e86daaeb5e7f0f5dbe5f1af052..7f64bd0fc49a919ce2126ee3aa7c531905175a81 100644 (file)
@@ -17,6 +17,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#include "screen_outputs.h"
 #include "screen_interface.h"
 #include "i18n.h"
 #include "screen.h"
diff --git a/src/screen_outputs.h b/src/screen_outputs.h
new file mode 100644 (file)
index 0000000..36a0332
--- /dev/null
@@ -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_OUTPUTS_H
+#define NCMPC_SCREEN_OUTPUTS_H
+
+#include "config.h"
+
+#ifdef ENABLE_OUTPUTS_SCREEN
+extern const struct screen_functions screen_outputs;
+#endif /* ENABLE_OUTPUTS_SCREEN */
+
+#endif
index bd830bac23785ecf735d21c3bbd52da483f7c7c6..ceb13616662197b076a0316e9fdfbb3dc735a971 100644 (file)
@@ -17,8 +17,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#include "screen_file.h"
+#include "screen_play.h"
 #include "screen_interface.h"
+#include "screen_file.h"
 #include "config.h"
 #include "i18n.h"
 #include "charset.h"
 #include "utils.h"
 #include "strfsong.h"
 #include "wreadln.h"
-#include "command.h"
 #include "colors.h"
 #include "screen.h"
 #include "screen_utils.h"
-#include "screen_play.h"
+#include "screen_song.h"
+#include "screen_lyrics.h"
 
 #ifndef NCMPC_MINI
 #include "hscroll.h"
@@ -40,9 +41,7 @@
 #include <mpd/client.h>
 
 #include <ctype.h>
-#include <stdlib.h>
 #include <string.h>
-#include <time.h>
 #include <glib.h>
 
 #define MAX_SONG_LENGTH 512
index 3cccfb8a7da9b0c6ec7a25e9732821dba686a568..9c77677ea7dcba89576a30d2c94b180cd1f9c735 100644 (file)
@@ -1,21 +1,30 @@
 /* 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_PLAY_H
+#define NCMPC_SCREEN_PLAY_H
+
+struct mpdclient;
+
+extern const struct screen_functions screen_playlist;
 
 int
 playlist_save(struct mpdclient *c, char *name, char *defaultname);
+
+#endif
index 66b05b54b6b8e94b48df4a9894c17536a011598d..d7e49aadea5960de2b88afe0e4322a95fe435790 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#include "screen_search.h"
 #include "screen_interface.h"
 #include "i18n.h"
 #include "options.h"
 #include "charset.h"
 #include "mpdclient.h"
 #include "strfsong.h"
-#include "command.h"
 #include "utils.h"
 #include "screen_utils.h"
 #include "screen_browser.h"
 #include "filelist.h"
 
-#include <ctype.h>
-#include <stdlib.h>
 #include <string.h>
 #include <glib.h>
 
diff --git a/src/screen_search.h b/src/screen_search.h
new file mode 100644 (file)
index 0000000..3c807ed
--- /dev/null
@@ -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_SEARCH_H
+#define NCMPC_SCREEN_SEARCH_H
+
+#include "config.h"
+
+#ifdef ENABLE_SEARCH_SCREEN
+extern const struct screen_functions screen_search;
+#endif
+
+#endif
index 7b6ec6fbd5f8ca90ccd9e9b896675398fb04633b..eeb2f1129cf8b2a3019fe577a4927646f7f3b4a4 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#include "screen_song.h"
 #include "screen_interface.h"
 #include "screen_file.h"
+#include "screen_lyrics.h"
 #include "i18n.h"
 #include "screen.h"
 #include "screen_utils.h"
diff --git a/src/screen_song.h b/src/screen_song.h
new file mode 100644 (file)
index 0000000..ac229af
--- /dev/null
@@ -0,0 +1,37 @@
+/* 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_SONG_H
+#define NCMPC_SCREEN_SONG_H
+
+#include "config.h"
+
+#ifdef ENABLE_SONG_SCREEN
+
+struct mpdclient;
+struct mpd_song;
+
+extern const struct screen_functions screen_song;
+
+void
+screen_song_switch(struct mpdclient *c, const struct mpd_song *song);
+
+#endif /* ENABLE_SONG_SCREEN */
+
+#endif