Code

switch to sigc++ SPObject signals for SPOffset
authormental <mental@users.sourceforge.net>
Fri, 28 Jul 2006 03:18:31 +0000 (03:18 +0000)
committermental <mental@users.sourceforge.net>
Fri, 28 Jul 2006 03:18:31 +0000 (03:18 +0000)
ChangeLog
src/sp-offset.cpp
src/sp-offset.h

index 8f8d200e9a96bcb4702de7ec9863ff89b65f6079..c1addd3705a2f50be68750447c440d23e612e77f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,8 @@
 2006-06-27  MenTaLguY  <mental@rydia.net>
 
-       * src/sp-shape.cpp, src/sp-shape.h:
+       * src/sp-offset.cpp, src/sp-offset.h, src/sp-shape.cpp, src/sp-shape.h:
 
-         switch to sigc++ SPObject signals for SPShape
+         switch to sigc++ SPObject signals
 
 2006-07-26  MenTaLguY  <mental@rydia.net>
 
index 6aead7a548d0775414c1474adffdf26bcbe8bccd..2253bf1e1170dd7b869304d8aa30da7b09667ebe 100644 (file)
@@ -179,6 +179,7 @@ sp_offset_init(SPOffset *offset)
     offset->sourceHref = NULL;
     offset->sourceRepr = NULL;
     offset->sourceObject = NULL;
+    new (&offset->_modified_connection) sigc::connection();
     new (&offset->_delete_connection) sigc::connection();
     new (&offset->_changed_connection) sigc::connection();
     new (&offset->_transformed_connection) sigc::connection();
@@ -196,8 +197,14 @@ sp_offset_finalize(GObject *obj)
     SPOffset *offset = (SPOffset *) obj;
 
     delete offset->sourceRef;
+
+    offset->_modified_connection.disconnect();
+    offset->_modified_connection.~connection();
+    offset->_delete_connection.disconnect();
     offset->_delete_connection.~connection();
+    offset->_changed_connection.disconnect();
     offset->_changed_connection.~connection();
+    offset->_transformed_connection.disconnect();
     offset->_transformed_connection.~connection();
 }
 
@@ -1057,7 +1064,7 @@ static void sp_offset_start_listening(SPOffset *offset,SPObject* to)
 
     offset->_delete_connection = SP_OBJECT(to)->connectDelete(sigc::bind(sigc::ptr_fun(&sp_offset_delete_self), offset));
     offset->_transformed_connection = SP_ITEM(to)->connectTransformed(sigc::bind(sigc::ptr_fun(&sp_offset_move_compensate), offset));
-    offset->_modified_connection = g_signal_connect (G_OBJECT (to), "modified", G_CALLBACK (sp_offset_source_modified), offset);
+    offset->_modified_connection = SP_OBJECT(to)->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_offset_source_modified), offset));
 }
 
 static void sp_offset_quit_listening(SPOffset *offset)
@@ -1065,7 +1072,7 @@ static void sp_offset_quit_listening(SPOffset *offset)
     if ( offset->sourceObject == NULL )
         return;
 
-    g_signal_handler_disconnect (offset->sourceObject, offset->_modified_connection);
+    offset->_modified_connection.disconnect();
     offset->_delete_connection.disconnect();
     offset->_transformed_connection.disconnect();
 
index 52c793d0e2849dab8adadfd1ac50150a9bc806fb..08df8a1eac00ffb81f48647481cc25a2a4781747 100644 (file)
@@ -73,7 +73,7 @@ struct SPOffset : public SPShape {
   Inkscape::XML::Node         *sourceRepr; ///< the repr associated with that id
        SPObject                         *sourceObject;
        
-       gulong           _modified_connection;
+        sigc::connection _modified_connection;
        sigc::connection _delete_connection;
        sigc::connection _changed_connection;
        sigc::connection _transformed_connection;