summaryrefslogtreecommitdiffstats
path: root/src/inkscape.cpp
diff options
context:
space:
mode:
authorEric Greveson <eric@greveson.co.uk>2013-07-04 22:51:56 +0000
committerEric Greveson <eric@greveson.co.uk>2013-07-04 22:51:56 +0000
commit036013caefc09f34ef9b418e1ca148a821c777d6 (patch)
tree75c64b01ea3d650b820b926d091e42a737d6be56 /src/inkscape.cpp
parentCode readability improvements and licence changes for action-context.* (diff)
downloadinkscape-036013caefc09f34ef9b418e1ca148a821c777d6.tar.gz
inkscape-036013caefc09f34ef9b418e1ca148a821c777d6.zip
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)
Diffstat (limited to 'src/inkscape.cpp')
-rw-r--r--src/inkscape.cpp17
1 files changed, 16 insertions, 1 deletions
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<SPDesktop *>(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<SPDocument *, AppSelectionModel *>::iterator sel_iter = inkscape->selection_models.find(doc);
if (sel_iter == inkscape->selection_models.end()) {
return Inkscape::ActionContext();