From faa06072f360bb9679870ed3b7c1933c6c3f5877 Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Sat, 18 Feb 2017 15:21:34 +0100 Subject: [PATCH] Changed to GtkApplication --- src/main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 050f6b0..662653c 100644 --- a/src/main.c +++ b/src/main.c @@ -5,14 +5,12 @@ #include "mdiary.h" #include "settings.h" -int main(int argc, char *argv[]) +static void activate(GApplication *app, gpointer user_data) { struct mainWindow *mainWindow; struct mdiary_settings *settings; gchar *settings_path; - gtk_init(&argc, &argv); - mainWindow = mainWindow_new(); settings_path = g_strdup_printf("%s/.mdiary.conf", g_get_home_dir()); @@ -28,3 +26,14 @@ int main(int argc, char *argv[]) return 0; } + +int main(int argc, char *argv[]) +{ + GtkApplication *app; + int status; + + app = gtk_application_new("net.notsyncing.mdiary", G_APPLICATION_FLAGS_NONE); + g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); + status = g_application_run(G_APPLICATION(app), argc, argv); + g_object_unref(app); +}