diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-08-10 14:44:20 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-08-10 14:44:20 -0400 |
commit | 59e8fe32fc0cc9dff6b0c269d099a49e004dc45e (patch) | |
tree | 55133961ebcbf9ea5b5ab674360207876c189349 /tools/perf/util/ui/browsers | |
parent | f1e9214cc99644101d957c5c660946c6f2f86d7c (diff) |
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/browsers')
-rw-r--r-- | tools/perf/util/ui/browsers/annotate.c | 8 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/hists.c | 5 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/map.c | 10 |
3 files changed, 11 insertions, 12 deletions
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c index 73e78ef38a50..55ff792459ac 100644 --- a/tools/perf/util/ui/browsers/annotate.c +++ b/tools/perf/util/ui/browsers/annotate.c | |||
@@ -141,10 +141,10 @@ static int annotate_browser__run(struct annotate_browser *self, | |||
141 | struct rb_node *nd; | 141 | struct rb_node *nd; |
142 | struct hist_entry *he = self->b.priv; | 142 | struct hist_entry *he = self->b.priv; |
143 | 143 | ||
144 | if (ui_browser__show(&self->b, he->ms.sym->name) < 0) | 144 | if (ui_browser__show(&self->b, he->ms.sym->name, |
145 | "<- or ESC: exit, TAB/shift+TAB: cycle thru samples") < 0) | ||
145 | return -1; | 146 | return -1; |
146 | 147 | ||
147 | ui_helpline__fpush("<- or ESC: exit, TAB/shift+TAB: cycle thru samples"); | ||
148 | newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT); | 148 | newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT); |
149 | 149 | ||
150 | nd = self->curr_hot; | 150 | nd = self->curr_hot; |
@@ -177,9 +177,7 @@ static int annotate_browser__run(struct annotate_browser *self, | |||
177 | } | 177 | } |
178 | } | 178 | } |
179 | out: | 179 | out: |
180 | newtFormDestroy(self->b.form); | 180 | ui_browser__hide(&self->b); |
181 | newtPopWindow(); | ||
182 | ui_helpline__pop(); | ||
183 | return 0; | 181 | return 0; |
184 | } | 182 | } |
185 | 183 | ||
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index cee7998f1c33..dd512b73b015 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
@@ -211,7 +211,8 @@ static int hist_browser__run(struct hist_browser *self, const char *title, | |||
211 | nr_events, unit); | 211 | nr_events, unit); |
212 | newtDrawRootText(0, 0, str); | 212 | newtDrawRootText(0, 0, str); |
213 | 213 | ||
214 | if (ui_browser__show(&self->b, title) < 0) | 214 | if (ui_browser__show(&self->b, title, |
215 | "Press '?' for help on key bindings") < 0) | ||
215 | return -1; | 216 | return -1; |
216 | 217 | ||
217 | newtFormAddHotKey(self->b.form, 'A'); | 218 | newtFormAddHotKey(self->b.form, 'A'); |
@@ -253,6 +254,8 @@ static int hist_browser__run(struct hist_browser *self, const char *title, | |||
253 | return 0; | 254 | return 0; |
254 | } | 255 | } |
255 | } | 256 | } |
257 | |||
258 | ui_browser__hide(&self->b); | ||
256 | return 0; | 259 | return 0; |
257 | } | 260 | } |
258 | 261 | ||
diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/util/ui/browsers/map.c index b79f0c996ea8..142b825b42bf 100644 --- a/tools/perf/util/ui/browsers/map.c +++ b/tools/perf/util/ui/browsers/map.c | |||
@@ -100,11 +100,11 @@ static int map_browser__search(struct map_browser *self) | |||
100 | 100 | ||
101 | static int map_browser__run(struct map_browser *self, struct newtExitStruct *es) | 101 | static int map_browser__run(struct map_browser *self, struct newtExitStruct *es) |
102 | { | 102 | { |
103 | if (ui_browser__show(&self->b, self->map->dso->long_name) < 0) | 103 | if (ui_browser__show(&self->b, self->map->dso->long_name, |
104 | "Press <- or ESC to exit, %s / to search", | ||
105 | verbose ? "" : "restart with -v to use") < 0) | ||
104 | return -1; | 106 | return -1; |
105 | 107 | ||
106 | ui_helpline__fpush("Press <- or ESC to exit, %s / to search", | ||
107 | verbose ? "" : "restart with -v to use"); | ||
108 | newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT); | 108 | newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT); |
109 | newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER); | 109 | newtFormAddHotKey(self->b.form, NEWT_KEY_ENTER); |
110 | if (verbose) | 110 | if (verbose) |
@@ -121,9 +121,7 @@ static int map_browser__run(struct map_browser *self, struct newtExitStruct *es) | |||
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | 123 | ||
124 | newtFormDestroy(self->b.form); | 124 | ui_browser__hide(&self->b); |
125 | newtPopWindow(); | ||
126 | ui_helpline__pop(); | ||
127 | return 0; | 125 | return 0; |
128 | } | 126 | } |
129 | 127 | ||