Ejemplo n.º 1
0
void gvir_config_domain_set_features(GVirConfigDomain *domain,
                                     const GStrv features)
{
    GVirConfigObject *features_node;
    GStrv it;

    features_node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(domain),
                                                     "features");
    g_return_if_fail(GVIR_CONFIG_IS_OBJECT(features_node));
    for (it = features; *it != NULL; it++) {
        GVirConfigObject *feature;
        feature = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(features_node),
                                                   *it);
        g_object_unref(G_OBJECT(feature));
    }
    g_object_unref(G_OBJECT(features_node));
    g_object_notify(G_OBJECT(domain), "features");
}
void gvir_config_storage_pool_source_set_directory(GVirConfigStoragePoolSource *source,
                                                   const char *directory)
{
    GVirConfigObject *node;

    g_return_if_fail(GVIR_CONFIG_IS_STORAGE_POOL_SOURCE(source));

    node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(source), "directory");
    g_return_if_fail(GVIR_CONFIG_IS_OBJECT(node));
    gvir_config_object_set_attribute(node, "path", directory, NULL);
    g_object_unref(G_OBJECT(node));
}
void gvir_config_storage_pool_source_set_adapter(GVirConfigStoragePoolSource *source,
                                                 const char *adapter)
{
    GVirConfigObject *node;

    g_return_if_fail(GVIR_CONFIG_IS_STORAGE_POOL_SOURCE(source));

    node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(source), "adapter");
    g_return_if_fail(GVIR_CONFIG_IS_OBJECT(node));
    gvir_config_object_set_attribute(node, "name", adapter, NULL);
    g_object_unref(G_OBJECT(node));
}
void gvir_config_storage_vol_backing_store_set_format(GVirConfigStorageVolBackingStore *backing_store,
                                                      const char *format)
{
    GVirConfigObject *node;

    g_return_if_fail(GVIR_CONFIG_IS_STORAGE_VOL_BACKING_STORE(backing_store));

    node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(backing_store), "format");
    g_return_if_fail(GVIR_CONFIG_IS_OBJECT(node));
    gvir_config_object_set_attribute(node, "type", format, NULL);
    g_object_unref(G_OBJECT(node));
}
void gvir_config_domain_video_set_model(GVirConfigDomainVideo *video,
                                        GVirConfigDomainVideoModel model)
{
    GVirConfigObject *node;

    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_VIDEO(video));
    node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(video),
                                            "model");
    g_return_if_fail(GVIR_CONFIG_IS_OBJECT(node));
    gvir_config_object_set_attribute_with_type(node, "type",
                                               GVIR_CONFIG_TYPE_DOMAIN_VIDEO_MODEL,
                                               model,
                                               NULL);
    g_object_unref(G_OBJECT(node));
}