/* * 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; }
static void ibus_config_service_get_property (IBusConfigService *config, guint prop_id, GValue *value, GParamSpec *pspec) { switch (prop_id) { case PROP_CONNECTION: { GList *connections = ibus_service_get_connections ((IBusService *) config); if (connections) { g_value_set_object (value, connections->data); } else { g_value_set_object (value, NULL); } g_list_free (connections); } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (config, prop_id, pspec); } }