Branch data Line data Source code
1 : : #include <gio/gio.h> 2 : : #include <stdlib.h> 3 : : #include <string.h> 4 : : 5 : : static int 6 : 0 : command_line (GApplication *application, 7 : : GApplicationCommandLine *cmdline) 8 : : { 9 : : gchar **argv; 10 : : gint argc; 11 : : gint i; 12 : : 13 : 0 : argv = g_application_command_line_get_arguments (cmdline, &argc); 14 : : 15 : 0 : g_application_command_line_print (cmdline, 16 : : "This text is written back\n" 17 : : "to stdout of the caller\n"); 18 : : 19 [ # # ]: 0 : for (i = 0; i < argc; i++) 20 : 0 : g_print ("argument %d: %s\n", i, argv[i]); 21 : : 22 : 0 : g_strfreev (argv); 23 : : 24 : 0 : return 0; 25 : : } 26 : : 27 : : int 28 : 0 : main (int argc, char **argv) 29 : : { 30 : : GApplication *app; 31 : : int status; 32 : : 33 : 0 : app = g_application_new ("org.gtk.TestApplication", 34 : : G_APPLICATION_HANDLES_COMMAND_LINE); 35 : 0 : g_signal_connect (app, "command-line", G_CALLBACK (command_line), NULL); 36 : 0 : g_application_set_inactivity_timeout (app, 10000); 37 : 0 : g_application_set_version (app, "2.3"); 38 : : 39 : 0 : status = g_application_run (app, argc, argv); 40 : : 41 : 0 : g_object_unref (app); 42 : : 43 : 0 : return status; 44 : : }