Destroy mainwindow on shutdown signal.
Use GTK_DIALOG_DESTROY_WITH_PARENT on preferences dialog.
Remove old gtk_init();