diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-10-15 21:55:27 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-10-15 21:56:31 +0000 |
| commit | 5c3063637d71802a43d52add816a9db133c37d02 (patch) | |
| tree | b9661d2c6be0bfa70ceecbc460c7651e19a33a3d /src | |
| parent | Properly initialize sensitivity of menuitems with verb default (diff) | |
| download | inkscape-5c3063637d71802a43d52add816a9db133c37d02.tar.gz inkscape-5c3063637d71802a43d52add816a9db133c37d02.zip | |
Extensions: Disable effects that failed to load
Instead of removing them from the menu, they're now shown as
inactive (greyed out), so users have a chance to know they even
exists, without having to know about extension-errors.log
Unfortunately tooltips seem to be hidden for insensitive menuitems
as well, so we currently have no way of informing the user directly
in the UI about the problem.
Fixes https://gitlab.com/inkscape/inkscape/issues/470
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/effect.cpp | 7 | ||||
| -rw-r--r-- | src/extension/extension.cpp | 13 | ||||
| -rw-r--r-- | src/extension/extension.h | 2 |
3 files changed, 10 insertions, 12 deletions
diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index 1a84e3df1..a380c9710 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -224,11 +224,8 @@ bool Effect::check () { if (!Extension::check()) { - /** \todo Check to see if parent has this as its only child, - if so, delete it too */ - if (_menu_node != nullptr) - sp_repr_unparent(_menu_node); - _menu_node = nullptr; + _verb.sensitive(nullptr, false); + _verb.set_tip(Extension::getErrorReason().c_str()); // TODO: insensitive menuitems don't show a tooltip return false; } return true; diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 2c5f6a978..02f7f517d 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -291,22 +291,21 @@ Extension::loaded () bool Extension::check () { - bool retval = true; - const char * inx_failure = _(" This is caused by an improper .inx file for this extension." " An improper .inx file could have been caused by a faulty installation of Inkscape."); if (repr == nullptr) { printFailure(Glib::ustring(_("the XML description of it got lost.")) + inx_failure); - retval = false; + return false; } if (imp == nullptr) { printFailure(Glib::ustring(_("no implementation was defined for the extension.")) + inx_failure); - retval = false; + return false; } + bool retval = true; for (auto _dep : _deps) { - if (_dep->check() == FALSE) { + if (_dep->check() == false) { printFailure(Glib::ustring(_("a dependency was not met."))); error_file_write(_dep->info_string()); retval = false; @@ -330,8 +329,8 @@ Extension::check () void Extension::printFailure (Glib::ustring reason) { - error_file_write(Glib::ustring::compose(_("Extension \"%1\" failed to load because %2"), _name, reason)); - return; + _error_reason = Glib::ustring::compose(_("Extension \"%1\" failed to load because %2"), _name, reason); + error_file_write(_error_reason); } /** diff --git a/src/extension/extension.h b/src/extension/extension.h index e34317d79..4a857947e 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -115,6 +115,7 @@ private: std::vector<Dependency *> _deps; /**< Dependencies for this extension */ static FILE *error_file; /**< This is the place where errors get reported */ bool _gui; + std::string _error_reason; /**< Short, textual explanation for the latest error */ protected: Inkscape::XML::Node *repr; /**< The XML description of the Extension */ @@ -142,6 +143,7 @@ public: void deactivate (); bool deactivated (); void printFailure (Glib::ustring reason); + std::string getErrorReason() { return _error_reason; }; Implementation::Implementation * get_imp () { return imp; }; void set_execution_env (ExecutionEnv * env) { execution_env = env; }; ExecutionEnv *get_execution_env () { return execution_env; }; |
