GtkApplication *application; BoilerplateWindow *window; GtkWidget *shortcuts_window; application = GTK_APPLICATION (user_data); window = BOILERPLATE_WINDOW (gtk_application_get_active_window (application)); if (shortcuts_window == NULL) { GtkBuilder *builder; builder = gtk_builder_new_from_resource ("/io/github/julianrichen/boilerplate/ui/shortcuts.ui"); shortcuts_window = GTK_WIDGET (gtk_builder_get_object (builder, "shortcuts")); g_signal_connect (shortcuts_window, "destroy", G_CALLBACK (gtk_widget_destroyed), &shortcuts_window); g_object_unref (builder); } if (GTK_WINDOW (window) != gtk_window_get_transient_for (GTK_WINDOW (shortcuts_window))) { gtk_window_set_transient_for (GTK_WINDOW (shortcuts_window), GTK_WINDOW (window)); } gtk_widget_show_all (shortcuts_window); gtk_window_present (GTK_WINDOW (shortcuts_window));