diff --git a/Makefile b/Makefile index d0290b3..9b54c16 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ -FLAGS = -g -Wall -Wextra -DLOG_USE_COLOR `pkg-config --cflags --libs libnotify` -LD_FLAGS = -lsqlite3 -lpthread +FLAGS = -g -Wall -Wextra -DLOG_USE_COLOR +LD_FLAGS = -lsqlite3 -lpthread +NOTIF_FLAGS = `pkg-config --cflags --libs libnotify` $(shell mkdir -p out) @@ -11,6 +12,9 @@ all: takl takl-daemon out/%.o: src/%.c $(CC) -c $(FLAGS) $^ -o $@ +out/notification.o: src/main/notification.c + $(CC) -c $(FLAGS) $(NOTIF_FLAGS) $^ -o $@ + out/%.o: src/main/%.c $(CC) -c $(FLAGS) $^ -o $@ @@ -20,8 +24,8 @@ out/%.o: src/log/%.c takl: out/main.o out/db.o out/tasks.o out/utils.o $(CC) $(FLAGS) $(LD_FLAGS) $^ -o $@ -takl-daemon: out/daemon.o out/db.o out/tasks.o out/utils.o out/log.o - $(CC) $(FLAGS) $(LD_FLAGS) $^ -o $@ +takl-daemon: out/daemon.o out/db.o out/tasks.o out/utils.o out/log.o out/notification.o + $(CC) $(FLAGS) $(LD_FLAGS) $(NOTIF_FLAGS) $^ -o $@ install: takl takl-daemon diff --git a/src/daemon.c b/src/daemon.c index ef8515a..f6ce7c5 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -22,6 +22,7 @@ #include "main/include/utils.h" #include "main/include/colors.h" #include "main/include/config.h" +#include "main/include/notification.h" #define EVENT_SIZE ( sizeof (struct inotify_event) ) diff --git a/src/main/include/config.h b/src/main/include/config.h index 34a65c3..9b9f1f6 100644 --- a/src/main/include/config.h +++ b/src/main/include/config.h @@ -1,7 +1,7 @@ #ifndef DEF_CONFIG_H #define DEF_CONFIG_H -#define VERSION "1.3.3" +#define VERSION "1.3.4" #define MAX_TASK_ID 10000 // max is set to MAX_TASK_ID-1 #define NEW_TASK_ID_MAX_RETRIES 10000 // number of retries before giving up diff --git a/src/main/include/notification.h b/src/main/include/notification.h new file mode 100644 index 0000000..a521a8a --- /dev/null +++ b/src/main/include/notification.h @@ -0,0 +1,10 @@ +#ifndef DEF_NOTIFICATION_H +#define DEF_NOTIFICATION_H + +#include "tasks.h" +/* +Envoyer une notification avec t +*/ +void desktop_notification(task_t t); + +#endif \ No newline at end of file diff --git a/src/main/include/tasks.h b/src/main/include/tasks.h index 2087b52..c44bca2 100644 --- a/src/main/include/tasks.h +++ b/src/main/include/tasks.h @@ -29,9 +29,4 @@ Libère la mémoire allouée à une liste de tâches */ void free_task_list(task_list_t* list); -/* -Envoyer une notification avec t -*/ -void desktop_notification(task_t t); - #endif \ No newline at end of file diff --git a/src/main/notification.c b/src/main/notification.c new file mode 100644 index 0000000..826d0f2 --- /dev/null +++ b/src/main/notification.c @@ -0,0 +1,11 @@ +#include + +#include "include/notification.h" + +void desktop_notification(task_t t) { + notify_init ("TaKl"); + NotifyNotification * Notif = notify_notification_new ("TaKl Daemon", t.text, "dialog-information"); + notify_notification_show (Notif, NULL); + g_object_unref(G_OBJECT(Notif)); + notify_uninit(); +} \ No newline at end of file diff --git a/src/main/tasks.c b/src/main/tasks.c index 1adf2a6..0ca5dd5 100644 --- a/src/main/tasks.c +++ b/src/main/tasks.c @@ -5,7 +5,6 @@ Fonctions utilitaires concernant les tâches #include #include #include -#include #include "include/db.h" #include "include/struct.h" @@ -131,12 +130,4 @@ void free_task_list(task_list_t* list) { free(list); list = next; } -} - -void desktop_notification(task_t t) { - notify_init ("TaKl"); - NotifyNotification * Notif = notify_notification_new ("TaKl Daemon", t.text, "dialog-information"); - notify_notification_show (Notif, NULL); - g_object_unref(G_OBJECT(Notif)); - notify_uninit(); } \ No newline at end of file