diff options
author | Ted Gould <ted@gould.cx> | 2010-08-12 11:11:13 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-08-12 11:11:13 -0500 |
commit | e22b44483407aac56d6b50705bed890038e469a2 (patch) | |
tree | 5ee99d254698843e69c5bfb7a99bd4fc3f8c0a8e /tools | |
parent | ac60059f63eb9ebf4c9edd30678a18aeeea89d34 (diff) | |
download | libdbusmenu-e22b44483407aac56d6b50705bed890038e469a2.tar.gz libdbusmenu-e22b44483407aac56d6b50705bed890038e469a2.tar.bz2 libdbusmenu-e22b44483407aac56d6b50705bed890038e469a2.zip |
Making the dumper sort the properties to make it more predictable.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dbusmenu-dumper.c | 9 |
1 files changed, 8 insertions, 1 deletions
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); |