summaryrefslogtreecommitdiffstats
path: root/src/helper/action.cpp
diff options
context:
space:
mode:
authorEric Greveson <eric@greveson.co.uk>2013-07-03 19:06:11 +0000
committerEric Greveson <eric@greveson.co.uk>2013-07-03 19:06:11 +0000
commit09ce234c1fc367a2607936e6cf106cb24c60e94f (patch)
tree72712240ad3e4782ef9c7e07ea44486dd4de77f6 /src/helper/action.cpp
parentAdded error messages when attempting to use verbs requiring GUI in (diff)
downloadinkscape-09ce234c1fc367a2607936e6cf106cb24c60e94f.tar.gz
inkscape-09ce234c1fc367a2607936e6cf106cb24c60e94f.zip
Modified dbus interface so that it works in console mode (--dbus-listen)
Modified action context setup so that in console mode, when a document is added to the main inkscape app instance, it gets a selection model and layer model automatically set up for it Made a couple more verbs work in console mode (bzr r12387.1.4)
Diffstat (limited to 'src/helper/action.cpp')
-rw-r--r--src/helper/action.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/helper/action.cpp b/src/helper/action.cpp
index 107d0179b..28cb40334 100644
--- a/src/helper/action.cpp
+++ b/src/helper/action.cpp
@@ -16,6 +16,7 @@
#include "debug/simple-event.h"
#include "debug/event-tracker.h"
#include "ui/view/view.h"
+#include "desktop.h"
#include "document.h"
#include "helper/action.h"
@@ -188,7 +189,7 @@ sp_action_get_selection (SPAction *action)
}
/**
- * Return View associated with the action.
+ * Return View associated with the action, if any.
*/
Inkscape::UI::View::View *
sp_action_get_view (SPAction *action)
@@ -197,6 +198,20 @@ sp_action_get_view (SPAction *action)
return action->context.getView();
}
+/**
+ * Return Desktop associated with the action, if any.
+ */
+SPDesktop *
+sp_action_get_desktop (SPAction *action)
+{
+ // TODO: this slightly horrible storage of a UI::View::View*, and
+ // casting to an SPDesktop*, is only done because that's what was
+ // already the norm in the Inkscape codebase. This seems wrong. Surely
+ // we should store an SPDesktop* in the first place? Is there a case
+ // of actions being carried out on a View that is not an SPDesktop?
+ return static_cast<SPDesktop *>(sp_action_get_view(action));
+}
+
/*
Local Variables:
mode:c++