From: mental Date: Sat, 29 Jul 2006 21:06:37 +0000 (+0000) Subject: switch to sigc++ SPObject signals for SPGradient X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=02a3bc1e3a33a11493dbcda225ebad8a952f6735;p=inkscape.git switch to sigc++ SPObject signals for SPGradient --- diff --git a/ChangeLog b/ChangeLog index c4869d4fe..9cb88be4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2006-06-29 MenTaLguY - * src/desktop.cpp, src/desktop.h, src/widgets/desktop-widget.cpp, + * 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: diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp index dd7b7b257..2e6d2a37c 100644 --- a/src/sp-gradient.cpp +++ b/src/sp-gradient.cpp @@ -26,6 +26,8 @@ #include #include "libnr/nr-scale-translate-ops.h" +#include +#include #include "display/nr-gradient-gpl.h" #include "svg/svg.h" @@ -377,6 +379,8 @@ sp_gradient_init(SPGradient *gr) gr->vector.stops.clear(); gr->color = NULL; + + new (&gr->modified_connection) sigc::connection(); } /** @@ -425,9 +429,7 @@ sp_gradient_release(SPObject *object) } if (gradient->ref) { - if (gradient->ref->getObject()) { - sp_signal_disconnect_by_data(gradient->ref->getObject(), gradient); - } + gradient->modified_connection.disconnect(); gradient->ref->detach(); delete gradient->ref; gradient->ref = NULL; @@ -438,6 +440,8 @@ sp_gradient_release(SPObject *object) gradient->color = NULL; } + gradient->modified_connection.~connection(); + if (((SPObjectClass *) gradient_parent_class)->release) ((SPObjectClass *) gradient_parent_class)->release(object); } @@ -518,12 +522,12 @@ static void gradient_ref_changed(SPObject *old_ref, SPObject *ref, SPGradient *gr) { if (old_ref) { - sp_signal_disconnect_by_data(old_ref, gr); + gr->modified_connection.disconnect(); } if ( SP_IS_GRADIENT(ref) && ref != gr ) { - g_signal_connect(G_OBJECT(ref), "modified", G_CALLBACK(gradient_ref_modified), gr); + gr->modified_connection = ref->connectModified(sigc::bind<2>(sigc::ptr_fun(&gradient_ref_modified), gr)); } /// \todo Fixme: what should the flags (second) argument be? */ gradient_ref_modified(ref, 0, gr); diff --git a/src/sp-gradient.h b/src/sp-gradient.h index 9c152598b..b0ed49c00 100644 --- a/src/sp-gradient.h +++ b/src/sp-gradient.h @@ -20,6 +20,8 @@ #include "sp-gradient-units.h" #include "sp-gradient-vector.h" +#include + struct SPGradientReference; typedef enum { @@ -69,6 +71,8 @@ struct SPGradient : public SPPaintServer { SPGradientVector vector; /** Rendered color array (4 * 1024 bytes) */ guchar *color; + + sigc::connection modified_connection; }; /**