nexmon – Blame information for rev 1

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