From: mental Date: Sat, 29 Jul 2006 21:25:37 +0000 (+0000) Subject: switch to sigc++ SPObject signals for SPSwitch X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1a71e5db977570fb40ad8689ee7a31ecc7540f11;p=inkscape.git switch to sigc++ SPObject signals for SPSwitch --- diff --git a/ChangeLog b/ChangeLog index af5c3eb0b..056d54fc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,9 +2,10 @@ * src/desktop.cpp, src/desktop.h, src/sp-gradient.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: + src/sp-switch.cpp, src/sp-switch.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-switch.cpp b/src/sp-switch.cpp index 65ecc5442..bafb9de18 100644 --- a/src/sp-switch.cpp +++ b/src/sp-switch.cpp @@ -5,6 +5,7 @@ * * Authors: * Andrius R. + * MenTaLguY * * Copyright (C) 2006 authors * @@ -21,6 +22,9 @@ #include "display/nr-arena-group.h" #include "conditions.h" +#include +#include + static void sp_switch_class_init (SPSwitchClass *klass); static void sp_switch_init (SPSwitch *group); @@ -60,7 +64,7 @@ static void sp_switch_init (SPSwitch *group) group->group = new CSwitch(group); } -CSwitch::CSwitch(SPGroup *group) : CGroup(group), _cached_item(NULL), _release_handler_id(0) { +CSwitch::CSwitch(SPGroup *group) : CGroup(group), _cached_item(NULL) { } CSwitch::~CSwitch() { @@ -133,10 +137,7 @@ void CSwitch::_reevaluate(bool add_to_arena) { } _cached_item = evaluated_child; - _release_handler_id = g_signal_connect( - G_OBJECT(evaluated_child), "release", - G_CALLBACK(&CSwitch::_releaseItem), - this); + _release_connection = evaluated_child->connectRelease(sigc::bind(sigc::ptr_fun(&CSwitch::_releaseItem), this)); _group->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } @@ -151,8 +152,7 @@ void CSwitch::_releaseLastItem(SPObject *obj) if (NULL == _cached_item || _cached_item != obj) return; - g_signal_handler_disconnect(G_OBJECT(_cached_item), _release_handler_id); - _release_handler_id = 0; + _release_connection.disconnect(); _cached_item = NULL; } diff --git a/src/sp-switch.h b/src/sp-switch.h index 421d562ab..91fdcae46 100644 --- a/src/sp-switch.h +++ b/src/sp-switch.h @@ -14,6 +14,8 @@ #include "sp-item-group.h" +#include + #define SP_TYPE_SWITCH (CSwitch::getType()) #define SP_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SWITCH, SPSwitch)) #define SP_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SWITCH, SPSwitchClass)) @@ -48,7 +50,7 @@ protected: private: SPObject *_cached_item; - gulong _release_handler_id; + sigc::connection _release_connection; }; struct SPSwitch : public SPGroup {