~ted/+junk/upstart-app-launch

« back to all changes in this revision

Viewing changes to desktop-exec.c

  • Committer: Ted Gould
  • Date: 2013-05-04 00:47:11 UTC
  • Revision ID: ted@gould.cx-20130504004711-o91bjj2cgrttr06l
Fleshing out desktop exec

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
int
6
6
main (int argc, char * argv[])
7
7
{
8
 
 
9
 
 
 
8
        if (argc != 2) {
 
9
                g_error("Should be called as: %s <app_id>", argv[0]);
 
10
                return 1;
 
11
        }
 
12
 
 
13
        gchar * desktop = g_strdup_printf("%s.desktop", argv[1]);
 
14
        GDesktopAppInfo * appinfo = g_desktop_app_info_new(desktop);
 
15
        g_free(desktop);
 
16
 
 
17
        if (!G_IS_DESKTOP_APP_INFO(appinfo)) {
 
18
                g_error("Unable to load app '%s'", argv[1]);
 
19
                return 1;
 
20
        }
 
21
 
 
22
        g_app_info_launch(G_APP_INFO(appinfo), NULL, NULL, NULL);
 
23
 
 
24
        g_object_unref(appinfo);
10
25
        return 0;
11
26
}