Removed libnotify dependency

This commit is contained in:
Antonio Bibiano 2016-05-03 10:29:46 +10:00
parent cafb6102db
commit d55edcb9b6
3 changed files with 10 additions and 16 deletions

View File

@ -1,7 +1,7 @@
/* See LICENSE file for copyright and license details. */
/* Notification */
static char *notifycmd = "libnotify"; /* Use libnotify or given command */
static char *notifycmd = ""; /* Use libnotify or given command */
static char *notifyext = ""; /* Notify with extra command (eg. play an alarm) */
/*

View File

@ -2,16 +2,16 @@
VERSION = 0.1
# Customize below to fit your system
#USE_LIBNOTIFY = -DUSE_LIBNOTIFY
#LIBNOTIFY_CFLAGS = `pkg-config --cflags libnotify`
#LIBNOTIFY_LIBS = `pkg-config --libs libnotify`
# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
# includes and libs
INCS = -I. -I/usr/include \
`pkg-config --cflags libnotify`
LIBS = -L/usr/lib \
`pkg-config --libs libnotify`
INCS = -I. -I/usr/include ${USE_LIBNOTIFY} ${LIBNOTIFY_CFLAGS}
LIBS = -L/usr/lib ${LIBNOTIFY_LIBSS}
# flags
CPPFLAGS = -DVERSION=\"${VERSION}\"

14
spt.c
View File

@ -6,8 +6,6 @@
#include <unistd.h>
#include <signal.h>
#include <libnotify/notify.h>
#include "arg.h"
char *argv0;
@ -58,13 +56,7 @@ spawn(char *cmd)
void
notify_send(char *cmt)
{
if (!strcmp(notifycmd, "libnotify")) { /* use libnotify */
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, "")) {
if (strcmp(notifycmd, "")) {
/* TODO(pickfire): merge this into spawn() */
if (fork() == 0) {
setsid();
@ -73,6 +65,8 @@ notify_send(char *cmt)
perror(" failed");
exit(0);
}
} else {
fprintf(stdout,"%s\n",cmt);
}
if (strcmp(notifyext, "")) /* extra commands to use */
@ -97,7 +91,7 @@ remaining_time(int sigint)
void
usage(void)
{
die("usage: %s [-e notifyext] [-n notifycmd] [-v]\n", argv0);
die("usage: %s [-n notifycmd] [-e notifyext] [-v]\n", argv0);
}
int