Compare commits

..

No commits in common. "main" and "v1.3.3" have entirely different histories.
main ... v1.3.3

9 changed files with 20 additions and 79 deletions

View File

@ -1,6 +1,5 @@
FLAGS = -g -Wall -Wextra -DLOG_USE_COLOR
LD_FLAGS = -lsqlite3 -lpthread
NOTIF_FLAGS = `pkg-config --cflags --libs libnotify`
FLAGS = -g -Wall -Wextra -DLOG_USE_COLOR `pkg-config --cflags --libs libnotify`
LD_FLAGS = -lsqlite3 -lpthread
$(shell mkdir -p out)
@ -12,9 +11,6 @@ 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 $@
@ -24,8 +20,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 out/notification.o
$(CC) $(FLAGS) $(LD_FLAGS) $(NOTIF_FLAGS) $^ -o $@
takl-daemon: out/daemon.o out/db.o out/tasks.o out/utils.o out/log.o
$(CC) $(FLAGS) $(LD_FLAGS) $^ -o $@
install: takl takl-daemon

View File

@ -22,7 +22,6 @@
#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) )

View File

@ -1,11 +1,9 @@
#ifndef DEF_CONFIG_H
#define DEF_CONFIG_H
#define VERSION "1.3.5"
#define VERSION "1.3.3"
#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
#define TMPDIR "/tmp" // Some Unix systems don't use /tmp as tmp dir (eg Android)
#endif

View File

@ -1,10 +0,0 @@
#ifndef DEF_NOTIFICATION_H
#define DEF_NOTIFICATION_H
#include "tasks.h"
/*
Envoyer une notification avec t
*/
void desktop_notification(task_t t);
#endif

View File

@ -29,4 +29,9 @@ 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

View File

@ -1,11 +0,0 @@
#include <libnotify/notify.h>
#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();
}

View File

@ -5,6 +5,7 @@ Fonctions utilitaires concernant les tâches
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <libnotify/notify.h>
#include "include/db.h"
#include "include/struct.h"
@ -130,4 +131,12 @@ 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();
}

View File

@ -19,12 +19,9 @@ char* get_socket_path() {
return socket_path;
} else {
char* base_path = TMPDIR "/takl";
char* base_path = "/tmp/takl";
char* username = getenv("USER");
if (!username)
username = getenv("USERNAME");
assert(username != NULL);
char* socket_path = malloc(sizeof(char)*(strlen(base_path)+strlen(username)+1));

View File

@ -1,42 +0,0 @@
#!/bin/bash
TMPDIR=$(mktemp -d)
#! On ne teste pas que l'on peut bien récupérer ces chemins automatiquement,
#! ce qui peut-être une source d'erreurs
export TAKL_DB="$TMPDIR/takl.sqlite3"
export TAKL_SOCKET="$TMPDIR/takl.socket"
echo "Using $TMPDIR"
make -j
# Catégories
./takl add "nocategory"
./takl add "category1:test1"
# Dates
./takl add "date:avec date" min+5
./takl add "date:avec date2" h+5
./takl add "date:avec date3" j+5
./takl add "date:avec date4" "31/12"
TASK_ID=$(./takl add "done soon" | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' | awk '-F[' '{ print $2 }' | awk '-F]' '{ print $1 }')
# List
./takl list
./takl list date
# Reschedule
./takl reschedule $TASK_ID "22/11"
# Get info
./takl info $TASK_ID
# Mark as done
./takl done $TASK_ID
./takl list -a
./takl rm $TASK_ID
#* À rajouter: tests sur le fait que les changements ont bien eu lieu
rm $TMPDIR -r