summaryrefslogtreecommitdiffstats
path: root/src/extension/implementation/script.cpp
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2017-12-20 23:11:30 +0000
committerEduard Braun <eduard.braun2@gmx.de>2017-12-20 23:11:30 +0000
commitcabdde6554a95e6d0fee5ab39f850f7645df3cbb (patch)
treef85847d899169d369929df0f570e40c871c5c361 /src/extension/implementation/script.cpp
parentEffects: make "Working..." dialog transient for preferences dialog (diff)
downloadinkscape-cabdde6554a95e6d0fee5ab39f850f7645df3cbb.tar.gz
inkscape-cabdde6554a95e6d0fee5ab39f850f7645df3cbb.zip
Make script warnings transient for "Working..." dialog
This turned out to be a bit of a mess due to the interplay between the classes Script / ExecutionEnv / Effect / PrefDialog. (Basically they don't talk to each other much but all want to contribute to the GUI) Likely "Script" (and possibly "ExecutionEnv") should be refactored to let the other classes handle UI exclusively and throw errors where suitable.
Diffstat (limited to 'src/extension/implementation/script.cpp')
-rw-r--r--src/extension/implementation/script.cpp18
1 files changed, 13 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();