diff options
| author | Eric Greveson <eric@greveson.co.uk> | 2013-07-04 22:51:56 +0000 |
|---|---|---|
| committer | Eric Greveson <eric@greveson.co.uk> | 2013-07-04 22:51:56 +0000 |
| commit | 036013caefc09f34ef9b418e1ca148a821c777d6 (patch) | |
| tree | 75c64b01ea3d650b820b926d091e42a737d6be56 /src/inkscape.cpp | |
| parent | Code readability improvements and licence changes for action-context.* (diff) | |
| download | inkscape-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.cpp | 17 |
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(); |
