=== modified file 'src/style.cpp' --- src/style.cpp 2014-08-01 09:04:51 +0000 +++ src/style.cpp 2014-08-06 15:44:33 +0000 @@ -1228,6 +1228,7 @@ { g_return_if_fail(style != NULL); g_return_if_fail(path != ""); + std::cout << "sp_style_read_from_prefs: entrance: " << path << "\n"; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); === modified file 'src/widgets/text-toolbar.cpp' --- src/widgets/text-toolbar.cpp 2014-05-30 13:29:49 +0000 +++ src/widgets/text-toolbar.cpp 2014-08-06 15:48:52 +0000 @@ -31,7 +31,6 @@ #include "libnrtype/font-lister.h" #include #include "text-toolbar.h" -#include "connection-pool.h" #include "desktop-handles.h" #include "desktop-style.h" #include "desktop.h" @@ -54,6 +53,7 @@ #include "toolbox.h" #include "ui/icon-names.h" #include "ui/tools/text-tool.h" +#include "ui/tools/tool-base.h" #include "verbs.h" #include "xml/repr.h" @@ -1200,6 +1200,7 @@ selection->setList(selectList); } +static void text_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder); // Define all the "widgets" in the toolbar. void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder) @@ -1622,31 +1623,35 @@ // Is this necessary to call? Shouldn't hurt. sp_text_toolbox_selection_changed(sp_desktop_selection(desktop), holder); - // Watch selection - Inkscape::ConnectionPool* pool = Inkscape::ConnectionPool::new_connection_pool ("ISTextToolboxGTK"); - - sigc::connection *c_selection_changed = - new sigc::connection (sp_desktop_selection (desktop)->connectChanged - (sigc::bind (sigc::ptr_fun (sp_text_toolbox_selection_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_text_toolbox_selection_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_text_toolbox_subselection_changed), holder))); - pool->add_connection ("tool-subselection-changed", c_subselection_changed); - - Inkscape::ConnectionPool::connect_destroy (G_OBJECT (holder), pool); + SP_ACTIVE_DESKTOP->connectEventContextChanged(sigc::bind(sigc::ptr_fun(text_toolbox_watch_ec), holder)); g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder ); } - +static void text_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder) { + using sigc::connection; + using sigc::bind; + using sigc::ptr_fun; + + static connection c_selection_changed; + static connection c_selection_modified; + static connection c_subselection_changed; + + if (SP_IS_TEXT_CONTEXT(ec)) { + // Watch selection + c_selection_changed = connection(sp_desktop_selection(desktop)->connectChanged(bind(ptr_fun(sp_text_toolbox_selection_changed), holder))); + c_selection_modified = connection(sp_desktop_selection (desktop)->connectModified(bind(ptr_fun(sp_text_toolbox_selection_modified), holder))); + c_subselection_changed = connection(desktop->connectToolSubselectionChanged(bind(ptr_fun(sp_text_toolbox_subselection_changed), 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(); + } +} /* Local Variables: mode:c++