gboolean ibus_bus_register_component (IBusBus *bus, IBusComponent *component) { g_assert (IBUS_IS_BUS (bus)); g_assert (IBUS_IS_COMPONENT (component)); gboolean result; result = ibus_bus_call (bus, IBUS_SERVICE_IBUS, IBUS_PATH_IBUS, IBUS_INTERFACE_IBUS, "RegisterComponent", IBUS_TYPE_COMPONENT, &component, G_TYPE_INVALID, G_TYPE_INVALID); return result; #if 0 IBusMessage *message, *reply; IBusError *error; IBusBusPrivate *priv; priv = IBUS_BUS_GET_PRIVATE (bus); message = ibus_message_new_method_call (IBUS_SERVICE_IBUS, IBUS_PATH_IBUS, IBUS_INTERFACE_IBUS, "RegisterComponent"); ibus_message_append_args (message, IBUS_TYPE_COMPONENT, &component, G_TYPE_INVALID); reply = ibus_connection_send_with_reply_and_block ( priv->connection, message, -1, &error); ibus_message_unref (message); if (reply == NULL) { g_warning ("%s : %s", error->name, error->message); ibus_error_free (error); return FALSE; } if ((error = ibus_error_from_message (reply)) != NULL) { g_warning ("%s : %s", error->name, error->message); ibus_error_free (error); ibus_message_unref (reply); return FALSE; } return TRUE; #endif }
static gint _component_is_name (IBusComponent *component, const gchar *name) { g_assert (IBUS_IS_COMPONENT (component)); g_assert (name); return g_strcmp0 (component->name, name); }
BusFactoryProxy * bus_factory_proxy_get_from_component (IBusComponent *component) { IBUS_IS_COMPONENT (component); BusFactoryProxy *factory; factory = (BusFactoryProxy *) g_object_get_data ((GObject *)component, "factory"); return factory; }
gboolean ibus_bus_register_component (IBusBus *bus, IBusComponent *component) { g_assert (IBUS_IS_BUS (bus)); g_assert (IBUS_IS_COMPONENT (component)); gboolean result; result = ibus_bus_call (bus, IBUS_SERVICE_IBUS, IBUS_PATH_IBUS, IBUS_INTERFACE_IBUS, "RegisterComponent", IBUS_TYPE_COMPONENT, &component, G_TYPE_INVALID); return result; }
BusFactoryProxy * bus_factory_proxy_new (IBusComponent *component, BusConnection *connection) { g_assert (IBUS_IS_COMPONENT (component)); BusFactoryProxy *factory; GList *p; if (connection == NULL) { connection = bus_dbus_impl_get_connection_by_name (BUS_DEFAULT_DBUS, component->name); } if (connection == NULL) { return NULL; } factory = g_object_new (BUS_TYPE_FACTORY_PROXY, "name", NULL, "path", "/org/freedesktop/IBus/Factory", "connection", connection, NULL); g_object_ref (component); factory->component = component; g_object_set_data ((GObject *)factory->component, "factory", factory); factory->engine_list = ibus_component_get_engines (factory->component); for (p = factory->engine_list; p != NULL; p = p->next) { IBusEngineDesc *desc = (IBusEngineDesc *)p->data; g_object_ref (desc); g_object_set_data ((GObject *)desc, "factory", factory); } return factory; }