提交 b4418c68 编写于 作者: N Namhyung Kim 提交者: Arnaldo Carvalho de Melo

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: NNamhyung Kim <namhyung@gmail.com>
Acked-by: NPekka 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.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 42ab68a3
...@@ -122,13 +122,30 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists) ...@@ -122,13 +122,30 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists)
gtk_container_add(GTK_CONTAINER(window), view); gtk_container_add(GTK_CONTAINER(window), view);
} }
static GtkWidget *perf_gtk__setup_statusbar(void)
{
GtkWidget *stbar;
unsigned ctxid;
stbar = gtk_statusbar_new();
ctxid = gtk_statusbar_get_context_id(GTK_STATUSBAR(stbar),
"perf report");
pgctx->statbar = stbar;
pgctx->statbar_ctx_id = ctxid;
return stbar;
}
int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist,
const char *help __used, const char *help __used,
void (*timer) (void *arg)__used, void (*timer) (void *arg)__used,
void *arg __used, int delay_secs __used) void *arg __used, int delay_secs __used)
{ {
struct perf_evsel *pos; struct perf_evsel *pos;
GtkWidget *vbox;
GtkWidget *notebook; GtkWidget *notebook;
GtkWidget *statbar;
GtkWidget *window; GtkWidget *window;
signal(SIGSEGV, perf_gtk__signal); signal(SIGSEGV, perf_gtk__signal);
...@@ -147,6 +164,8 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, ...@@ -147,6 +164,8 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist,
if (!pgctx) if (!pgctx)
return -1; return -1;
vbox = gtk_vbox_new(FALSE, 0);
notebook = gtk_notebook_new(); notebook = gtk_notebook_new();
list_for_each_entry(pos, &evlist->entries, node) { list_for_each_entry(pos, &evlist->entries, node) {
...@@ -168,7 +187,12 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, ...@@ -168,7 +187,12 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist,
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, tab_label); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, tab_label);
} }
gtk_container_add(GTK_CONTAINER(window), notebook); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
statbar = perf_gtk__setup_statusbar();
gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_widget_show_all(window); gtk_widget_show_all(window);
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
struct perf_gtk_context { struct perf_gtk_context {
GtkWidget *main_window; GtkWidget *main_window;
GtkWidget *statbar;
guint statbar_ctx_id;
}; };
extern struct perf_gtk_context *pgctx; extern struct perf_gtk_context *pgctx;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册