From 994ffdbde3b12429578a33dcf18204b9d813311f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 2 Oct 2008 17:48:00 +0200 Subject: [PATCH] moved i18n macros to i18n.h Don't make everybody include ncmpc.h just to have generic features. Move generic i18n macros to a separate header. --- src/Makefile.am | 1 + src/colors.c | 2 +- src/command.c | 1 + src/conf.c | 2 +- src/i18n.h | 39 +++++++++++++++++++++++++++++++++++++++ src/main.c | 1 + src/ncmpc.h | 19 ------------------- src/screen.c | 1 + src/screen_artist.c | 2 +- src/screen_browser.c | 1 + src/screen_file.c | 2 +- src/screen_help.c | 2 +- src/screen_keydef.c | 2 +- src/screen_lyrics.c | 2 +- src/screen_play.c | 1 + src/screen_search.c | 2 +- src/screen_utils.c | 2 +- src/support.c | 3 ++- 18 files changed, 56 insertions(+), 29 deletions(-) create mode 100644 src/i18n.h diff --git a/src/Makefile.am b/src/Makefile.am index 4cc501c..59af3b5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,6 +32,7 @@ ncmpc_headers = \ utils.h\ ncmpc.h\ defaults.h \ + i18n.h \ screen_browser.h \ lyrics.h \ str_pool.h \ diff --git a/src/colors.c b/src/colors.c index 9f4f6cd..67f3319 100644 --- a/src/colors.c +++ b/src/colors.c @@ -19,7 +19,7 @@ */ #include "colors.h" -#include "ncmpc.h" +#include "i18n.h" #include "options.h" #include diff --git a/src/command.c b/src/command.c index 0ae9033..71ae50e 100644 --- a/src/command.c +++ b/src/command.c @@ -21,6 +21,7 @@ #include "command.h" #include "config.h" #include "ncmpc.h" +#include "i18n.h" #include "mpdclient.h" #include "screen.h" diff --git a/src/conf.c b/src/conf.c index 66f125d..05eb28f 100644 --- a/src/conf.c +++ b/src/conf.c @@ -22,7 +22,7 @@ #include "conf.h" #include "config.h" #include "defaults.h" -#include "ncmpc.h" +#include "i18n.h" #include "support.h" #include "command.h" #include "colors.h" diff --git a/src/i18n.h b/src/i18n.h new file mode 100644 index 0000000..f99505e --- /dev/null +++ b/src/i18n.h @@ -0,0 +1,39 @@ +/* ncmpc + * Copyright (C) 2008 Max Kellermann + * This project's homepage is: http://www.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef I18N_H +#define I18N_H + +#include "config.h" + +/* i18n */ +#ifdef HAVE_LOCALE_H +#include +#endif +#ifdef ENABLE_NLS +#include +#include +#else +#define _(x) x +#define N_(x) x +#endif + +#define YES _("y") +#define NO _("n") + +#endif diff --git a/src/main.c b/src/main.c index f6043d4..641b12e 100644 --- a/src/main.c +++ b/src/main.c @@ -29,6 +29,7 @@ #include "screen.h" #include "screen_utils.h" #include "strfsong.h" +#include "i18n.h" #include "gcc.h" #ifdef ENABLE_LYRICS_SCREEN diff --git a/src/ncmpc.h b/src/ncmpc.h index e7da717..a1cd9f9 100644 --- a/src/ncmpc.h +++ b/src/ncmpc.h @@ -1,25 +1,6 @@ #ifndef NCMPC_H #define NCMPC_H -#ifndef PACKAGE -#include "config.h" -#endif - -/* i18n */ -#ifdef HAVE_LOCALE_H -#include -#endif -#ifdef ENABLE_NLS -#include -#include -#else -#define _(x) x -#define N_(x) x -#endif - -#define YES _("y") -#define NO _("n") - /* welcome message time [s] */ #define SCREEN_WELCOME_TIME 10 diff --git a/src/screen.c b/src/screen.c index d0a3c74..da758b1 100644 --- a/src/screen.c +++ b/src/screen.c @@ -23,6 +23,7 @@ #include "screen_utils.h" #include "config.h" #include "ncmpc.h" +#include "i18n.h" #include "support.h" #include "mpdclient.h" #include "utils.h" diff --git a/src/screen_artist.c b/src/screen_artist.c index 0593fee..351dcf0 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -16,7 +16,7 @@ * */ -#include "ncmpc.h" +#include "i18n.h" #include "options.h" #include "support.h" #include "mpdclient.h" diff --git a/src/screen_browser.c b/src/screen_browser.c index 6d23980..ab10299 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -19,6 +19,7 @@ #include "screen_browser.h" #include "ncmpc.h" +#include "i18n.h" #include "options.h" #include "support.h" #include "strfsong.h" diff --git a/src/screen_file.c b/src/screen_file.c index fa741cd..0e1800a 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -17,7 +17,7 @@ */ #include "config.h" -#include "ncmpc.h" +#include "i18n.h" #include "options.h" #include "support.h" #include "mpdclient.h" diff --git a/src/screen_help.c b/src/screen_help.c index 2637af9..700bc8b 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -17,7 +17,7 @@ */ #include "config.h" -#include "ncmpc.h" +#include "i18n.h" #include "mpdclient.h" #include "command.h" #include "screen.h" diff --git a/src/screen_keydef.c b/src/screen_keydef.c index a37d27d..6e9cb9a 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -16,7 +16,7 @@ * */ -#include "ncmpc.h" +#include "i18n.h" #include "mpdclient.h" #include "options.h" #include "conf.h" diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 83bffdf..927b3dd 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -18,7 +18,7 @@ */ #include -#include "ncmpc.h" +#include "i18n.h" #include "options.h" #include "mpdclient.h" #include "command.h" diff --git a/src/screen_play.c b/src/screen_play.c index 8c564c3..309b9a5 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -18,6 +18,7 @@ #include "config.h" #include "ncmpc.h" +#include "i18n.h" #include "options.h" #include "support.h" #include "mpdclient.h" diff --git a/src/screen_search.c b/src/screen_search.c index 9d80e15..af34baf 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -16,7 +16,7 @@ * */ -#include "ncmpc.h" +#include "i18n.h" #include "options.h" #include "support.h" #include "mpdclient.h" diff --git a/src/screen_utils.c b/src/screen_utils.c index 5dfc426..d830155 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -20,7 +20,7 @@ #include "screen.h" #include "mpdclient.h" #include "config.h" -#include "ncmpc.h" +#include "i18n.h" #include "support.h" #include "options.h" #include "colors.h" diff --git a/src/support.c b/src/support.c index bde8d19..94aab41 100644 --- a/src/support.c +++ b/src/support.c @@ -19,7 +19,8 @@ */ #include "support.h" -#include "ncmpc.h" +#include "i18n.h" +#include "config.h" #include #include -- 2.30.2