summaryrefslogtreecommitdiffstats
path: root/src/widgets/box3d-toolbar.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-08-10 02:47:25 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-08-10 02:47:25 +0000
commit764f8e7612bbf000a5fab4eeed165432f4ff779b (patch)
treeee2a1c55b35548b5d585c80c99de4860c0fb448f /src/widgets/box3d-toolbar.cpp
parentUpdate to trunk r13504 (diff)
downloadinkscape-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 'src/widgets/box3d-toolbar.cpp')
-rw-r--r--src/widgets/box3d-toolbar.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/widgets/box3d-toolbar.cpp b/src/widgets/box3d-toolbar.cpp
index 6d6b86c4d..7629e8c24 100644
--- a/src/widgets/box3d-toolbar.cpp
+++ b/src/widgets/box3d-toolbar.cpp
@@ -43,6 +43,7 @@
#include "selection.h"
#include "toolbox.h"
#include "ui/icon-names.h"
+#include "ui/tools/box3d-tool.h"
#include "ui/uxmanager.h"
#include "verbs.h"
#include "xml/node-event-vector.h"
@@ -280,6 +281,8 @@ static void box3d_vp_z_state_changed( GtkToggleAction *act, GtkAction *box3d_ang
box3d_vp_state_changed(act, box3d_angle, Proj::Z);
}
+static void box3d_toolbox_check_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
+
void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -409,13 +412,22 @@ void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/shapes/3dbox/vp_z_state", true) );
}
- sigc::connection *connection = new sigc::connection(
- sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(box3d_toolbox_selection_changed), G_OBJECT(holder)))
- );
- g_signal_connect(holder, "destroy", G_CALLBACK(delete_connection), connection);
+ desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(box3d_toolbox_check_ec), holder));
g_signal_connect(holder, "destroy", G_CALLBACK(purge_repr_listener), holder);
}
+static void box3d_toolbox_check_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder)
+{
+ static sigc::connection changed;
+ if (SP_IS_BOX3D_CONTEXT(ec)) {
+ changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(box3d_toolbox_selection_changed), holder));
+ box3d_toolbox_selection_changed(sp_desktop_selection(desktop), holder);
+ } else {
+ if (changed)
+ changed.disconnect();
+ }
+}
+
/*
Local Variables:
mode:c++