Code

switch to sigc++ SPObject signals for SPUsePathReference
authormental <mental@users.sourceforge.net>
Fri, 28 Jul 2006 03:42:38 +0000 (03:42 +0000)
committermental <mental@users.sourceforge.net>
Fri, 28 Jul 2006 03:42:38 +0000 (03:42 +0000)
ChangeLog
src/sp-use-reference.cpp
src/sp-use-reference.h

index 0f7ee39e57e09d494fcf6fbbf783a023f3b9a822..ce423c3c21d45cd3de045a0d673479410dcecc70 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,8 @@
 
        * src/dialogs/sp-attribute-widget.cpp,
          src/dialogs/sp-attribute-widget.h, src/sp-offset.cpp,
-         src/sp-offset.h, src/sp-shape.cpp, src/sp-shape.h:
+         src/sp-offset.h, src/sp-shape.cpp, src/sp-shape.h,
+         src/sp-use-reference.cpp, src/sp-use-reference.h:
 
          switch to sigc++ SPObject signals
 
index 9e304799876e359a48449e9f8ef7687c2a911953..8e65593c1aef7c2f10ba598941da3d5034aa7b61 100644 (file)
@@ -39,7 +39,7 @@ bool SPUseReference::_acceptObject(SPObject * const obj) const
 static void sp_usepath_href_changed(SPObject *old_ref, SPObject *ref, SPUsePath *offset);
 static void sp_usepath_move_compensate(NR::Matrix const *mp, SPItem *original, SPUsePath *self);
 static void sp_usepath_delete_self(SPObject *deleted, SPUsePath *offset);
-static void sp_usepath_source_modified(SPObject *iSource, guint flags, SPItem *item);
+static void sp_usepath_source_modified(SPObject *iSource, guint flags, SPUsePath *offset);
 
 SPUsePath::SPUsePath(SPObject* i_owner):SPUseReference(i_owner)
 {
@@ -49,6 +49,7 @@ SPUsePath::SPUsePath(SPObject* i_owner):SPUseReference(i_owner)
     sourceHref = NULL;
     sourceRepr = NULL;
     sourceObject = NULL;
+    new (&_modified_connection) sigc::connection();
     new (&_delete_connection) sigc::connection();
     new (&_changed_connection) sigc::connection();
     new (&_transformed_connection) sigc::connection();
@@ -67,6 +68,7 @@ SPUsePath::~SPUsePath(void)
     quit_listening();
     unlink();
 
+    _modified_connection.~connection();
     _delete_connection.~connection();
     _changed_connection.~connection();
     _transformed_connection.~connection();
@@ -113,7 +115,7 @@ SPUsePath::start_listening(SPObject* to)
     sourceRepr = SP_OBJECT_REPR(to);
     _delete_connection = to->connectDelete(sigc::bind(sigc::ptr_fun(&sp_usepath_delete_self), this));
     _transformed_connection = SP_ITEM(to)->connectTransformed(sigc::bind(sigc::ptr_fun(&sp_usepath_move_compensate), this));
-    _modified_connection = g_signal_connect(G_OBJECT(to), "modified", G_CALLBACK(sp_usepath_source_modified), this);
+    _modified_connection = to->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_usepath_source_modified), this));
 }
 
 void
@@ -122,7 +124,7 @@ SPUsePath::quit_listening(void)
     if ( sourceObject == NULL ) {
         return;
     }
-    g_signal_handler_disconnect(sourceObject, _modified_connection);
+    _modified_connection.disconnect();
     _delete_connection.disconnect();
     _transformed_connection.disconnect();
     sourceRepr = NULL;
@@ -196,9 +198,8 @@ sp_usepath_delete_self(SPObject */*deleted*/, SPUsePath *offset)
 }
 
 static void
-sp_usepath_source_modified(SPObject *iSource, guint flags, SPItem *item)
+sp_usepath_source_modified(SPObject *iSource, guint flags, SPUsePath *offset)
 {
-    SPUsePath *offset = (SPUsePath*)item;
     offset->sourceDirty = true;
     offset->owner->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
 }
index 910ac709f80d5188d67a9b598bfbda689afae132..6feaaa1ed95255aca08d04e4345075d8662e43fd 100644 (file)
@@ -45,7 +45,7 @@ public:
   Inkscape::XML::Node         *sourceRepr;
        SPObject                         *sourceObject;
        
-       gulong           _modified_connection;
+        sigc::connection _modified_connection;
        sigc::connection _delete_connection;
        sigc::connection _changed_connection;
        sigc::connection _transformed_connection;