From e22b44483407aac56d6b50705bed890038e469a2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 12 Aug 2010 11:11:13 -0500 Subject: Making the dumper sort the properties to make it more predictable. --- tools/dbusmenu-dumper.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 9e66236..3256f7e 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -135,13 +135,20 @@ value2string (const GValue * value, int depth) return str; } +static gint +list_str_cmp (gconstpointer a, gconstpointer b) +{ + return g_strcmp0((gchar *)a, (gchar *)b); +} + static void print_menuitem (DbusmenuMenuitem * item, int depth) { gchar * space = g_strnfill(depth, ' '); g_print("%s\"id\": %d", space, dbusmenu_menuitem_get_id(item)); - GList * properties = dbusmenu_menuitem_properties_list(item); + GList * properties_raw = dbusmenu_menuitem_properties_list(item); + GList * properties = g_list_sort(properties_raw, list_str_cmp); GList * property; for (property = properties; property != NULL; property = g_list_next(property)) { const GValue * value = dbusmenu_menuitem_property_get_value(item, (gchar *)property->data); -- cgit v1.2.3