Comment #1 on issue 1263 by [email protected]: Cannot monitor ibus startup
http://code.google.com/p/ibus/issues/detail?id=1263

The "connect" is emited only when you call ibus_bus_connect.

Correct, but the ibus_bus_connect function should *automatically* be called when 1) IBusBus object is created, and 2) ibus-daemon starts and then creates a "socket file" (typically in ~/.config/ibus/bus/). Please check _changed_cb and ibus_bus_init functions in https://github.com/ibus/ibus/blob/master/src/ibusbus.c .

So I believe you can monitor ibus-daemon startup by just doing something like:

IBusBus* bus = ibus_bus_new();
g_signal_connect(bus, "connected", G_CALLBACK(f), ...);
if (ibus_bus_is_connected(bus)) {
    // ibus-daemon is already up and running.
}

...

void f(IBusBus* bus, gpointer userdata) {
    // ibus-daemon started.
}

FYI, here is a working example of ibus-daemon startup monitor which my colleagues and I wrote a while ago. It's a bit lengthy though.
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/chromeos/input_method/ibus_controller.cc?view=markup


--
You received this message because you are subscribed to the Google
Groups "ibus-devel" group.
iBus project web page: http://code.google.com/p/ibus/
iBus dev group: http://groups.google.com/group/ibus-devel?hl=en

回复