summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0f201e3)
raw | patch | inline | side by side (parent: 0f201e3)
author | mental <mental@users.sourceforge.net> | |
Fri, 21 Jul 2006 21:49:37 +0000 (21:49 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Fri, 21 Jul 2006 21:49:37 +0000 (21:49 +0000) |
ChangeLog | patch | blob | history | |
src/layer-manager.cpp | patch | blob | history | |
src/layer-manager.h | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index 23dafb1eab0aabcd087a21ee8aada01de625f8e4..3839320b8b82d8ed0886afd29cdbf3d69b214a44 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-07-21 MenTaLguY <mental@rydia.net>
+
+ * src/layer-manager.cpp, src/layer-manager.h:
+
+ switch to sigc++ signals and manually clean up signal connections
+ (although it may not be strictly necessary to do so here)
+
2006-07-21 MenTaLguY <mental@rydia.net>
* src/document-subset.cpp, src/object-hierarchy.cpp,
diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp
index 61b0e15bb08cf3c00769f0b830aace539d0b7840..4d92d37c846edf4030e495f9f0bdc24884b1222c 100644 (file)
--- a/src/layer-manager.cpp
+++ b/src/layer-manager.cpp
class LayerManager::LayerWatcher : public Inkscape::XML::NodeObserver {
public:
- LayerWatcher(LayerManager* mgr, SPObject* obj) :
+ LayerWatcher(LayerManager* mgr, SPObject* obj, sigc::connection c) :
_mgr(mgr),
_obj(obj),
+ _connection(c),
_lockedAttr(g_quark_from_string("sodipodi:insensitive")),
_labelAttr(g_quark_from_string("inkscape:label"))
{}
LayerManager* _mgr;
SPObject* _obj;
+ sigc::connection _connection;
GQuark _lockedAttr;
GQuark _labelAttr;
};
_rebuild();
}
-
-void LayerManager::_objectModifiedCB( SPObject* obj, guint flags, LayerManager* mgr )
-{
- mgr->_objectModified( obj, flags );
-}
-
void LayerManager::_objectModified( SPObject* obj, guint flags )
{
_details_changed_signal.emit( obj );
if ( node ) {
node->removeObserver(*one);
}
+ one->_connection.disconnect();
}
}
// Such may have been the cause of bug 1339397.
// See http://sourceforge.net/tracker/index.php?func=detail&aid=1339397&group_id=93438&atid=604306
+
SPObject const *higher = curr;
while ( higher && (SP_OBJECT_PARENT(higher) != root) ) {
higher = SP_OBJECT_PARENT(higher);
}
Node* node = higher ? SP_OBJECT_REPR(higher) : 0;
if ( node && node->parent() ) {
- g_signal_connect( G_OBJECT(curr), "modified", G_CALLBACK( _objectModifiedCB ), this );
+ sigc::connection connection = curr->connectModified(sigc::mem_fun(*this, &LayerManager::_objectModified));
- LayerWatcher* eye = new LayerWatcher(this, curr);
+ LayerWatcher *eye = new LayerWatcher(this, curr, connection);
_watchers.push_back( eye );
SP_OBJECT_REPR(curr)->addObserver(*eye);
diff --git a/src/layer-manager.h b/src/layer-manager.h
index fa710e93803883f792bfedab39b397da57a23f3e..0dec95c978b82218ab985715c1f344c9fcc40f73 100644 (file)
--- a/src/layer-manager.h
+++ b/src/layer-manager.h
#include "gc-finalized.h"
#include "gc-soft-ptr.h"
#include <vector>
+#include <map>
class SPDesktop;
class SPDocument;
friend class LayerWatcher;
class LayerWatcher;
- static void _objectModifiedCB( SPObject* obj, guint flags, LayerManager* mgr );
-
void _objectModified( SPObject* obj, guint flags );
void _setDocument(SPDocument *document);
void _rebuild();