mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 18:26:19 +01:00
tests: expand 'apps' tool
Add modes to output the applications found for get_default_, get_recommended_, get_fallback_ and get_all_for_type(). https://bugzilla.gnome.org/show_bug.cgi?id=728040
This commit is contained in:
parent
41761a134d
commit
a366b6f2d5
@ -8,6 +8,18 @@ print (const gchar *str)
|
|||||||
g_print ("%s\n", str ? str : "nil");
|
g_print ("%s\n", str ? str : "nil");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_app_list (GList *list)
|
||||||
|
{
|
||||||
|
while (list)
|
||||||
|
{
|
||||||
|
GAppInfo *info = list->data;
|
||||||
|
print (g_app_info_get_id (info));
|
||||||
|
list = g_list_delete_link (list, list);
|
||||||
|
g_object_unref (info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -53,6 +65,40 @@ main (int argc, char **argv)
|
|||||||
g_object_unref (info);
|
g_object_unref (info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (g_str_equal (argv[1], "default-for-type"))
|
||||||
|
{
|
||||||
|
GAppInfo *info;
|
||||||
|
|
||||||
|
info = g_app_info_get_default_for_type (argv[2], FALSE);
|
||||||
|
|
||||||
|
if (info)
|
||||||
|
{
|
||||||
|
print (g_app_info_get_id (info));
|
||||||
|
g_object_unref (info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (g_str_equal (argv[1], "recommended-for-type"))
|
||||||
|
{
|
||||||
|
GList *list;
|
||||||
|
|
||||||
|
list = g_app_info_get_recommended_for_type (argv[2]);
|
||||||
|
print_app_list (list);
|
||||||
|
}
|
||||||
|
else if (g_str_equal (argv[1], "all-for-type"))
|
||||||
|
{
|
||||||
|
GList *list;
|
||||||
|
|
||||||
|
list = g_app_info_get_all_for_type (argv[2]);
|
||||||
|
print_app_list (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (g_str_equal (argv[1], "fallback-for-type"))
|
||||||
|
{
|
||||||
|
GList *list;
|
||||||
|
|
||||||
|
list = g_app_info_get_fallback_for_type (argv[2]);
|
||||||
|
print_app_list (list);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user