#include <gtk/gtk.h>
#include <stdio.h>

int main(int argc, char **argv)
{
	gtk_init(&argc, &argv);

	// ShortcutsShortcut
	GtkWidget *const shortcut = g_object_new(
		GTK_TYPE_SHORTCUTS_SHORTCUT,
		"accelerator", "<Ctrl>R",
		"title", "ShortcutsShortcut",
		"subtitle", "Do some stuff.",
		NULL
	);

	// ShortcutsGroup
	GtkWidget *const shortcutsGroup = g_object_new(
		GTK_TYPE_SHORTCUTS_GROUP,
		"title", "ShortcutsGroup",
		NULL
	);
	gtk_container_add(GTK_CONTAINER(shortcutsGroup), shortcut);

	// ShortcutsSection
	GtkWidget *const shortcutsSection = g_object_new(
		GTK_TYPE_SHORTCUTS_SECTION,
		"title", "ShortcutsSection",
		"section-name", "the-section",
		NULL
	);
	//
	// !!
	// Manually show()ing the Section is mandatory, BEFORE adding to the Window,
	//	otherwise the Window opens on Search Results with no way out.
	// N.B.: Tests with >1 Section indicated that only 1 must be manually show()n.
	//
	if (argc == 2 && argv[1][0] == 'Y') {
		gtk_widget_show(shortcutsSection);
	}
	//
	// !!
	//
	gtk_container_add(GTK_CONTAINER(shortcutsSection), shortcutsGroup);

	// ShortcutsWindow
	GtkWidget *const shortcutsWindow = g_object_new(
		GTK_TYPE_SHORTCUTS_WINDOW,
		"title", "ShortcutsWindow",
		NULL
	);
	gtk_container_add(GTK_CONTAINER(shortcutsWindow), shortcutsSection);

	// Run
	g_signal_connect(G_OBJECT(shortcutsWindow), "delete-event",
				G_CALLBACK(&gtk_main_quit), NULL);
	gtk_widget_show_all(shortcutsWindow);
	gtk_main();
}
