[dia] [meta info] Store Object:meta:url as <svg:a href="..">



commit a759f2b2358e7d0a37b4ab9b5d345c76b9f9acb4
Author: Hans Breuer <hans breuer org>
Date:   Fri Oct 8 20:51:23 2010 +0200

    [meta info] Store Object:meta:url as <svg:a href="..">

 plug-ins/svg/svg-import.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/svg/svg-import.c b/plug-ins/svg/svg-import.c
index 8d25a99..7707fcf 100644
--- a/plug-ins/svg/svg-import.c
+++ b/plug-ins/svg/svg-import.c
@@ -862,18 +862,31 @@ read_items (xmlNodePtr   startnode,
       /* everything else is treated like a group _without grouping_, i.e. we dive into unknown stuff */
       /* this allows to import stuff generated by 'dot' with links for the nodes */
       GList *moreitems;
+      /* on of the non-grouping elements is <a>, extract possible links */
+      xmlChar *href = xmlGetProp (node, (const xmlChar *)"href");
 
       moreitems = read_items (node->xmlChildrenNode, parent_gs, defs_ht, filename_svg);
       if (moreitems) {
+	if (href) {
+	  GList *subs;
+
+	  for (subs = moreitems; subs != NULL; subs = g_list_next(subs)) {
+	    DiaObject *sub = subs->data;
+
+	    dia_object_set_meta (sub, "url", href);
+	  }
+	}
         items = g_list_concat (items, moreitems);
       }
+      if (href)
+	xmlFree (href);
     }
-    /* remember some additioanl stuff of the current object */
+    /* remember some additional stuff of the current object */
     if (obj) {
-      xmlChar *id = xmlGetProp (node, (const xmlChar *)"id");
-      if (id) {
-	dia_object_set_meta (obj, "id", id);
-	xmlFree (id);
+      xmlChar *val = xmlGetProp (node, (const xmlChar *)"id");
+      if (val) {
+	dia_object_set_meta (obj, "id", val);
+	xmlFree (val);
       }
     }
   }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]