diff options
| author | Jeff Schiller <codedread@gmail.com> | 2008-08-23 06:16:49 +0000 |
|---|---|---|
| committer | jeff_schiller <jeff_schiller@users.sourceforge.net> | 2008-08-23 06:16:49 +0000 |
| commit | 7973e54214c9e342b4c640634c83d60d61248b2c (patch) | |
| tree | e5f259d6c1f9972b7f68684645d8e75d369b7685 /src/dialogs | |
| parent | Support for title and desc elements when serializing as Plain SVG. (diff) | |
| download | inkscape-7973e54214c9e342b4c640634c83d60d61248b2c.tar.gz inkscape-7973e54214c9e342b4c640634c83d60d61248b2c.zip | |
Update to sync metadata title to the document title.
(bzr r6710)
Diffstat (limited to 'src/dialogs')
| -rw-r--r-- | src/dialogs/rdf.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/dialogs/rdf.cpp b/src/dialogs/rdf.cpp index 320608e9a..70cac4e1f 100644 --- a/src/dialogs/rdf.cpp +++ b/src/dialogs/rdf.cpp @@ -23,6 +23,7 @@ #include "xml/repr.h" #include "rdf.h" #include "sp-item-group.h" +#include "inkscape.h" /* @@ -538,6 +539,12 @@ rdf_set_repr_text ( Inkscape::XML::Node * repr, Inkscape::XML::Document * xmldoc = parent->document(); g_return_val_if_fail (xmldoc != NULL, FALSE); + // set document's title element to the RDF title + if (!strcmp(entity->name, "title")) { + SPDocument *doc = SP_ACTIVE_DOCUMENT; + if(doc && doc->root) doc->root->setTitle(text); + } + switch (entity->datatype) { case RDF_CONTENT: temp = sp_repr_children(parent); @@ -779,17 +786,21 @@ rdf_get_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity) g_return_val_if_fail (doc != NULL, NULL); if ( entity == NULL ) return NULL; //printf("want '%s'\n",entity->title); + bool bIsTitle = !strcmp(entity->name, "title"); Inkscape::XML::Node * item; if ( entity->datatype == RDF_XML ) { item = rdf_get_xml_repr ( doc, entity->tag, FALSE ); } else { - item = rdf_get_work_repr( doc, entity->tag, FALSE ); + item = rdf_get_work_repr( doc, entity->tag, bIsTitle ); // build title if necessary } if ( item == NULL ) return NULL; - const gchar * result = rdf_get_repr_text ( item, entity ); + if(!result && bIsTitle && doc->root) { // if RDF title not set + result = doc->root->title(); // get the document's <title> + rdf_set_work_entity(doc, entity, result); // and set the RDF + } //printf("found '%s' == '%s'\n", entity->title, result ); return result; } |
