rosenrot/rose.c

37 lines
913 B
C
Raw Normal View History

2022-05-09 21:03:14 +00:00
#include "rose.h"
#include "config.h"
2022-05-10 15:35:37 +00:00
#include "webview.h"
#include "window.h"
2022-05-09 21:03:14 +00:00
#include <stdio.h>
#include <stdlib.h>
static void run(GtkApplication *app)
{
2022-05-10 15:35:37 +00:00
RoseWindow *window = rose_window_new(app);
GtkWidget *webview = rose_webview_new();
2022-05-09 21:03:14 +00:00
2022-05-10 15:35:37 +00:00
if (dark_mode) {
g_object_set(gtk_settings_get_default(), "gtk-application-prefer-dark-theme", true, NULL);
2022-05-10 17:52:56 +00:00
GdkRGBA color = { 0, 0, 0, 1 };
webkit_web_view_get_background_color(WEBKIT_WEB_VIEW(webview), &color);
2022-05-10 15:35:37 +00:00
}
2022-05-09 21:03:14 +00:00
2022-05-10 15:35:37 +00:00
rose_window_set_webview(window, webview);
rose_window_show(window);
2022-05-09 21:03:14 +00:00
if (homepage)
2022-05-10 15:35:37 +00:00
rose_webview_load_url(WEBKIT_WEB_VIEW(webview), homepage);
2022-05-09 21:03:14 +00:00
}
int main(int argc, char **argv)
{
2022-05-10 17:52:56 +00:00
if (argc == 2) {
homepage = argv[1];
argv++; argc--;
}
2022-05-10 18:28:39 +00:00
GtkApplication *app = gtk_application_new("org.gtk.rose", G_APPLICATION_NON_UNIQUE);
2022-05-09 21:03:14 +00:00
g_signal_connect(app, "activate", G_CALLBACK(run), NULL);
g_application_run(G_APPLICATION(app), argc, argv);
}