Skip to content

Commit

Permalink
perf ui gtk: Implement helpline_fns
Browse files Browse the repository at this point in the history
Add helpline API implementation to GTK front-end.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Ingo Molnar <mingo@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/1345104894-14205-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Aug 17, 2012
1 parent e6e9046 commit 4bb1646
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ else
LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
LIB_OBJS += $(OUTPUT)ui/gtk/util.o
LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
# Make sure that it'd be included only once.
ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),)
LIB_OBJS += $(OUTPUT)ui/setup.o
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/ui/gtk/gtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ 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);

void perf_gtk__init_helpline(void);

#ifndef HAVE_GTK_INFO_BAR
static inline GtkWidget *perf_gtk__setup_info_bar(void)
{
Expand Down
30 changes: 30 additions & 0 deletions tools/perf/ui/gtk/helpline.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "gtk.h"
#include "../helpline.h"

static void gtk_helpline_pop(void)
{
if (!perf_gtk__is_active_context(pgctx))
return;

gtk_statusbar_pop(GTK_STATUSBAR(pgctx->statbar),
pgctx->statbar_ctx_id);
}

static void gtk_helpline_push(const char *msg)
{
if (!perf_gtk__is_active_context(pgctx))
return;

gtk_statusbar_push(GTK_STATUSBAR(pgctx->statbar),
pgctx->statbar_ctx_id, msg);
}

static struct ui_helpline gtk_helpline_fns = {
.pop = gtk_helpline_pop,
.push = gtk_helpline_push,
};

void perf_gtk__init_helpline(void)
{
helpline_fns = &gtk_helpline_fns;
}
1 change: 1 addition & 0 deletions tools/perf/ui/gtk/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern struct perf_error_ops perf_gtk_eops;
int perf_gtk__init(void)
{
perf_error__register(&perf_gtk_eops);
perf_gtk__init_helpline();
return gtk_init_check(NULL, NULL) ? 0 : -1;
}

Expand Down

0 comments on commit 4bb1646

Please sign in to comment.