-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
41 lines (34 loc) · 848 Bytes
/
main.c
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
#include <gtk/gtk.h>
#include <stdbool.h>
#include <stdlib.h>
#include "database.h"
#include "future.h"
#include "home.h"
#include "past.h"
#include "statistics.h"
bool quit = false;
void quit_program()
{
quit = true;
gtk_main_quit();
}
int main(int argc, char* argv[])
{
gtk_init(&argc, &argv);
GtkBuilder* ui = gtk_builder_new_from_file("main.glade");
GtkWindow* window = GTK_WINDOW(gtk_builder_get_object(ui, "window"));
g_signal_connect(
G_OBJECT(window), "destroy", G_CALLBACK(quit_program), NULL);
db_create_if_missing();
home_main(ui);
past_main(ui);
future_main(ui);
statistics_main(ui);
gtk_widget_show_all(GTK_WIDGET(window));
gtk_main();
g_object_unref(ui);
if (!quit) {
char* const args[] = { "/proc/self/exe", 0 };
execv(args[0], args);
}
}