diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-12-25 23:46:18 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-12-25 23:46:18 +0000 |
| commit | 60efec48f2861fba5e02ca4fff61bfdcef33f56f (patch) | |
| tree | 2dbcec0c9c8d1453c422c10a53d691203f18e965 /src/extension/implementation | |
| parent | Fix start anchors (diff) | |
| parent | Merge about-box Gtkmm changes (diff) | |
| download | inkscape-60efec48f2861fba5e02ca4fff61bfdcef33f56f.tar.gz inkscape-60efec48f2861fba5e02ca4fff61bfdcef33f56f.zip | |
Merge branch 'master' into powerpencilII
Diffstat (limited to 'src/extension/implementation')
| -rw-r--r-- | src/extension/implementation/script.cpp | 18 | ||||
| -rw-r--r-- | src/extension/implementation/script.h | 9 |
2 files changed, 22 insertions, 5 deletions
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 0f0a79bfb..260204cb0 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -28,6 +28,7 @@ #include "desktop.h" #include "ui/dialog-events.h" #include "extension/effect.h" +#include "extension/execution-env.h" #include "extension/output.h" #include "extension/input.h" #include "extension/db.h" @@ -145,9 +146,10 @@ std::string Script::resolveInterpreterExecutable(const Glib::ustring &interpName officially in the load function. This allows for less allocation of memory in the unloaded state. */ -Script::Script() : - Implementation(), - _canceled(false) +Script::Script() + : Implementation() + , _canceled(false) + , parent_window(NULL) { } @@ -652,6 +654,8 @@ void Script::effect(Inkscape::Extension::Effect *module, std::list<std::string> params; module->paramListString(params); + parent_window = module->get_execution_env()->get_working_dialog(); + if (module->no_doc) { // this is a no-doc extension, e.g. a Help menu command; // just run the command without any files, ignoring errors @@ -741,7 +745,7 @@ void Script::effect(Inkscape::Extension::Effect *module, Gtk::MessageDialog warning( _("The output from the extension could not be parsed."), false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true); - warning.set_transient_for( *(INKSCAPE.active_desktop()->getToplevel()) ); + warning.set_transient_for( parent_window ? *parent_window : *(INKSCAPE.active_desktop()->getToplevel()) ); warning.run(); } } // data_read @@ -932,7 +936,11 @@ void Script::checkStderr (const Glib::ustring &data, Gtk::MessageDialog warning(message, false, type, Gtk::BUTTONS_OK, true); warning.set_resizable(true); GtkWidget *dlg = GTK_WIDGET(warning.gobj()); - sp_transientize(dlg); + if (parent_window) { + warning.set_transient_for(*parent_window); + } else { + sp_transientize(dlg); + } auto vbox = warning.get_content_area(); diff --git a/src/extension/implementation/script.h b/src/extension/implementation/script.h index 684719895..c6ae117c7 100644 --- a/src/extension/implementation/script.h +++ b/src/extension/implementation/script.h @@ -15,6 +15,7 @@ #include "implementation.h" #include <gtkmm/enums.h> +#include <gtkmm/window.h> #include <glibmm/main.h> #include <glibmm/spawn.h> #include <glibmm/fileutils.h> @@ -66,6 +67,14 @@ private: */ Glib::ustring helper_extension; + /** + * The window which should be considered as "parent window" of the script execution, + * e.g. when showin warning messages + * + * If set to NULL the main window of the currently active document is used. + */ + Gtk::Window *parent_window; + std::string solve_reldir(Inkscape::XML::Node *repr_in); bool check_existence (std::string const& command); void copy_doc(Inkscape::XML::Node * olddoc, Inkscape::XML::Node * newdoc); |
