From c31f12ada683e302beb99dbc6eaea5d6d1205ab2 Mon Sep 17 00:00:00 2001 From: John Smith Date: Wed, 28 Nov 2012 09:44:24 +0900 Subject: Fix for 1071421 : Setting swatch as fill/stroke creates new swatches which never go away (bzr r11911) --- src/gradient-chemistry.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/gradient-chemistry.cpp') diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 0038e9325..6b019ad2a 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -27,6 +27,7 @@ #include "style.h" #include "document-private.h" #include "document-undo.h" +#include "desktop.h" #include "desktop-style.h" #include "desktop-handles.h" #include "event-context.h" @@ -1592,6 +1593,23 @@ void sp_gradient_reverse_selected_gradients(SPDesktop *desktop) _("Reverse gradient")); } +void sp_gradient_unset_swatch(SPDesktop *desktop, std::string id) +{ + SPDocument *doc = desktop ? desktop->doc() : 0; + + if (doc) { + const GSList *gradients = doc->getResourceList("gradient"); + for (const GSList *item = gradients; item; item = item->next) { + SPGradient* grad = SP_GRADIENT(item->data); + if ( id == grad->getId() ) { + grad->setSwatch(false); + DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, + _("Delete swatch")); + break; + } + } + } +} /* Local Variables: mode:c++ -- cgit v1.2.3