diff options
| author | Liam P. White <inkscapebrony@gmail.com> | 2014-08-10 02:47:25 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebrony@gmail.com> | 2014-08-10 02:47:25 +0000 |
| commit | 764f8e7612bbf000a5fab4eeed165432f4ff779b (patch) | |
| tree | ee2a1c55b35548b5d585c80c99de4860c0fb448f /src/widgets/node-toolbar.cpp | |
| parent | Update to trunk r13504 (diff) | |
| download | inkscape-764f8e7612bbf000a5fab4eeed165432f4ff779b.tar.gz inkscape-764f8e7612bbf000a5fab4eeed165432f4ff779b.zip | |
Further fixes related to bug #1327267, toolbars don't need to update when their context is not in use
(bzr r13341.1.126)
Diffstat (limited to '')
| -rw-r--r-- | src/widgets/node-toolbar.cpp | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/widgets/node-toolbar.cpp b/src/widgets/node-toolbar.cpp index 38e3f4fbd..20bf2f7b9 100644 --- a/src/widgets/node-toolbar.cpp +++ b/src/widgets/node-toolbar.cpp @@ -322,7 +322,7 @@ static void sp_node_toolbox_sel_modified(Inkscape::Selection *selection, guint / sp_node_toolbox_sel_changed (selection, tbl); } - +static void node_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder); //################################ //## Node Editing Toolbox ## @@ -615,32 +615,33 @@ void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje gtk_action_group_add_action( mainActions, act ); } - sp_node_toolbox_sel_changed(sp_desktop_selection(desktop), holder); + desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(node_toolbox_watch_ec), holder)); - //watch selection - Inkscape::ConnectionPool* pool = Inkscape::ConnectionPool::new_connection_pool ("ISNodeToolbox"); - - sigc::connection *c_selection_changed = - new sigc::connection (sp_desktop_selection (desktop)->connectChanged - (sigc::bind (sigc::ptr_fun (sp_node_toolbox_sel_changed), holder))); - pool->add_connection ("selection-changed", c_selection_changed); - - sigc::connection *c_selection_modified = - new sigc::connection (sp_desktop_selection (desktop)->connectModified - (sigc::bind (sigc::ptr_fun (sp_node_toolbox_sel_modified), holder))); - pool->add_connection ("selection-modified", c_selection_modified); - - sigc::connection *c_subselection_changed = - new sigc::connection (desktop->connectToolSubselectionChanged - (sigc::bind (sigc::ptr_fun (sp_node_toolbox_coord_changed), holder))); - pool->add_connection ("tool-subselection-changed", c_subselection_changed); +} // end of sp_node_toolbox_prep() - Inkscape::ConnectionPool::connect_destroy (G_OBJECT (holder), pool); +static void node_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder) +{ + static sigc::connection c_selection_changed; + static sigc::connection c_selection_modified; + static sigc::connection c_subselection_changed; - g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder ); -} // end of sp_node_toolbox_prep() + if (INK_IS_NODE_TOOL(ec)) { + // watch selection + c_selection_changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_node_toolbox_sel_changed), holder)); + c_selection_modified = sp_desktop_selection(desktop)->connectModified(sigc::bind(sigc::ptr_fun(sp_node_toolbox_sel_modified), holder)); + c_subselection_changed = desktop->connectToolSubselectionChanged(sigc::bind(sigc::ptr_fun(sp_node_toolbox_coord_changed), holder)); + sp_node_toolbox_sel_changed(sp_desktop_selection(desktop), holder); + } else { + if (c_selection_changed) + c_selection_changed.disconnect(); + if (c_selection_modified) + c_selection_modified.disconnect(); + if (c_subselection_changed) + c_subselection_changed.disconnect(); + } +} /* |
