#include <stdio.h>
#include <string.h>

#include "gtk.h"
#include "../ui.h"
#include "../helpline.h"
#include "../../util/debug.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 int gtk_helpline_show(const char *fmt, va_list ap)
{
	int ret;
	char *ptr;
	static int backlog;

	ret = vscnprintf(ui_helpline__current + backlog,
			 sizeof(ui_helpline__current) - backlog, fmt, ap);
	backlog += ret;

	/* only first line can be displayed */
	ptr = strchr(ui_helpline__current, '\n');
	if (ptr && (ptr - ui_helpline__current) <= backlog) {
		*ptr = '\0';
		ui_helpline__puts(ui_helpline__current);
		backlog = 0;
	}

	return ret;
}

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

void perf_gtk__init_helpline(void)
{
	helpline_fns = &gtk_helpline_fns;
}
ck'>packet-rx-pump-back</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/?h=nds-private-remove'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?h=nds-private-remove'>refs</a><a href='/cgit.cgi/linux/net-next.git/log/Documentation/EDID?h=nds-private-remove'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/Documentation/EDID?h=nds-private-remove'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/Documentation/EDID?h=nds-private-remove'>commit</a><a class='active' href='/cgit.cgi/linux/net-next.git/diff/Documentation/EDID?h=nds-private-remove'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/Documentation/EDID'>
<input type='hidden' name='h' value='nds-private-remove'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/diff/?h=nds-private-remove'>root</a>/<a href='/cgit.cgi/linux/net-next.git/diff/Documentation?h=nds-private-remove'>Documentation</a>/<a href='/cgit.cgi/linux/net-next.git/diff/Documentation/EDID?h=nds-private-remove'>EDID</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='h' value='nds-private-remove'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?h=nds-private-remove'>Diffstat</a> (limited to 'Documentation/EDID')</div><table summary='diffstat' class='diffstat'>