summaryrefslogtreecommitdiffstats
path: root/src/widgets/gradient-selector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/gradient-selector.cpp')
-rw-r--r--src/widgets/gradient-selector.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp
index 402f30846..604ecd108 100644
--- a/src/widgets/gradient-selector.cpp
+++ b/src/widgets/gradient-selector.cpp
@@ -17,10 +17,6 @@
# include "config.h"
#endif
-#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
-#include <glibmm/threads.h>
-#endif
-
#include <gtkmm/treeview.h>
#include "gradient-vector.h"
@@ -555,6 +551,10 @@ sp_gradient_selector_add_vector_clicked (GtkWidget */*w*/, SPGradientSelector *s
if (gr) {
repr = gr->getRepr()->duplicate(xml_doc);
+ // Rename the new gradients id to be similar to the cloned gradients
+ Glib::ustring old_id = gr->getId();
+ rename_id(gr, old_id);
+ doc->getDefs()->getRepr()->addChild(repr, NULL);
} else {
repr = xml_doc->createElement("svg:linearGradient");
Inkscape::XML::Node *stop = xml_doc->createElement("svg:stop");
@@ -567,17 +567,10 @@ sp_gradient_selector_add_vector_clicked (GtkWidget */*w*/, SPGradientSelector *s
stop->setAttribute("style", "stop-color:#fff;stop-opacity:1;");
repr->appendChild(stop);
Inkscape::GC::release(stop);
+ doc->getDefs()->getRepr()->addChild(repr, NULL);
+ gr = SP_GRADIENT(doc->getObjectByRepr(repr));
}
-
- doc->getDefs()->getRepr()->addChild(repr, NULL);
-
- Glib::ustring old_id = gr->getId();
-
- gr = SP_GRADIENT(doc->getObjectByRepr(repr));
-
- // Rename the new gradients id to be similar to the cloned gradients
- rename_id(gr, old_id);
-
+
sp_gradient_vector_selector_set_gradient( SP_GRADIENT_VECTOR_SELECTOR (sel->vectors), doc, gr);
sel->selectGradientInTree(gr);