From e3957545d18900109e19d607ad17eac136a38d1c Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Mon, 18 Apr 2011 11:18:27 -0400 Subject: [PATCH] Use g_initable_new to create BusFactoryProxy. BUG=none TEST=Linux desktop Review URL: http://codereview.appspot.com/4446051 --- bus/factoryproxy.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/bus/factoryproxy.c b/bus/factoryproxy.c index d530eb4..1893520 100644 --- a/bus/factoryproxy.c +++ b/bus/factoryproxy.c @@ -58,18 +58,23 @@ bus_factory_proxy_destroy (IBusProxy *proxy) } BusFactoryProxy * -bus_factory_proxy_new(BusConnection *connection) +bus_factory_proxy_new (BusConnection *connection) { g_assert (BUS_IS_CONNECTION (connection)); BusFactoryProxy *factory; - - factory = g_object_new (BUS_TYPE_FACTORY_PROXY, - "g-object-path", IBUS_PATH_FACTORY, - "g-interface-name", IBUS_INTERFACE_FACTORY, - "g-connection", bus_connection_get_dbus_connection (connection), - "g-default-timeout", g_gdbus_timeout, - "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, - NULL); + + GDBusProxyFlags flags = G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES; + factory = (BusFactoryProxy *) g_initable_new ( + BUS_TYPE_FACTORY_PROXY, + NULL, NULL, + "g-object-path", IBUS_PATH_FACTORY, + "g-interface-name", IBUS_INTERFACE_FACTORY, + "g-connection", bus_connection_get_dbus_connection (connection), + "g-default-timeout", g_gdbus_timeout, + "g-flags", flags, + NULL); + return factory; } @@ -84,7 +89,7 @@ bus_factory_proxy_create_engine (BusFactoryProxy *factory, g_assert (BUS_IS_FACTORY_PROXY (factory)); g_assert (IBUS_IS_ENGINE_DESC (desc)); g_assert (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); - + g_dbus_proxy_call ((GDBusProxy *) factory, "CreateEngine", g_variant_new ("(s)", ibus_engine_desc_get_name (desc)), -- 2.7.4