diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-09-07 20:24:44 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-09-07 20:24:44 +0000 |
| commit | 80b40def43613f64e765f1e282fa939bd94f92af (patch) | |
| tree | 17852c4684cc5e4f78852950ce838989212a639a /src/extension | |
| parent | Write out 'x' and 'y' attribute values to repr when some text property value ... (diff) | |
| download | inkscape-80b40def43613f64e765f1e282fa939bd94f92af.tar.gz inkscape-80b40def43613f64e765f1e282fa939bd94f92af.zip | |
Extensions: Handle optiongroup options without value
We use the user visible GUI text as value in this case, which may or
may not be translated.
For backwards-compatibility with enum items use the untranslated
value instead, if one of the deprecated tag-names is found.
Fixes https://gitlab.com/inkscape/inkscape/issues/399
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/prefdialog/parameter-optiongroup.cpp | 13 | ||||
| -rw-r--r-- | src/extension/prefdialog/parameter.cpp | 2 | ||||
| -rw-r--r-- | src/extension/prefdialog/widget-spacer.cpp | 3 |
3 files changed, 12 insertions, 6 deletions
diff --git a/src/extension/prefdialog/parameter-optiongroup.cpp b/src/extension/prefdialog/parameter-optiongroup.cpp index e3f655dde..232c35315 100644 --- a/src/extension/prefdialog/parameter-optiongroup.cpp +++ b/src/extension/prefdialog/parameter-optiongroup.cpp @@ -302,8 +302,17 @@ ParamOptionGroup::ParamOptionGroupOption::ParamOptionGroupOption(Inkscape::XML:: if (value) { _value = value; } else { - g_warning("Missing value for option '%s' of parameter '%s' in extension '%s'.", - _text.c_str(), parent->_name, _extension->get_id()); + if (text) { + const char *name = xml->name(); + if (!strcmp(name, INKSCAPE_EXTENSION_NS "item") || !strcmp(name, INKSCAPE_EXTENSION_NS "_item")) { + _value = text; // use untranslated UI text as value (for backwards-compatibility) + } else { + _value = _text; // use translated UI text as value + } + } else { + g_warning("Missing value for option '%s' of parameter '%s' in extension '%s'.", + _text.c_str(), parent->_name, _extension->get_id()); + } } } diff --git a/src/extension/prefdialog/parameter.cpp b/src/extension/prefdialog/parameter.cpp index 65072f6a8..8cee78f43 100644 --- a/src/extension/prefdialog/parameter.cpp +++ b/src/extension/prefdialog/parameter.cpp @@ -224,7 +224,7 @@ unsigned int InxParameter::set_color(unsigned int in) InxParameter::InxParameter(Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *ext) : InxWidget(in_repr, ext) { - // name (mandatory for all paramters) + // name (mandatory for all parameters) const char *name = in_repr->attribute("name"); if (!name) { g_warning("Parameter without name in extension '%s'.", _extension->get_id()); diff --git a/src/extension/prefdialog/widget-spacer.cpp b/src/extension/prefdialog/widget-spacer.cpp index 350aeb4f2..8ffa6ac1e 100644 --- a/src/extension/prefdialog/widget-spacer.cpp +++ b/src/extension/prefdialog/widget-spacer.cpp @@ -51,9 +51,6 @@ Gtk::Widget *WidgetSpacer::get_widget(sigc::signal<void> *changeSignal) if (_expand) { spacer->set_hexpand(); spacer->set_vexpand(); - } else { - spacer->set_margin_start(_size); - spacer->set_margin_top(_size); } spacer->show(); |
