diff options
| author | MenTaLguY <mental@rydia.net> | 2006-07-29 21:06:37 +0000 |
|---|---|---|
| committer | mental <mental@users.sourceforge.net> | 2006-07-29 21:06:37 +0000 |
| commit | 3667b4dfe17238375df09a3c5d9fa20196129d7a (patch) | |
| tree | 2b326c78c9fa4d8d6ee1db607bf9b59fa8cc9271 /src | |
| parent | switch to sigc++ SPObject signals for SPDocument (diff) | |
| download | inkscape-3667b4dfe17238375df09a3c5d9fa20196129d7a.tar.gz inkscape-3667b4dfe17238375df09a3c5d9fa20196129d7a.zip | |
switch to sigc++ SPObject signals for SPGradient
(bzr r1508)
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp-gradient.cpp | 14 | ||||
| -rw-r--r-- | src/sp-gradient.h | 4 |
2 files changed, 13 insertions, 5 deletions
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 <libnr/nr-matrix-translate-ops.h> #include "libnr/nr-scale-translate-ops.h" +#include <sigc++/functors/ptr_fun.h> +#include <sigc++/adaptors/bind.h> #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 <sigc++/connection.h> + 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; }; /** |
