engine: delay D-Bus name request after factory creation

BUG=none

Review URL: https://codereview.appspot.com/6441157
This commit is contained in:
Daiki Ueno 2012-08-20 10:00:17 +09:00
Родитель dd6a556630
Коммит 2e81378f22
2 изменённых файлов: 31 добавлений и 10 удалений

Просмотреть файл

@ -34,16 +34,6 @@ public int main(string[] args) {
return 1; return 1;
} }
uint flags =
IBus.BusNameFlag.REPLACE_EXISTING |
IBus.BusNameFlag.ALLOW_REPLACEMENT;
uint retval = bus.request_name("org.freedesktop.IBus.Simple", flags);
if (retval == 0) {
warning("Registry bus name org.freedesktop.IBus.Simple failed!");
return 1;
}
bus.disconnected.connect((bus) => { bus.disconnected.connect((bus) => {
debug("bus disconnected"); debug("bus disconnected");
IBus.quit(); IBus.quit();
@ -61,6 +51,16 @@ public int main(string[] args) {
return engine; return engine;
}); });
uint flags =
IBus.BusNameFlag.REPLACE_EXISTING |
IBus.BusNameFlag.ALLOW_REPLACEMENT;
uint retval = bus.request_name("org.freedesktop.IBus.Simple", flags);
if (retval == 0) {
warning("Registry bus name org.freedesktop.IBus.Simple failed!");
return 1;
}
IBus.main(); IBus.main();
return 0; return 0;

Просмотреть файл

@ -621,6 +621,26 @@ test_bus_new_async (void)
ibus_main (); ibus_main ();
} }
static void
test_global_engine (void)
{
IBusEngineDesc *engine_desc;
const gchar *engine_name;
if (!ibus_bus_get_use_global_engine (bus))
return;
engine_name = "xkb:us::eng";
ibus_bus_set_global_engine (bus, engine_name);
engine_desc = ibus_bus_get_global_engine (bus);
g_assert_cmpstr (ibus_engine_desc_get_name (engine_desc), ==, engine_name);
engine_name = "xkb:jp::jpn";
ibus_bus_set_global_engine (bus, engine_name);
engine_desc = ibus_bus_get_global_engine (bus);
g_assert_cmpstr (ibus_engine_desc_get_name (engine_desc), ==, engine_name);
}
gint gint
main (gint argc, main (gint argc,
gchar **argv) gchar **argv)
@ -646,6 +666,7 @@ main (gint argc,
test_create_input_context_async); test_create_input_context_async);
g_test_add_func ("/ibus/bus-new-async/get-engines-by-names", test_get_engines_by_names); g_test_add_func ("/ibus/bus-new-async/get-engines-by-names", test_get_engines_by_names);
g_test_add_func ("/ibus/bus-new-async/async-apis", test_async_apis); g_test_add_func ("/ibus/bus-new-async/async-apis", test_async_apis);
g_test_add_func ("/ibus/global-engine", test_global_engine);
result = g_test_run (); result = g_test_run ();
g_object_unref (bus); g_object_unref (bus);