parent
6c462332be
commit
2c4f0c273a
16
src/main.c
16
src/main.c
@ -10,31 +10,17 @@ int main(int argc, char *argv[])
|
||||
struct mainWindow *mainWindow;
|
||||
struct mdiary_settings *settings;
|
||||
gchar *settings_path;
|
||||
GtkApplication *app;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
mainWindow = mainWindow_new();
|
||||
app = gtk_application_new(0, G_APPLICATION_FLAGS_NONE);
|
||||
g_application_register(app, NULL, NULL);
|
||||
gtk_application_add_window(app, mainWindow->mainWindow);
|
||||
|
||||
GMenu *app_menu = g_menu_new();
|
||||
GMenu *p1 = g_menu_new();
|
||||
GMenu *p2 = g_menu_new();
|
||||
g_menu_append(p1, "Settings", "win.settings");
|
||||
g_menu_append(p2, "Quit", "win.quit");
|
||||
g_menu_append_section(app_menu, NULL, p1);
|
||||
g_menu_append_section(app_menu, NULL, p2);
|
||||
gtk_application_set_app_menu(app, G_MENU_MODEL(app_menu));
|
||||
|
||||
settings_path = g_strdup_printf("%s/.mdiary.conf", g_get_home_dir());
|
||||
settings = mdiary_settings_new(mainWindow);
|
||||
mdiary_load_settings(settings_path, settings);
|
||||
|
||||
gtk_widget_show(mainWindow->mainWindow);
|
||||
/* gtk_main(); */
|
||||
g_application_run(G_APPLICATION(app), argc, argv);
|
||||
gtk_main();
|
||||
|
||||
mdiary_save_settings(settings_path, settings);
|
||||
mdiary_settings_free(settings);
|
||||
|
Loading…
Reference in New Issue
Block a user