From bc958efad4530621ea32e98f265509140713384a Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Mon, 21 May 2012 20:53:31 -0400 Subject: [PATCH] sort perf key working Signed-off-by: Julien Desfossez --- src/cursesdisplay.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/cursesdisplay.c b/src/cursesdisplay.c index 2d79d65..beb7bdf 100644 --- a/src/cursesdisplay.c +++ b/src/cursesdisplay.c @@ -779,8 +779,8 @@ void update_perf() while (g_hash_table_iter_next (&iter, &key, (gpointer) &perfn1)) { if (perfn1->visible) { if (perfn1->sort) { + /* pref_current_sort = i; */ wattron(center, A_UNDERLINE); - /* FIXME : sort in the opposite direction */ } /* + 5 to strip the "perf_" prefix */ mvwprintw(center, 1, perf_row, "%s", @@ -1443,19 +1443,24 @@ void *handle_keyboard(void *p) update_preference_panel(&pref_line_selected, 0, 1); break; case '>': - if (!pref_panel_visible) { + /* perf uses a hashtable, it is ordered backward */ + if (current_view == perf) { + pref_current_sort--; + } else if (!pref_panel_visible) { pref_current_sort++; - update_sort(&pref_current_sort); - update_current_view(); } + update_sort(&pref_current_sort); + update_current_view(); break; case '<': - if (!pref_panel_visible) { - if (pref_current_sort > 0) - pref_current_sort--; - update_sort(&pref_current_sort); - update_current_view(); + /* perf uses a hashtable, it is ordered backward */ + if (current_view == perf) { + pref_current_sort++; + } else if (!pref_panel_visible) { + pref_current_sort--; } + update_sort(&pref_current_sort); + update_current_view(); break; case 13: /* FIXME : KEY_ENTER ?? */ -- 2.34.1