6 activate (GApplication *application)
8 g_application_hold (application);
9 g_print ("activated\n");
10 g_application_release (application);
14 show_help (GSimpleAction *action,
18 g_print ("Want help, eh ?!\n");
22 show_about (GSimpleAction *action,
26 g_print ("Not much to say, really.\nJust a stupid example\n");
30 quit_app (GSimpleAction *action,
34 g_print ("Quitting...\n");
35 g_application_release (g_application_get_default ());
38 static GActionEntry entries[] = {
39 { "help", show_help, NULL, NULL, NULL },
40 { "about", show_about, NULL, NULL, NULL },
41 { "quit", quit_app, NULL, NULL, NULL }
45 add_actions (GApplication *app)
47 g_action_map_add_action_entries (G_ACTION_MAP (app),
48 entries, G_N_ELEMENTS (entries),
53 add_menu (GApplication *app)
59 g_menu_append (menu, "Help", "help");
60 g_menu_append (menu, "About Example", "about");
61 g_menu_append (menu, "Quit", "quit");
63 g_application_set_app_menu (app, G_MENU_MODEL (menu));
65 g_object_unref (menu);
69 main (int argc, char **argv)
74 app = g_application_new ("org.gtk.TestApplication", 0);
75 g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
80 g_application_hold (app);
82 status = g_application_run (app, argc, argv);