From f8f132f066a930e296aa327d4c35c6d644774b9c Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Fri, 11 Sep 2009 11:35:58 -0400 Subject: [PATCH] Sort by action id in pkaction(1) output --- src/programs/pkaction.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/programs/pkaction.c b/src/programs/pkaction.c index 3493bc0..7d8f645 100644 --- a/src/programs/pkaction.c +++ b/src/programs/pkaction.c @@ -93,6 +93,14 @@ print_action (PolkitActionDescription *action, } } +static gint +action_desc_compare_by_action_id_func (PolkitActionDescription *a, + PolkitActionDescription *b) +{ + return g_strcmp0 (polkit_action_description_get_action_id (a), + polkit_action_description_get_action_id (b)); +} + int main (int argc, char *argv[]) { @@ -196,6 +204,9 @@ main (int argc, char *argv[]) } else { + actions = g_list_sort (actions, + (GCompareFunc) action_desc_compare_by_action_id_func); + for (l = actions; l != NULL; l = l->next) { PolkitActionDescription *action = POLKIT_ACTION_DESCRIPTION (l->data); -- 2.7.4