index c2d3446296ed450f20e41e2526a15fa262922766..b5ac861e13b4665b5ae1bf313fe0b34db5f2d300 100644 (file)
--- a/src/profile-manager.cpp
+++ b/src/profile-manager.cpp
#include "profile-manager.h"
#include "document.h"
+#include "color-profile.h"
namespace Inkscape {
ProfileManager::~ProfileManager()
{
+ _resource_connection.disconnect();
+ _doc = 0;
}
void ProfileManager::_resourcesChanged()
{
std::vector<SPObject*> newList;
- const GSList *current = sp_document_get_resource_list( _doc, "iccprofile" );
- while ( current ) {
- newList.push_back(SP_OBJECT(current->data));
- current = g_slist_next(current);
+ if (_doc) {
+ const GSList *current = sp_document_get_resource_list( _doc, "iccprofile" );
+ while ( current ) {
+ newList.push_back(SP_OBJECT(current->data));
+ current = g_slist_next(current);
+ }
}
sort( newList.begin(), newList.end() );
}
}
+ColorProfile* ProfileManager::find(gchar const* name)
+{
+ ColorProfile* match = 0;
+ if ( name ) {
+ unsigned int howMany = childCount(NULL);
+ for ( unsigned int index = 0; index < howMany; index++ ) {
+ SPObject *obj = nthChildOf(NULL, index);
+ ColorProfile* prof = reinterpret_cast<ColorProfile*>(obj);
+ if ( prof && prof->name && !strcmp(name, prof->name) ) {
+ match = prof;
+ break;
+ }
+ }
+ }
+ return match;
+}
}