Code

switch to sigc++ SPObject signals for SPPattern
authormental <mental@users.sourceforge.net>
Sat, 29 Jul 2006 21:12:13 +0000 (21:12 +0000)
committermental <mental@users.sourceforge.net>
Sat, 29 Jul 2006 21:12:13 +0000 (21:12 +0000)
ChangeLog
src/sp-pattern.cpp
src/sp-pattern.h

index 9cb88be4f034ac5ad122a93a67bef581cdf1d9c6..af5c3eb0b2c653b3e85e007ba7aafacf97173442 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,10 @@
 2006-06-29  MenTaLguY  <mental@rydia.net>
 
        * src/desktop.cpp, src/desktop.h, src/sp-gradient.cpp,
-         src/sp-gradient.cpp, src/widgets/desktop-widget.cpp,
-         src/widgets/desktop-widget.h, src/widgets/gradient-image.cpp,
-         src/widgets/gradient-image.h, src/widgets/gradient-toolbar.cpp,
-         src/widgets/gradient-toolbar.cpp:
+         src/sp-gradient.h, src/sp-pattern.cpp, src/sp-pattern.h,
+         src/widgets/desktop-widget.cpp, src/widgets/desktop-widget.h,
+         src/widgets/gradient-image.cpp, src/widgets/gradient-image.h,
+         src/widgets/gradient-toolbar.cpp, src/widgets/gradient-toolbar.cpp:
 
          switch to sigc++ SPObject signals
 
index 85a8ad649634f533bb5c8a6332fa9940e74f77c1..89eeacec4f5d008679b3c8a356ddae8e2d71576a 100644 (file)
@@ -27,6 +27,9 @@
 #include "sp-pattern.h"
 #include "xml/repr.h"
 
+#include <sigc++/functors/ptr_fun.h>
+#include <sigc++/adaptors/bind.h>
+
 /*
  * Pattern
  */
@@ -137,6 +140,8 @@ sp_pattern_init (SPPattern *pat)
        pat->height.unset();
 
        pat->viewBox_set = FALSE;
+
+       new (&pat->modified_connection) sigc::connection();
 }
 
 static void
@@ -172,13 +177,14 @@ sp_pattern_release (SPObject *object)
        }
 
        if (pat->ref) {
-               if (pat->ref->getObject())
-                       sp_signal_disconnect_by_data(pat->ref->getObject(), pat);
+               pat->modified_connection.disconnect();
                pat->ref->detach();
                delete pat->ref;
                pat->ref = NULL;
        }
 
+       pat->modified_connection.~connection();
+
        if (((SPObjectClass *) pattern_parent_class)->release)
                ((SPObjectClass *) pattern_parent_class)->release (object);
 }
@@ -403,10 +409,10 @@ static void
 pattern_ref_changed(SPObject *old_ref, SPObject *ref, SPPattern *pat)
 {
        if (old_ref) {
-               sp_signal_disconnect_by_data(old_ref, pat);
+               pat->modified_connection.disconnect();
        }
        if (SP_IS_PATTERN (ref)) {
-               g_signal_connect(G_OBJECT (ref), "modified", G_CALLBACK (pattern_ref_modified), pat);
+               pat->modified_connection = ref->connectModified(sigc::bind<2>(sigc::ptr_fun(&pattern_ref_modified), pat));
        }
 
        pattern_ref_modified (ref, 0, pat);
index 42cac7a7e1b449980f0b6efc94109495cadef52b..4d49783fc79fd7ecd3c3fa727ca5558fd3e01845 100644 (file)
@@ -32,6 +32,8 @@ class SPPatternClass;
 #include "sp-paint-server.h"
 #include "uri-references.h"
 
+#include <sigc++/connection.h>
+
 class SPPatternReference : public Inkscape::URIReference {
 public:
         SPPatternReference (SPObject *obj) : URIReference(obj) {}
@@ -70,6 +72,8 @@ struct SPPattern : public SPPaintServer {
        /* VieBox */
        NRRect viewBox;
        guint viewBox_set : 1;
+
+       sigc::connection modified_connection;
 };
 
 struct SPPatternClass {