summaryrefslogtreecommitdiffstats
path: root/src/test-server.c
blob: 2171b9e9529b8f984aea829c94e83243c1e87727 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "ibus.h"


void connection_destroy_cb (IBusConnection *connection, gpointer user_data)
{
	g_debug ("connnection %p destroyed", connection );
}

void new_connection_cb (IBusServer *server, IBusConnection *connection, gpointer user_data)
{
	g_debug ("new-connection %p", connection);
	g_signal_connect (connection, "destroy", (GCallback) connection_destroy_cb, 0);
}

int main()
{
	g_type_init ();
	
	GMainLoop *mainloop;
	IBusServer *server;
	
	mainloop = g_main_loop_new (NULL, FALSE);
	server = ibus_server_new ();
	ibus_server_listen (server, "unix:abstract=/tmp/1234567");
	g_signal_connect (server, "new-connection", (GCallback) new_connection_cb, 0);
	
	g_main_loop_run (mainloop);
	
	return 0;
}