aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/browser.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-08-10 15:44:20 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-08-10 15:44:20 -0300
commit59e8fe32fc0cc9dff6b0c269d099a49e004dc45e (patch)
tree55133961ebcbf9ea5b5ab674360207876c189349 /tools/perf/util/ui/browser.c
parentperf annotate: Cycle thru sorted lines with samples (diff)
downloadlinux-dev-59e8fe32fc0cc9dff6b0c269d099a49e004dc45e.tar.xz
linux-dev-59e8fe32fc0cc9dff6b0c269d099a49e004dc45e.zip
perf ui browser: Add ui_browser__show counterpart: __hide
So that the common tasks of providing a helpline at __run entry and destroying the window and releasing resourses at exit can be abstracted away, reducing a bit more the coupling with libnewt. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui/browser.c')
-rw-r--r--tools/perf/util/ui/browser.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 83d57487f6ef..66f2d583d8c4 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <sys/ttydefaults.h>
#include "browser.h"
+#include "helpline.h"
#include "../color.h"
#include "../util.h"
@@ -145,8 +146,11 @@ void ui_browser__reset_index(struct ui_browser *self)
self->seek(self, 0, SEEK_SET);
}
-int ui_browser__show(struct ui_browser *self, const char *title)
+int ui_browser__show(struct ui_browser *self, const char *title,
+ const char *helpline, ...)
{
+ va_list ap;
+
if (self->form != NULL) {
newtFormDestroy(self->form);
newtPopWindow();
@@ -171,9 +175,21 @@ int ui_browser__show(struct ui_browser *self, const char *title)
newtFormAddHotKey(self->form, NEWT_KEY_END);
newtFormAddHotKey(self->form, ' ');
newtFormAddComponent(self->form, self->sb);
+
+ va_start(ap, helpline);
+ ui_helpline__vpush(helpline, ap);
+ va_end(ap);
return 0;
}
+void ui_browser__hide(struct ui_browser *self)
+{
+ newtFormDestroy(self->form);
+ newtPopWindow();
+ self->form = NULL;
+ ui_helpline__pop();
+}
+
int ui_browser__refresh(struct ui_browser *self)
{
int row;