Code

a quick workaround in order to avoid some invalid names for icc profiles.
authorJucaBlues <JucaBlues@users.sourceforge.net>
Fri, 14 Aug 2009 03:52:51 +0000 (03:52 +0000)
committerJucaBlues <JucaBlues@users.sourceforge.net>
Fri, 14 Aug 2009 03:52:51 +0000 (03:52 +0000)
A complete sanitizer should be implemented later.

src/ui/dialog/document-properties.cpp

index bb9ab4d02676343fb26ced97b0d0841e4530a19f..c21f646291619477140f1f96c0f106a4733a8664 100644 (file)
@@ -381,6 +381,17 @@ DocumentProperties::populate_available_profiles(){
     _menu.show_all();
 }
 
+//this is a quick workaround:
+static gchar* sanitize_name(gchar* name){
+    gchar* c=name;
+    while (*c != '\0'){
+        if (*c == ' ') *c = '-';
+        if (*c == '_') *c = '-';
+        c++;
+    }
+    return name;
+}
+
 void
 DocumentProperties::linkSelectedProfile()
 {
@@ -396,7 +407,8 @@ DocumentProperties::linkSelectedProfile()
         }
         Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
         Inkscape::XML::Node *cprofRepr = xml_doc->createElement("svg:color-profile");
-        cprofRepr->setAttribute("name", (gchar*) _menu.get_active()->get_data("name"));
+//        cprofRepr->setAttribute("inkscape:name", (gchar*) _menu.get_active()->get_data("name"));
+        cprofRepr->setAttribute("name", sanitize_name((gchar*) _menu.get_active()->get_data("name")));
         cprofRepr->setAttribute("xlink:href", (gchar*) _menu.get_active()->get_data("filepath"));
 
         // Checks whether there is a defs element. Creates it when needed