Simple logic fixup and prepare for release

- When -D_NOTIFY, notifycmd (-m) will be runned now
- Remove '\n' in buf in display_state() for -m echo
- Remove break; after usage() since die() is called
- Hooray! TODO is clean, everything is nice for now
- Haha, yet another rectangle blocky commit message
This commit is contained in:
Ivan Tham 2016-10-29 13:02:15 +08:00
parent 161f63ae60
commit 4844396830
2 changed files with 13 additions and 17 deletions

6
TODO
View File

@ -1,5 +1 @@
Misc Good luck! Nothing TODO for now.
----
$ grep -n 'TODO' spt.c
# vim:ft=markdown:

24
spt.c
View File

@ -63,16 +63,17 @@ spawn(char *cmd, char *cmt)
void void
notify_send(char *cmt) notify_send(char *cmt)
{ {
#ifdef NOTIFY 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, "")) /* TODO: call function in config.h */
spawn(notifycmd, cmt); spawn(notifycmd, cmt);
#ifdef NOTIFY
else {
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 */ #endif /* NOTIFY */
if (strcmp(notifyext, "")) /* extra commands to use */ if (strcmp(notifyext, "")) /* extra commands to use */
@ -82,9 +83,9 @@ notify_send(char *cmt)
void void
display_state(int remaining, int suspend) display_state(int remaining, int suspend)
{ {
char buf[22]; char buf[21];
snprintf(buf, 22, "Remaining: %02d:%02d %s\n", snprintf(buf, 21, "Remaining: %02d:%02d %s",
remaining / 60, remaining / 60,
remaining % 60, remaining % 60,
(suspend) ? "" : ""); (suspend) ? "" : "");
@ -131,7 +132,6 @@ main(int argc, char *argv[])
"see LICENSE for details\n"); "see LICENSE for details\n");
default: default:
usage(); usage();
break;
} ARGEND; } ARGEND;
/* add SIGUSR1 handler: remaining_time */ /* add SIGUSR1 handler: remaining_time */