commit f1fe73aff8015279e6ab1b5b927deac0cf49a8fc
parent 0e87e7c205a8ec1e6153ce46e259ddb8a018006a
Author: Ivan Tham <pickfire@riseup.net>
Date: Mon, 11 Jul 2016 17:32:47 +0800
Just comment config.mk to remove libnotify
Diffstat:
3 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -1,7 +1,7 @@
/* See LICENSE file for copyright and license details. */
-/* Notification, replace libnotify if you don't want it */
-static char *notifycmd = "libnotify"; /* Use libnotify or command given*/
+/* Notification, remove DNOTIFY in config.mk if you don't want it */
+static char *notifycmd = ""; /* Uses given command if not compiled by DNOTIFY */
static char *notifyext = ""; /* Notify with extra command (eg. play an alarm) */
/*
diff --git a/config.mk b/config.mk
@@ -7,10 +7,13 @@ VERSION = 0.1
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
-# libnotify - comment if you don't want it (config.h too)
-INCS = -I. -I/usr/include `pkg-config --cflags libnotify`
-LIBS = -L/usr/lib `pkg-config --libs libnotify`
+INCS = -I. -I/usr/include
+LIBS = -L/usr/lib
+
+# libnotify, comment if you don't want it
DEFS = -DNOTIFY
+INCS+= `pkg-config --cflags libnotify`
+LIBS+= `pkg-config --libs libnotify`
# flags
CPPFLAGS = -DVERSION=\"${VERSION}\"
@@ -18,4 +21,4 @@ CFLAGS += -g -std=c99 -pedantic -Wall -Os ${INCS} ${DEFS} ${CPPFLAGS}
LDFLAGS += -g ${LIBS}
# compiler and linker
-# CC = cc
+CC ?= cc
diff --git a/spt.c b/spt.c
@@ -27,9 +27,9 @@ static int i, timecount;
/* function declarations */
static void die(const char *errstr, ...);
-static void spawn(char *, char *);
-static void notify_send(char *);
-static void remaining_time(int);
+static void spawn(char *cmd, char *cmt);
+static void notify_send(char *cmt);
+static void remaining_time(int sigint);
static void usage(void);
/* functions implementations */
@@ -59,18 +59,17 @@ spawn(char *cmd, char *cmt)
void
notify_send(char *cmt)
{
- if (!strcmp(notifycmd, "libnotify")) { /* use libnotify */
#ifdef NOTIFY
- notify_init("spt");
- NotifyNotification *n = notify_notification_new("spt", cmt, \
- "dialog-information");
- notify_notification_show(n, NULL);
- g_object_unref(G_OBJECT(n));
- notify_uninit();
-#endif /* NOTIFY */
- } else if (strcmp(notifycmd, "")) {
+ notify_init("spt");
+ NotifyNotification *n = notify_notification_new("spt", cmt, \
+ "dialog-information");
+ notify_notification_show(n, NULL);
+ g_object_unref(G_OBJECT(n));
+ notify_uninit();
+#else
+ if (strcmp(notifycmd, ""))
spawn(notifycmd, cmt);
- }
+#endif /* NOTIFY */
if (strcmp(notifyext, "")) /* extra commands to use */
spawn(notifyext, NULL);