From 389c123beb48dab2c8a179b86e4f697b6bbd6c4d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 25 Jul 2013 09:13:15 +0200 Subject: introduce config.h --- .gitignore | 1 + Makefile | 6 +++++- config.def.h | 11 +++++++++++ mpd-notification.c | 10 ++-------- 4 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 config.def.h diff --git a/.gitignore b/.gitignore index c4d600f..859d77e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *~ *.o +config.h mpd-notification README.html diff --git a/Makefile b/Makefile index 10b49b8..571417b 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ CC := gcc MD := markdown INSTALL := install +CP := cp RM := rm CFLAGS += -O2 -Wall -Werror CFLAGS += $(shell pkg-config --cflags --libs libmpdclient) \ @@ -11,10 +12,13 @@ VERSION = $(shell git describe --tags --long) all: mpd-notification README.html -mpd-notification: mpd-notification.c +mpd-notification: mpd-notification.c config.h $(CC) $(CFLAGS) -o mpd-notification mpd-notification.c \ -DVERSION="\"$(VERSION)\"" +config.h: + $(CP) config.def.h config.h + README.html: README.md $(MD) README.md > README.html diff --git a/config.def.h b/config.def.h new file mode 100644 index 0000000..0047f7d --- /dev/null +++ b/config.def.h @@ -0,0 +1,11 @@ +/* name of the icon used for notifications */ +#define ICON_SOUND "sound" + +/* strings used to display notification messages + * TEXT_PLAY needs to include three '%s', in order: + * title, artist, album */ +#define TEXT_TOPIC "MPD Notification" +#define TEXT_PLAY "Playing %s\nby %s\nfrom %s" +#define TEXT_PAUSE "Paused playback" +#define TEXT_STOP "Stopped playback" +#define TEXT_UNKNOWN "(unknown)" diff --git a/mpd-notification.c b/mpd-notification.c index 6baa627..6ce248b 100644 --- a/mpd-notification.c +++ b/mpd-notification.c @@ -14,6 +14,8 @@ #include #include +#include "config.h" + #define PROGNAME "mpd-notification" #define NOTIFICATION_TIMEOUT 10000 @@ -21,14 +23,6 @@ #define DEBUG 0 #endif -#define ICON_SOUND "sound" - -#define TEXT_TOPIC "MPD Notification" -#define TEXT_PLAY "Playing %s\nby %s\nfrom %s" -#define TEXT_PAUSE "Paused playback" -#define TEXT_STOP "Stopped playback" -#define TEXT_UNKNOWN "(unknown)" - int main(int argc, char ** argv) { char * album = NULL, * artist = NULL, * notifystr = NULL, * title = NULL; GError * error = NULL; -- cgit v1.2.3-70-g09d2