aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/gtk/browser.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2012-05-29 00:23:01 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-06-19 12:06:19 -0400
commita6b702c117f839023814c1e03453c701d26de522 (patch)
treecf472c20bb6d7b583c1f9a0ade8eedc318b0c1df /tools/perf/ui/gtk/browser.c
parentb4418c6848dcd56cc90625dcfaef7cb019492233 (diff)
perf ui/gtk: Add GTK info_bar widget to browser window
The GtkInfoBar is a modern UI component to display messages without bothering the main window. It'll be used for showing a warning message. As the GtkInfoBar requires 2.18 (or newer) version of GTK+ library, add availability check to Makefile too. Suggested-by: Sunjin Yang <fan4326@gmail.com> 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-7-git-send-email-namhyung@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/gtk/browser.c')
-rw-r--r--tools/perf/ui/gtk/browser.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c
index ece360db8658..fd41e8d10337 100644
--- a/tools/perf/ui/gtk/browser.c
+++ b/tools/perf/ui/gtk/browser.c
@@ -122,6 +122,34 @@ 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#ifdef HAVE_GTK_INFO_BAR
126static GtkWidget *perf_gtk__setup_info_bar(void)
127{
128 GtkWidget *info_bar;
129 GtkWidget *label;
130 GtkWidget *content_area;
131
132 info_bar = gtk_info_bar_new();
133 gtk_widget_set_no_show_all(info_bar, TRUE);
134
135 label = gtk_label_new("");
136 gtk_widget_show(label);
137
138 content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar));
139 gtk_container_add(GTK_CONTAINER(content_area), label);
140
141 gtk_info_bar_add_button(GTK_INFO_BAR(info_bar), GTK_STOCK_OK,
142 GTK_RESPONSE_OK);
143 g_signal_connect(info_bar, "response",
144 G_CALLBACK(gtk_widget_hide), NULL);
145
146 pgctx->info_bar = info_bar;
147 pgctx->message_label = label;
148
149 return info_bar;
150}
151#endif
152
125static GtkWidget *perf_gtk__setup_statusbar(void) 153static GtkWidget *perf_gtk__setup_statusbar(void)
126{ 154{
127 GtkWidget *stbar; 155 GtkWidget *stbar;
@@ -145,6 +173,7 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist,
145 struct perf_evsel *pos; 173 struct perf_evsel *pos;
146 GtkWidget *vbox; 174 GtkWidget *vbox;
147 GtkWidget *notebook; 175 GtkWidget *notebook;
176 GtkWidget *info_bar;
148 GtkWidget *statbar; 177 GtkWidget *statbar;
149 GtkWidget *window; 178 GtkWidget *window;
150 179
@@ -189,6 +218,10 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist,
189 218
190 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); 219 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
191 220
221 info_bar = perf_gtk__setup_info_bar();
222 if (info_bar)
223 gtk_box_pack_start(GTK_BOX(vbox), info_bar, FALSE, FALSE, 0);
224
192 statbar = perf_gtk__setup_statusbar(); 225 statbar = perf_gtk__setup_statusbar();
193 gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0); 226 gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0);
194 227