From 70ffc43d8d3413a8716bb3372080bd44ac2c5ce7 Mon Sep 17 00:00:00 2001 From: Tracker-Friendly Date: Wed, 14 Feb 2024 19:28:06 +0000 Subject: [PATCH] Init --- Makefile | 24 +++++++++++++++++++++++ org.hectabit.Pageburger.json | 23 ++++++++++++++++++++++ pageburger.c | 38 ++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 Makefile create mode 100644 org.hectabit.Pageburger.json create mode 100644 pageburger.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f261938 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +CC = gcc +CFLAGS = -Wall -Wextra -g +PKG_CONFIG = pkg-config +GTK_LIBS = $(shell $(PKG_CONFIG) --libs gtk+-3.0) +WEBKIT_LIBS = $(shell $(PKG_CONFIG) --libs webkit2gtk-4.0) +LIBS = $(GTK_LIBS) $(WEBKIT_LIBS) +INCLUDES = $(shell $(PKG_CONFIG) --cflags gtk+-3.0 webkit2gtk-4.0) + +SRCS = pageburger.c +OBJS = $(SRCS:.c=.o) +TARGET = pageburger + +.PHONY: all clean + +all: $(TARGET) + +$(TARGET): $(OBJS) + $(CC) $(CFLAGS) $(OBJS) -o $(TARGET) $(LIBS) + +%.o: %.c + $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + +clean: + rm -f $(OBJS) $(TARGET) diff --git a/org.hectabit.Pageburger.json b/org.hectabit.Pageburger.json new file mode 100644 index 0000000..185077c --- /dev/null +++ b/org.hectabit.Pageburger.json @@ -0,0 +1,23 @@ +{ + "id": "org.hectabit.PageBurger", + "runtime": "org.gnome.Platform", + "runtime-version": "40", + "sdk": "org.gnome.Sdk", + "command": "pageburger", + "modules": [ + { + "name": "PageBurger", + "buildsystem": "simple", + "sources": [ + { + "type": "git", + "url": "https://centrifuge.hectabit.org/HectaBit/PageBurger-App.git", + "branch": "master" + } + ], + "build-commands": [ + "make" + ] + } + ] +} diff --git a/pageburger.c b/pageburger.c new file mode 100644 index 0000000..24f9c4d --- /dev/null +++ b/pageburger.c @@ -0,0 +1,38 @@ +#include +#include + +static void cookie_changed_cb(WebKitCookieManager *cookie_manager, GParamSpec *pspec, gpointer user_data) { + // Handle cookie changes here + g_print("Cookie changed\n"); +} + +int main(int argc, char *argv[]) { + gtk_init(&argc, &argv); + + // Create a new window + GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "PageBurger"); + gtk_window_set_default_size(GTK_WINDOW(window), 800, 600); + g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); + + // Create a web view widget + WebKitWebView *webview = WEBKIT_WEB_VIEW(webkit_web_view_new()); + + // Load a web page + webkit_web_view_load_uri(webview, "https://notes.hectabit.org/app"); + + // Add the web view to the window + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(webview)); + + // Show all widgets + gtk_widget_show_all(window); + + // Connect signals for handling cookies + WebKitCookieManager *cookie_manager = webkit_web_context_get_cookie_manager(webkit_web_view_get_context(webview)); + g_signal_connect(cookie_manager, "notify::cookie-accept-policy", G_CALLBACK(cookie_changed_cb), NULL); + + // Run the main GTK event loop + gtk_main(); + + return 0; +}