Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312266
b: refs/heads/master
c: a6b702c
h: refs/heads/master
v: v3
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Jun 19, 2012
1 parent 14749d0 commit 9fdd9eb
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b4418c6848dcd56cc90625dcfaef7cb019492233
refs/heads/master: a6b702c117f839023814c1e03453c701d26de522
3 changes: 3 additions & 0 deletions trunk/tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,9 @@ else
msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
BASIC_CFLAGS += -DNO_GTK2_SUPPORT
else
ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2)),y)
BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
endif
BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
EXTLIBS += $(shell pkg-config --libs gtk+-2.0)
LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
Expand Down
13 changes: 13 additions & 0 deletions trunk/tools/perf/config/feature-tests.mak
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ int main(int argc, char *argv[])
return 0;
}
endef

define SOURCE_GTK2_INFOBAR
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
#include <gtk/gtk.h>
#pragma GCC diagnostic error \"-Wstrict-prototypes\"

int main(void)
{
gtk_info_bar_new();

return 0;
}
endef
endif

ifndef NO_LIBPERL
Expand Down
33 changes: 33 additions & 0 deletions trunk/tools/perf/ui/gtk/browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,34 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists)
gtk_container_add(GTK_CONTAINER(window), view);
}

#ifdef HAVE_GTK_INFO_BAR
static GtkWidget *perf_gtk__setup_info_bar(void)
{
GtkWidget *info_bar;
GtkWidget *label;
GtkWidget *content_area;

info_bar = gtk_info_bar_new();
gtk_widget_set_no_show_all(info_bar, TRUE);

label = gtk_label_new("");
gtk_widget_show(label);

content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar));
gtk_container_add(GTK_CONTAINER(content_area), label);

gtk_info_bar_add_button(GTK_INFO_BAR(info_bar), GTK_STOCK_OK,
GTK_RESPONSE_OK);
g_signal_connect(info_bar, "response",
G_CALLBACK(gtk_widget_hide), NULL);

pgctx->info_bar = info_bar;
pgctx->message_label = label;

return info_bar;
}
#endif

static GtkWidget *perf_gtk__setup_statusbar(void)
{
GtkWidget *stbar;
Expand All @@ -145,6 +173,7 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist,
struct perf_evsel *pos;
GtkWidget *vbox;
GtkWidget *notebook;
GtkWidget *info_bar;
GtkWidget *statbar;
GtkWidget *window;

Expand Down Expand Up @@ -189,6 +218,10 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist,

gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);

info_bar = perf_gtk__setup_info_bar();
if (info_bar)
gtk_box_pack_start(GTK_BOX(vbox), info_bar, FALSE, FALSE, 0);

statbar = perf_gtk__setup_statusbar();
gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0);

Expand Down
12 changes: 12 additions & 0 deletions trunk/tools/perf/ui/gtk/gtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

struct perf_gtk_context {
GtkWidget *main_window;

#ifdef HAVE_GTK_INFO_BAR
GtkWidget *info_bar;
GtkWidget *message_label;
#endif
GtkWidget *statbar;
guint statbar_ctx_id;
};
Expand All @@ -24,4 +29,11 @@ static inline bool perf_gtk__is_active_context(struct perf_gtk_context *ctx)
struct perf_gtk_context *perf_gtk__activate_context(GtkWidget *window);
int perf_gtk__deactivate_context(struct perf_gtk_context **ctx);

#ifndef HAVE_GTK_INFO_BAR
static inline GtkWidget *perf_gtk__setup_info_bar(void)
{
return NULL;
}
#endif

#endif /* _PERF_GTK_H_ */

0 comments on commit 9fdd9eb

Please sign in to comment.