main.cpp 1.02 KB
Newer Older
Moritz Sokoll's avatar
Moritz Sokoll committed
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
36
37
38
39
40
41
42
#include <gtk/gtk.h>
#include <webkit2/webkit2.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include "lib/values.h"

using namespace std;
static void destroy( GtkWidget *widget, gpointer data) { gtk_main_quit(); }

int main(int argc, char* argv[]) {
	GtkWidget* notebook, *window;

	bool gui = true;
	for (int i=0; i<argc; i++) {
		string arg = argv[i];
		if (arg == (string) "-v" || arg== (string) "--version") {
			printf("%s\n", GWEBB_VERSION_STR);
			gui = false;

		}
		else if (arg == (string) "-h" || arg == (string) "--help") {
			printf("%s\n", GWEBB_HELP_STR);
			gui = false;
		}
	}
	if (!gui) {return 0;}
	gtk_init(&argc, &argv);
	notebook = gtk_notebook_new();
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL);

	//adding widgets to their parents if needed
	gtk_container_add(GTK_CONTAINER(window), notebook);

	//displaying the widgets
	gtk_widget_show(window);
	gtk_widget_show(notebook);

	//running the gui application
	gtk_main();
}