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. */ /* See LICENSE file for copyright and license details. */
/* Notification, replace libnotify if you don't want it */ /* Notification, remove DNOTIFY in config.mk if you don't want it */
static char *notifycmd = "libnotify"; /* Use libnotify or command given*/ static char *notifycmd = ""; /* Uses given command if not compiled by DNOTIFY */
static char *notifyext = ""; /* Notify with extra command (eg. play an alarm) */ static char *notifyext = ""; /* Notify with extra command (eg. play an alarm) */
/* /*

View File

@ -7,10 +7,13 @@ VERSION = 0.1
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man MANPREFIX = ${PREFIX}/share/man
# libnotify - comment if you don't want it (config.h too) INCS = -I. -I/usr/include
INCS = -I. -I/usr/include `pkg-config --cflags libnotify` LIBS = -L/usr/lib
LIBS = -L/usr/lib `pkg-config --libs libnotify`
# libnotify, comment if you don't want it
DEFS = -DNOTIFY DEFS = -DNOTIFY
INCS+= `pkg-config --cflags libnotify`
LIBS+= `pkg-config --libs libnotify`
# flags # flags
CPPFLAGS = -DVERSION=\"${VERSION}\" CPPFLAGS = -DVERSION=\"${VERSION}\"
@ -18,4 +21,4 @@ CFLAGS += -g -std=c99 -pedantic -Wall -Os ${INCS} ${DEFS} ${CPPFLAGS}
LDFLAGS += -g ${LIBS} LDFLAGS += -g ${LIBS}
# compiler and linker # compiler and linker
# CC = cc CC ?= cc

25
spt.c
View File

@ -27,9 +27,9 @@ static int i, timecount;
/* function declarations */ /* function declarations */
static void die(const char *errstr, ...); static void die(const char *errstr, ...);
static void spawn(char *, char *); static void spawn(char *cmd, char *cmt);
static void notify_send(char *); static void notify_send(char *cmt);
static void remaining_time(int); static void remaining_time(int sigint);
static void usage(void); static void usage(void);
/* functions implementations */ /* functions implementations */
@ -59,18 +59,17 @@ spawn(char *cmd, char *cmt)
void void
notify_send(char *cmt) notify_send(char *cmt)
{ {
if (!strcmp(notifycmd, "libnotify")) { /* use libnotify */
#ifdef NOTIFY #ifdef NOTIFY
notify_init("spt"); notify_init("spt");
NotifyNotification *n = notify_notification_new("spt", cmt, \ NotifyNotification *n = notify_notification_new("spt", cmt, \
"dialog-information"); "dialog-information");
notify_notification_show(n, NULL); notify_notification_show(n, NULL);
g_object_unref(G_OBJECT(n)); g_object_unref(G_OBJECT(n));
notify_uninit(); notify_uninit();
#endif /* NOTIFY */ #else
} else if (strcmp(notifycmd, "")) { if (strcmp(notifycmd, ""))
spawn(notifycmd, cmt); spawn(notifycmd, cmt);
} #endif /* NOTIFY */
if (strcmp(notifyext, "")) /* extra commands to use */ if (strcmp(notifyext, "")) /* extra commands to use */
spawn(notifyext, NULL); spawn(notifyext, NULL);