1 // SPDX-License-Identifier: GPL-2.0
5 #include <linux/kernel.h>
8 #include "../helpline.h"
10 static void gtk_helpline_pop(void)
12 if (!perf_gtk__is_active_context(pgctx))
15 gtk_statusbar_pop(GTK_STATUSBAR(pgctx->statbar),
16 pgctx->statbar_ctx_id);
19 static void gtk_helpline_push(const char *msg)
21 if (!perf_gtk__is_active_context(pgctx))
24 gtk_statusbar_push(GTK_STATUSBAR(pgctx->statbar),
25 pgctx->statbar_ctx_id, msg);
28 static int gtk_helpline_show(const char *fmt, va_list ap)
34 ret = vscnprintf(ui_helpline__current + backlog,
35 sizeof(ui_helpline__current) - backlog, fmt, ap);
38 /* only first line can be displayed */
39 ptr = strchr(ui_helpline__current, '\n');
40 if (ptr && (ptr - ui_helpline__current) <= backlog) {
42 ui_helpline__puts(ui_helpline__current);
49 static struct ui_helpline gtk_helpline_fns = {
50 .pop = gtk_helpline_pop,
51 .push = gtk_helpline_push,
52 .show = gtk_helpline_show,
55 void perf_gtk__init_helpline(void)
57 helpline_fns = >k_helpline_fns;