diff options
author | Namhyung Kim <namhyung@gmail.com> | 2012-05-29 00:23:00 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-06-19 12:06:19 -0400 |
commit | b4418c6848dcd56cc90625dcfaef7cb019492233 (patch) | |
tree | a8bf246b7e71be4ccafa00f4412087c299019c50 | |
parent | 42ab68a35ffee04700648ec42c9507145a66837d (diff) |
perf ui/gtk: Add GTK statusbar widget to browser window
Add statusbar widget to display non-critical messages at the bottom of
the window. This can be used for showing a status change, warning or
help message.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1338265382-6872-6-git-send-email-namhyung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/ui/gtk/browser.c | 26 | ||||
-rw-r--r-- | tools/perf/ui/gtk/gtk.h | 2 |
2 files changed, 27 insertions, 1 deletions
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c index 33ab1aee3472..ece360db8658 100644 --- a/tools/perf/ui/gtk/browser.c +++ b/tools/perf/ui/gtk/browser.c | |||
@@ -122,13 +122,30 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists) | |||
122 | gtk_container_add(GTK_CONTAINER(window), view); | 122 | gtk_container_add(GTK_CONTAINER(window), view); |
123 | } | 123 | } |
124 | 124 | ||
125 | static GtkWidget *perf_gtk__setup_statusbar(void) | ||
126 | { | ||
127 | GtkWidget *stbar; | ||
128 | unsigned ctxid; | ||
129 | |||
130 | stbar = gtk_statusbar_new(); | ||
131 | |||
132 | ctxid = gtk_statusbar_get_context_id(GTK_STATUSBAR(stbar), | ||
133 | "perf report"); | ||
134 | pgctx->statbar = stbar; | ||
135 | pgctx->statbar_ctx_id = ctxid; | ||
136 | |||
137 | return stbar; | ||
138 | } | ||
139 | |||
125 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, | 140 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, |
126 | const char *help __used, | 141 | const char *help __used, |
127 | void (*timer) (void *arg)__used, | 142 | void (*timer) (void *arg)__used, |
128 | void *arg __used, int delay_secs __used) | 143 | void *arg __used, int delay_secs __used) |
129 | { | 144 | { |
130 | struct perf_evsel *pos; | 145 | struct perf_evsel *pos; |
146 | GtkWidget *vbox; | ||
131 | GtkWidget *notebook; | 147 | GtkWidget *notebook; |
148 | GtkWidget *statbar; | ||
132 | GtkWidget *window; | 149 | GtkWidget *window; |
133 | 150 | ||
134 | signal(SIGSEGV, perf_gtk__signal); | 151 | signal(SIGSEGV, perf_gtk__signal); |
@@ -147,6 +164,8 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, | |||
147 | if (!pgctx) | 164 | if (!pgctx) |
148 | return -1; | 165 | return -1; |
149 | 166 | ||
167 | vbox = gtk_vbox_new(FALSE, 0); | ||
168 | |||
150 | notebook = gtk_notebook_new(); | 169 | notebook = gtk_notebook_new(); |
151 | 170 | ||
152 | list_for_each_entry(pos, &evlist->entries, node) { | 171 | list_for_each_entry(pos, &evlist->entries, node) { |
@@ -168,7 +187,12 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, | |||
168 | gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, tab_label); | 187 | gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, tab_label); |
169 | } | 188 | } |
170 | 189 | ||
171 | gtk_container_add(GTK_CONTAINER(window), notebook); | 190 | gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); |
191 | |||
192 | statbar = perf_gtk__setup_statusbar(); | ||
193 | gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0); | ||
194 | |||
195 | gtk_container_add(GTK_CONTAINER(window), vbox); | ||
172 | 196 | ||
173 | gtk_widget_show_all(window); | 197 | gtk_widget_show_all(window); |
174 | 198 | ||
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h index 34fbca6d48a2..206167868c5f 100644 --- a/tools/perf/ui/gtk/gtk.h +++ b/tools/perf/ui/gtk/gtk.h | |||
@@ -10,6 +10,8 @@ | |||
10 | 10 | ||
11 | struct perf_gtk_context { | 11 | struct perf_gtk_context { |
12 | GtkWidget *main_window; | 12 | GtkWidget *main_window; |
13 | GtkWidget *statbar; | ||
14 | guint statbar_ctx_id; | ||
13 | }; | 15 | }; |
14 | 16 | ||
15 | extern struct perf_gtk_context *pgctx; | 17 | extern struct perf_gtk_context *pgctx; |