/* * basePath is shorter that other backend, as ibus-config should provide ibus level base */ MkdgBackend *ibus_config_backend_new(IBusService * service, const gchar * basePath, gpointer auxData) { IBusConfig *config = NULL; #if IBUS_CHECK_VERSION(1, 4, 0) GError *error = NULL; GDBusConnection *connection = ibus_service_get_connection(service); config = g_object_ref_sink(ibus_config_new(connection, NULL, &error)); g_assert(error == NULL); #else GList *connections_list = ibus_service_get_connections(service); g_assert(connections_list); g_assert(connections_list->data); IBusConnection *iConnection = (IBusConnection *) connections_list->data; config = g_object_ref_sink(ibus_config_new(iConnection)); #endif MkdgBackend *result = mkdg_backend_new(IBUS_CONFIG_BACKEND_ID, (gpointer) config, basePath, auxData); result->readFunc = ibus_config_backend_read_value; result->writeFunc = ibus_config_backend_write_value; return result; }
IBusConfig * ibus_bus_get_config (IBusBus *bus) { g_assert (IBUS_IS_BUS (bus)); g_return_val_if_fail (ibus_bus_is_connected (bus), NULL); IBusBusPrivate *priv; priv = IBUS_BUS_GET_PRIVATE (bus); if (priv->config == NULL && priv->connection) { priv->config = ibus_config_new (priv->connection); if (priv->config) { g_signal_connect (priv->config, "destroy", G_CALLBACK (_config_destroy_cb), bus); } } return priv->config; }