From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Pekka Enberg <penberg@kernel.org>
Subject: [PATCH v2 3/5] perf ui/gtk: Implement helpline_fns
Date: Thu, 16 Aug 2012 17:14:52 +0900 [thread overview]
Message-ID: <1345104894-14205-3-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1345104894-14205-1-git-send-email-namhyung@kernel.org>
Add helpline API implementation to GTK front-end.
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/Makefile | 1 +
tools/perf/ui/gtk/gtk.h | 2 ++
tools/perf/ui/gtk/helpline.c | 31 +++++++++++++++++++++++++++++++
tools/perf/ui/gtk/setup.c | 1 +
4 files changed, 35 insertions(+)
create mode 100644 tools/perf/ui/gtk/helpline.c
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 14c0b744d98e..91f16e26fd0d 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -601,6 +601,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
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h
index a4d0f2b4a2dc..793cb6116ddf 100644
--- a/tools/perf/ui/gtk/gtk.h
+++ b/tools/perf/ui/gtk/gtk.h
@@ -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)
{
diff --git a/tools/perf/ui/gtk/helpline.c b/tools/perf/ui/gtk/helpline.c
new file mode 100644
index 000000000000..9180fea920d5
--- /dev/null
+++ b/tools/perf/ui/gtk/helpline.c
@@ -0,0 +1,31 @@
+#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 = >k_helpline_fns;
+}
diff --git a/tools/perf/ui/gtk/setup.c b/tools/perf/ui/gtk/setup.c
index 92879ce61e2f..ad40b3626fdb 100644
--- a/tools/perf/ui/gtk/setup.c
+++ b/tools/perf/ui/gtk/setup.c
@@ -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;
}
--
1.7.11.2
next prev parent reply other threads:[~2012-08-16 8:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-16 8:14 [PATCH v2 1/5] perf ui: Introduce struct ui_helpline Namhyung Kim
2012-08-16 8:14 ` [PATCH v2 2/5] perf ui/tui: Add tui.h header Namhyung Kim
2012-08-16 19:37 ` Arnaldo Carvalho de Melo
2012-08-16 19:42 ` Arnaldo Carvalho de Melo
2012-08-17 16:03 ` Namhyung Kim
2012-08-16 8:14 ` Namhyung Kim [this message]
2012-08-17 11:28 ` [PATCH v2 3/5] perf ui/gtk: Implement helpline_fns Pekka Enberg
2012-08-21 16:21 ` [tip:perf/core] perf ui gtk: " tip-bot for Namhyung Kim
2012-08-16 8:14 ` [PATCH v2 4/5] perf ui/gtk: Use helpline API in browser Namhyung Kim
2012-08-21 16:22 ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-08-16 8:14 ` [PATCH v2 5/5] perf ui/gtk: Add perf_gtk__show_helpline() for pr_* Namhyung Kim
2012-08-17 16:40 ` [PATCH v3 " Namhyung Kim
2012-08-21 16:23 ` [tip:perf/core] perf ui gtk: " tip-bot for Namhyung Kim
2012-08-21 16:20 ` [tip:perf/core] perf ui: Introduce struct ui_helpline tip-bot for Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1345104894-14205-3-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulus@samba.org \
--cc=penberg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox