From: mental Date: Sat, 29 Jul 2006 20:09:47 +0000 (+0000) Subject: switch to sigc++ SPObject signals for SPGradientImage X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9959e9b99db6077ed1abfc5caa0e03861ae0a305;p=inkscape.git switch to sigc++ SPObject signals for SPGradientImage --- diff --git a/ChangeLog b/ChangeLog index 3031f428a..0053906a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2006-06-29 MenTaLguY - * src/widgets/gradient-toolbar.cpp, src/widgets/gradient-toolbar.cpp: + * 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/widgets/gradient-image.cpp b/src/widgets/gradient-image.cpp index 38300426d..2393e407a 100644 --- a/src/widgets/gradient-image.cpp +++ b/src/widgets/gradient-image.cpp @@ -17,8 +17,12 @@ #include "../display/nr-plain-stuff.h" #include "../display/nr-plain-stuff-gdk.h" #include "gradient-image.h" +#include "sp-gradient.h" #include "sp-gradient-fns.h" +#include +#include + #define VBLOCK 16 static void sp_gradient_image_class_init (SPGradientImageClass *klass); @@ -31,8 +35,8 @@ static void sp_gradient_image_size_request (GtkWidget *widget, GtkRequisition *r static void sp_gradient_image_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static gint sp_gradient_image_expose (GtkWidget *widget, GdkEventExpose *event); -static void sp_gradient_image_gradient_release (SPGradient *gr, SPGradientImage *im); -static void sp_gradient_image_gradient_modified (SPGradient *gr, guint flags, SPGradientImage *im); +static void sp_gradient_image_gradient_release (SPObject *, SPGradientImage *im); +static void sp_gradient_image_gradient_modified (SPObject *, guint flags, SPGradientImage *im); static void sp_gradient_image_update (SPGradientImage *img); static GtkWidgetClass *parent_class; @@ -82,6 +86,9 @@ sp_gradient_image_init (SPGradientImage *image) image->gradient = NULL; image->px = NULL; + + new (&image->release_connection) sigc::connection(); + new (&image->modified_connection) sigc::connection(); } static void @@ -92,10 +99,14 @@ sp_gradient_image_destroy (GtkObject *object) image = SP_GRADIENT_IMAGE (object); if (image->gradient) { - sp_signal_disconnect_by_data (image->gradient, image); + image->release_connection.disconnect(); + image->modified_connection.disconnect(); image->gradient = NULL; } + image->release_connection.~connection(); + image->modified_connection.~connection(); + if (((GtkObjectClass *) (parent_class))->destroy) (* ((GtkObjectClass *) (parent_class))->destroy) (object); } @@ -217,24 +228,26 @@ void sp_gradient_image_set_gradient (SPGradientImage *image, SPGradient *gradient) { if (image->gradient) { - sp_signal_disconnect_by_data (image->gradient, image); + image->release_connection.disconnect(); + image->modified_connection.disconnect(); } image->gradient = gradient; if (gradient) { - g_signal_connect (G_OBJECT (gradient), "release", G_CALLBACK (sp_gradient_image_gradient_release), image); - g_signal_connect (G_OBJECT (gradient), "modified", G_CALLBACK (sp_gradient_image_gradient_modified), image); + image->release_connection = gradient->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_gradient_image_gradient_release), image)); + image->modified_connection = gradient->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_gradient_image_gradient_modified), image)); } sp_gradient_image_update (image); } static void -sp_gradient_image_gradient_release (SPGradient *gradient, SPGradientImage *image) +sp_gradient_image_gradient_release (SPObject *, SPGradientImage *image) { if (image->gradient) { - sp_signal_disconnect_by_data (image->gradient, image); + image->release_connection.disconnect(); + image->modified_connection.disconnect(); } image->gradient = NULL; @@ -243,7 +256,7 @@ sp_gradient_image_gradient_release (SPGradient *gradient, SPGradientImage *image } static void -sp_gradient_image_gradient_modified (SPGradient *gradient, guint flags, SPGradientImage *image) +sp_gradient_image_gradient_modified (SPObject *, guint flags, SPGradientImage *image) { sp_gradient_image_update (image); } diff --git a/src/widgets/gradient-image.h b/src/widgets/gradient-image.h index 0e0241ac7..d0864b6e8 100644 --- a/src/widgets/gradient-image.h +++ b/src/widgets/gradient-image.h @@ -19,6 +19,7 @@ class SPGradient; #include +#include #define SP_TYPE_GRADIENT_IMAGE (sp_gradient_image_get_type ()) #define SP_GRADIENT_IMAGE(o) (GTK_CHECK_CAST ((o), SP_TYPE_GRADIENT_IMAGE, SPGradientImage)) @@ -30,6 +31,9 @@ struct SPGradientImage { GtkWidget widget; SPGradient *gradient; guchar *px; + + sigc::connection release_connection; + sigc::connection modified_connection; }; struct SPGradientImageClass {