Just comment config.mk to remove libnotify

This commit is contained in:
Ivan Tham 2016-07-11 17:32:47 +08:00
parent 0e87e7c205
commit f1fe73aff8
3 changed files with 21 additions and 19 deletions

View File

@ -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) */
/*

View File

@ -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

13
spt.c
View File

@ -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,7 +59,6 @@ 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, \
@ -67,10 +66,10 @@ notify_send(char *cmt)
notify_notification_show(n, NULL);
g_object_unref(G_OBJECT(n));
notify_uninit();
#endif /* NOTIFY */
} else if (strcmp(notifycmd, "")) {
#else
if (strcmp(notifycmd, ""))
spawn(notifycmd, cmt);
}
#endif /* NOTIFY */
if (strcmp(notifyext, "")) /* extra commands to use */
spawn(notifyext, NULL);