2 #include <gio/gdesktopappinfo.h>
6 print (const gchar *str)
8 g_print ("%s\n", str ? str : "nil");
12 main (int argc, char **argv)
14 setlocale (LC_ALL, "");
18 else if (g_str_equal (argv[1], "list"))
22 all = g_app_info_get_all ();
23 for (i = all; i; i = i->next)
24 g_print ("%s%s", g_app_info_get_id (i->data), i->next ? " " : "\n");
25 g_list_free_full (all, g_object_unref);
27 else if (g_str_equal (argv[1], "search"))
32 results = g_desktop_app_info_search (argv[2]);
33 for (i = 0; results[i]; i++)
35 for (j = 0; results[i][j]; j++)
36 g_print ("%s%s", j ? " " : "", results[i][j]);
38 g_strfreev (results[i]);
42 else if (g_str_equal (argv[1], "show-info"))
46 info = (GAppInfo *) g_desktop_app_info_new (argv[2]);
49 print (g_app_info_get_id (info));
50 print (g_app_info_get_name (info));
51 print (g_app_info_get_display_name (info));
52 print (g_app_info_get_description (info));
53 g_object_unref (info);