-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.cpp
35 lines (25 loc) · 1.14 KB
/
code.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <gtk/gtk.h>
#include <webkit2/webkit2.h>
static gboolean closeWebViewCb(WebKitWebView*, GtkWidget* window) {
gtk_window_destroy(GTK_WINDOW(window));
return TRUE;
}
static void activate (GtkApplication* app, gpointer) {
GtkWidget *window = gtk_application_window_new(app);
gtk_window_set_title (GTK_WINDOW (window), "FooBar in WebKit2Gtk");
gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
WebKitWebView *webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
g_signal_connect(webView, "close", G_CALLBACK(closeWebViewCb), window);
webkit_web_view_load_uri(webView, "https://www.webkitgtk.org/");
// GtkWidget* webView = gtk_button_new_with_label("Fuck Me, It Works");
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET(webView));
gtk_widget_grab_focus(GTK_WIDGET(webView));
gtk_widget_show(window);
}
int main(int argc, char* argv[]) {
GtkApplication *app = gtk_application_new ("app.filesqueezer.example", 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;
}