From 05f008356889de30ff55df1f73030003ed7cc312 Mon Sep 17 00:00:00 2001 From: Eric Greveson Date: Mon, 12 Aug 2013 16:39:48 +0100 Subject: Allow Object to Path verb from non-GUI (DBus) interface (bzr r12473.1.1) --- src/verbs.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index 06e59be38..baac07d60 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1446,12 +1446,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(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 +1492,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; -- cgit v1.2.3