From 5e6d8ac87c28d9a01a75e95efa8752e0c20d8deb Mon Sep 17 00:00:00 2001 From: mental Date: Sat, 29 Jul 2006 21:12:13 +0000 Subject: [PATCH] switch to sigc++ SPObject signals for SPPattern --- ChangeLog | 8 ++++---- src/sp-pattern.cpp | 14 ++++++++++---- src/sp-pattern.h | 4 ++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9cb88be4f..af5c3eb0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,10 @@ 2006-06-29 MenTaLguY * 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 diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 85a8ad649..89eeacec4 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -27,6 +27,9 @@ #include "sp-pattern.h" #include "xml/repr.h" +#include +#include + /* * 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); diff --git a/src/sp-pattern.h b/src/sp-pattern.h index 42cac7a7e..4d49783fc 100644 --- a/src/sp-pattern.h +++ b/src/sp-pattern.h @@ -32,6 +32,8 @@ class SPPatternClass; #include "sp-paint-server.h" #include "uri-references.h" +#include + 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 { -- 2.30.2