diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp
index e2e40340f6dff1d4d94e3594eba369429aa21585..e6a34852d9dc6c2baf7bda49d03fe96b96eee526 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;
};
void LayerManager::setCurrentLayer( SPObject* obj )
{
- _desktop->setCurrentLayer( obj );
+ //g_return_if_fail( _desktop->currentRoot() );
+ if ( _desktop->currentRoot() ) {
+ _desktop->setCurrentLayer( obj );
- if ( prefs_get_int_attribute_limited("options.selection", "layerdeselect", 1, 0, 1) ) {
- sp_desktop_selection( _desktop )->clear();
+ if ( prefs_get_int_attribute_limited("options.selection", "layerdeselect", 1, 0, 1) ) {
+ sp_desktop_selection( _desktop )->clear();
+ }
}
}
Glib::ustring base(incoming);
guint startNum = 1;
- size_t pos = base.rfind('#');
+ Glib::ustring::size_type pos = base.rfind('#');
if ( pos != Glib::ustring::npos ) {
gchar* numpart = g_strdup(base.substr(pos+1).c_str());
if ( numpart ) {
_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);