Code

Switched pen and pencil toobars to stock GTK+ toolbars
[inkscape.git] / src / widgets / gradient-selector.cpp
index 3177700c3601c9f35f127b3c12960bafa97428f4..88a04bd7a115b6de797b33c7a7fb775d92ed8709 100644 (file)
@@ -22,6 +22,7 @@
 #include <gtk/gtkmenuitem.h>
 #include <gtk/gtktooltips.h>
 
+#include "document.h"
 #include "../document-private.h"
 #include "../gradient-chemistry.h"
 
@@ -304,22 +305,24 @@ sp_gradient_selector_add_vector_clicked (GtkWidget *w, SPGradientSelector *sel)
        SPDocument *doc;
        SPGradient *gr;
        Inkscape::XML::Node *repr;
+        Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
 
        doc = sp_gradient_vector_selector_get_document (SP_GRADIENT_VECTOR_SELECTOR (sel->vectors));
        if (!doc) return;
        gr = sp_gradient_vector_selector_get_gradient (SP_GRADIENT_VECTOR_SELECTOR (sel->vectors));
 
        if (gr) {
-               repr = SP_OBJECT_REPR (gr)->duplicate();
+               repr = SP_OBJECT_REPR (gr)->duplicate(xml_doc);
        } else {
+               Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
                Inkscape::XML::Node *stop;
-               repr = sp_repr_new ("svg:linearGradient");
-               stop = sp_repr_new ("svg:stop");
+               repr = xml_doc->createElement("svg:linearGradient");
+               stop = xml_doc->createElement("svg:stop");
                stop->setAttribute("offset", "0");
                stop->setAttribute("style", "stop-color:#000;stop-opacity:1;");
                repr->appendChild(stop);
                Inkscape::GC::release(stop);
-               stop = sp_repr_new ("svg:stop");
+               stop = xml_doc->createElement("svg:stop");
                stop->setAttribute("offset", "1");
                stop->setAttribute("style", "stop-color:#fff;stop-opacity:1;");
                repr->appendChild(stop);