From 036013caefc09f34ef9b418e1ca148a821c777d6 Mon Sep 17 00:00:00 2001 From: Eric Greveson Date: Thu, 4 Jul 2013 23:51:56 +0100 Subject: Further renaming of DBus variables (object -> app_interface/doc_interface and doc_context -> target) Fixes to application interface for document_new (now only works in console mode, and behaves as expected) (bzr r12387.1.8) --- src/inkscape.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 2e60ee5ea..a24bd2b8a 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -1359,7 +1359,22 @@ inkscape_active_action_context() if (!doc) { return Inkscape::ActionContext(); } - + + return inkscape_action_context_for_document(doc); +} + +Inkscape::ActionContext +inkscape_action_context_for_document(SPDocument *doc) +{ + // If there are desktops, check them first to see if the document is bound to one of them + for (GSList *iter = inkscape->desktops ; iter ; iter = iter->next) { + SPDesktop *desktop=static_cast(iter->data); + if (desktop->doc() == doc) { + return Inkscape::ActionContext(desktop); + } + } + + // Document is not associated with any desktops - maybe we're in command-line mode std::map::iterator sel_iter = inkscape->selection_models.find(doc); if (sel_iter == inkscape->selection_models.end()) { return Inkscape::ActionContext(); -- cgit v1.2.3