~ubuntu-branches/ubuntu/utopic/upstart-app-launch/utopic-proposed

« back to all changes in this revision

Viewing changes to upstart-app-watch.c

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Ted Gould, Ubuntu daily release
  • Date: 2013-10-08 10:07:25 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20131008100725-f9tjtjd9za9owijd
Tags: 0.1+13.10.20131008.1-0ubuntu1
[ Ted Gould ]
* On second activations send a message to the FD.o application
  interface. (LP: #1228345)
* Add observers for focused and resume.
* Testing of the second exec logic.
* Disable ZG logging for Phone 1.0.
* Need a little longer time on recent ARM builds.

[ Ubuntu daily release ]
* Automatic snapshot from revision 73

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
        return;
34
34
}
35
35
 
 
36
void
 
37
resume (const gchar * appid, gpointer user_data)
 
38
{
 
39
        g_print("Resume %s\n", appid);
 
40
        return;
 
41
}
 
42
 
 
43
void
 
44
focus (const gchar * appid, gpointer user_data)
 
45
{
 
46
        g_print("Focus  %s\n", appid);
 
47
        return;
 
48
}
 
49
 
 
50
void
 
51
fail (const gchar * appid, upstart_app_launch_app_failed_t failhow, gpointer user_data)
 
52
{
 
53
        const gchar * failstr = "unknown";
 
54
        switch (failhow) {
 
55
                case UPSTART_APP_LAUNCH_APP_FAILED_CRASH:
 
56
                        failstr = "crashed";
 
57
                        break;
 
58
                case UPSTART_APP_LAUNCH_APP_FAILED_START_FAILURE:
 
59
                        failstr = "startup";
 
60
                        break;
 
61
        }
 
62
 
 
63
        g_print("Focus  %s (%s)\n", appid, failstr);
 
64
        return;
 
65
}
 
66
 
 
67
 
36
68
int
37
69
main (int argc, gchar * argv[])
38
70
{
39
71
        upstart_app_launch_observer_add_app_start(started, NULL);
40
72
        upstart_app_launch_observer_add_app_stop(stopped, NULL);
 
73
        upstart_app_launch_observer_add_app_focus(focus, NULL);
 
74
        upstart_app_launch_observer_add_app_resume(resume, NULL);
 
75
        upstart_app_launch_observer_add_app_failed(fail, NULL);
41
76
 
42
77
        GMainLoop * mainloop = g_main_loop_new(NULL, FALSE);
43
78
        g_main_loop_run(mainloop);
44
79
 
45
80
        upstart_app_launch_observer_delete_app_start(started, NULL);
46
81
        upstart_app_launch_observer_delete_app_stop(stopped, NULL);
 
82
        upstart_app_launch_observer_delete_app_focus(focus, NULL);
 
83
        upstart_app_launch_observer_delete_app_resume(resume, NULL);
 
84
        upstart_app_launch_observer_delete_app_failed(fail, NULL);
47
85
 
48
86
        g_main_loop_unref(mainloop);
49
87