From: mental Date: Sat, 29 Jul 2006 21:00:34 +0000 (+0000) Subject: switch to sigc++ SPObject signals for SPDocument X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=40e293484b1aa3e95dc866d5d2ef298c3cba243a;p=inkscape.git switch to sigc++ SPObject signals for SPDocument --- diff --git a/ChangeLog b/ChangeLog index ec994c951..c4869d4fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ 2006-06-29 MenTaLguY - * 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/desktop.cpp, src/desktop.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/desktop.cpp b/src/desktop.cpp index b41862704..189ab9866 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -88,7 +88,7 @@ static void _layer_deactivated(SPObject *layer, SPDesktop *desktop); static void _layer_hierarchy_changed(SPObject *top, SPObject *bottom, SPDesktop *desktop); static void _reconstruction_start(SPDesktop * desktop); static void _reconstruction_finish(SPDesktop * desktop); -static void _namedview_modified (SPNamedView *nv, guint flags, SPDesktop *desktop); +static void _namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop); static void _update_snap_distances (SPDesktop *desktop); /** @@ -224,8 +224,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) _doc2dt[5] = sp_document_height (document); sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), _doc2dt); - g_signal_connect (G_OBJECT (namedview), "modified", G_CALLBACK (_namedview_modified), this); - + _modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this)); NRArenaItem *ai = sp_item_invoke_show (SP_ITEM (sp_document_root (document)), SP_CANVAS_ARENA (drawing)->arena, @@ -295,6 +294,7 @@ void SPDesktop::destroy() _deactivate_connection.disconnect(); _sel_modified_connection.disconnect(); _sel_changed_connection.disconnect(); + _modified_connection.disconnect(); while (event_context) { SPEventContext *ec = event_context; @@ -319,7 +319,7 @@ void SPDesktop::destroy() delete _guides_message_context; _guides_message_context = NULL; - sp_signal_disconnect_by_data (G_OBJECT (namedview), this); + _modified_connection.disconnect(); g_list_free (zooms_past); g_list_free (zooms_future); @@ -1086,7 +1086,7 @@ SPDesktop::setDocument (SPDocument *doc) NRArenaItem *ai; namedview = sp_document_namedview (doc, NULL); - g_signal_connect (G_OBJECT (namedview), "modified", G_CALLBACK (_namedview_modified), this); + _modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this)); number = namedview->getViewCount(); ai = sp_item_invoke_show (SP_ITEM (sp_document_root (doc)), @@ -1256,8 +1256,10 @@ _reconstruction_finish (SPDesktop * desktop) * Namedview_modified callback. */ static void -_namedview_modified (SPNamedView *nv, guint flags, SPDesktop *desktop) +_namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop) { + SPNamedView *nv=SP_NAMEDVIEW(obj); + if (flags & SP_OBJECT_MODIFIED_FLAG) { /* Recalculate snap distances */ diff --git a/src/desktop.h b/src/desktop.h index 8e31e2e7d..e499358c7 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -266,6 +266,7 @@ private: sigc::connection _reconstruction_start_connection; sigc::connection _reconstruction_finish_connection; sigc::connection _commit_connection; + sigc::connection _modified_connection; virtual void onPositionSet (double, double); virtual void onResized (double, double);