summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE26
-rw-r--r--Makefile16
-rw-r--r--config.mk18
-rw-r--r--sql/0001_init.sql12
-rw-r--r--src/main.c28
5 files changed, 100 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..4883772
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,26 @@
+Copyright 2023 Alessandro Iezzi
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors
+may be used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..de52ef1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,16 @@
+# See LICENSE file for copyright and license details.
+
+include config.mk
+
+${APPNAME}: ${OBJ}
+ ${CC} ${LFLAGS} ${OBJ} -o $@
+
+debug:
+ @make CFLAGS_OPTS=-g ${APPNAME}
+
+.c.o:
+ ${CC} ${CFLAGS} -c $< -o $@
+
+clean:
+ rm -rf ${OBJ}
+ rm -rf ${APPNAME}
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..1ac3221
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,18 @@
+# See LICENSE file for copyright and license details.
+
+APPNAME = timelog
+VERSION = 0.0.0-a1
+
+CC = cc
+SRC != find src -name '*.c'
+OBJ = ${SRC:.c=.o}
+WARN = -Wall
+STD = c11
+LIBS = gtk4
+
+INCLUDES != pkg-config --cflags ${LIBS}
+LIBRARIES != pkg-config --libs ${LIBS}
+
+CFLAGS = ${CFLAGS_OPTS} -std=${STD} ${WARN} ${INCLUDES} \
+ -DVERSION="\"${VERSION}\"" -DAPPNAME="\"${APPNAME}\""
+LFLAGS = ${LFLAGS_OPTS} ${LIBRARIES}
diff --git a/sql/0001_init.sql b/sql/0001_init.sql
new file mode 100644
index 0000000..920f2b4
--- /dev/null
+++ b/sql/0001_init.sql
@@ -0,0 +1,12 @@
+CREATE TABLE timelog (
+ id BIGSERIAL NOT NULL PRIMARY KEY,
+ _start TIMESTAMP,
+ _end TIMESTAMP,
+ description TEXT
+);
+
+CREATE TABLE turnstile (
+ id BIGSERIAL NOT NULL PRIMARY KEY,
+ _datetime TIMESTAMP,
+ direction VARCHAR(4)
+);
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..d8e8285
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,28 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <stdlib.h>
+#include <gtk/gtk.h>
+
+static void
+activate (GtkApplication *app, gpointer user_data)
+{
+ GtkWidget *window = gtk_application_window_new(app);
+ gtk_window_set_title(GTK_WINDOW(window), APPNAME);
+ gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);
+ gtk_widget_set_visible(window, TRUE);
+}
+
+int
+main(int argc, char **argv)
+{
+ GtkApplication *app =
+ gtk_application_new("it.alessandroiezzi.timelog",
+ G_APPLICATION_DEFAULT_FLAGS);
+
+ g_signal_connect(app, "activate", G_CALLBACK (activate), NULL);
+ int status = g_application_run (G_APPLICATION (app), argc, argv);
+
+ g_object_unref (app);
+
+ return status;
+}