Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

void rdf_set_license ( SPDocument doc,
struct rdf_license_t const *  license 
)

Stores an RDF/License XML in the document XML.

Parameters:
documentWhich document to update
licenseThe desired RDF/License structure to store; NULL drops old license, so can be used for proprietary license.

Definition at line 945 of file rdf.cpp.

References Inkscape::XML::Node::appendChild(), Inkscape::GC::release(), Inkscape::XML::Node::setAttribute(), and sp_repr_unparent().

Referenced by Inkscape::UI::Widget::LicenseItem::on_toggled().

{
    // drop old license section
    Inkscape::XML::Node * repr = rdf_get_xml_repr ( doc, XML_TAG_NAME_LICENSE, FALSE );
    if (repr) sp_repr_unparent(repr);

    if (!license) return;

    // build new license section
    repr = rdf_get_xml_repr ( doc, XML_TAG_NAME_LICENSE, TRUE );
    g_assert ( repr );

    repr->setAttribute("rdf:about", license->uri );

    Inkscape::XML::Document * xmldoc = sp_document_repr_doc(doc);
    g_return_if_fail (xmldoc != NULL);

    for (struct rdf_double_t const * detail = license->details;
         detail->name; detail++) {
        Inkscape::XML::Node * child = xmldoc->createElement( detail->name );
        g_assert ( child != NULL );

        child->setAttribute("rdf:resource", detail->resource );
        repr->appendChild(child);
        Inkscape::GC::release(child);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index