summaryrefslogtreecommitdiffstats
path: root/src/verbs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/verbs.cpp')
-rw-r--r--src/verbs.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 06e59be38..737d9e150 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -80,6 +80,7 @@
#include "ui/dialog/inkscape-preferences.h"
#include "ui/dialog/layer-properties.h"
#include "ui/dialog/layers.h"
+#include "ui/dialog/new-from-template.h"
#include "ui/dialog/object-properties.h"
#include "ui/dialog/swatches.h"
#include "ui/dialog/symbols.h"
@@ -880,6 +881,9 @@ void FileVerb::perform(SPAction *action, void *data)
case SP_VERB_FILE_CLOSE_VIEW:
sp_ui_close_view(NULL);
break;
+ case SP_VERB_FILE_TEMPLATES:
+ Inkscape::UI::NewFromTemplate::load_new_from_template();
+ break;
default:
break;
}
@@ -1446,12 +1450,26 @@ void LayerVerb::perform(SPAction *action, void *data)
*/
void ObjectVerb::perform( SPAction *action, void *data)
{
- g_return_if_fail(ensure_desktop_valid(action));
SPDesktop *dt = sp_action_get_desktop(action);
+ Inkscape::Selection *sel = sp_action_get_selection(action);
- SPEventContext *ec = dt->event_context;
+ // We can perform some actions without a desktop
+ bool handled = true;
+ switch (reinterpret_cast<std::size_t>(data)) {
+ case SP_VERB_OBJECT_TO_CURVE:
+ sp_selected_path_to_curves(sel, dt);
+ break;
+ default:
+ handled = false;
+ break;
+ }
+ if (handled) {
+ return;
+ }
- Inkscape::Selection *sel = sp_desktop_selection(dt);
+ g_return_if_fail(ensure_desktop_valid(action));
+
+ SPEventContext *ec = dt->event_context;
if (sel->isEmpty())
return;
@@ -1478,9 +1496,6 @@ void ObjectVerb::perform( SPAction *action, void *data)
case SP_VERB_OBJECT_FLATTEN:
sp_selection_remove_transform(dt);
break;
- case SP_VERB_OBJECT_TO_CURVE:
- sp_selected_path_to_curves(dt);
- break;
case SP_VERB_OBJECT_FLOW_TEXT:
text_flow_into_shape();
break;
@@ -2361,6 +2376,8 @@ Verb *Verb::_base_verbs[] = {
new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"),
N_("Close this document window"), GTK_STOCK_CLOSE),
new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), GTK_STOCK_QUIT),
+ new FileVerb(SP_VERB_FILE_TEMPLATES, "FileTemplates", N_("_Templates..."),
+ N_("Create new project from template"), INKSCAPE_ICON("dialog-templates")),
// Edit
new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"),