diff options
| author | John Smith <john.smith7545@yahoo.com> | 2013-05-05 06:52:20 +0000 |
|---|---|---|
| committer | John Smith <john.smith7545@yahoo.com> | 2013-05-05 06:52:20 +0000 |
| commit | 71f6f56253d08ed4cc2807bfa67c5f6583500386 (patch) | |
| tree | 87065f55cf996ea8d75929179c58b411baff6ace /src/extension/param/radiobutton.cpp | |
| parent | Christoffer Holmstedt 2013-04-21 Fixed compilation warnings and updated tweak... (diff) | |
| download | inkscape-71f6f56253d08ed4cc2807bfa67c5f6583500386.tar.gz inkscape-71f6f56253d08ed4cc2807bfa67c5f6583500386.zip | |
Fix for 1171434 : trunk: INX <optiongroup> broken^
(bzr r12322)
Diffstat (limited to 'src/extension/param/radiobutton.cpp')
| -rw-r--r-- | src/extension/param/radiobutton.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 38ed1fe77..e6e4d64e9 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -186,6 +186,8 @@ const gchar *ParamRadioButton::set(const gchar * in, SPDocument * /*doc*/, Inksc Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setString(extension_pref_root + prefname, _value); g_free(prefname); + } else { + g_warning("Couldn't set ParamRadioButton %s", in); } return _value; @@ -233,8 +235,8 @@ public: void ParamRadioButtonWdg::changed(void) { if (this->get_active()) { - Glib::ustring data = this->get_label(); - _pref->set(data.c_str(), _doc, _node); + Glib::ustring value = _pref->value_from_label(this->get_label()); + _pref->set(value.c_str(), _doc, _node); } if (_changeSignal != NULL) { _changeSignal->emit(); @@ -260,12 +262,32 @@ protected: virtual void on_changed() { if ( base ) { - base->set(get_active_text().c_str(), doc, node); + Glib::ustring value = base->value_from_label(get_active_text()); + base->set(value.c_str(), doc, node); } } }; /** + * Returns the value for the options label parameter + */ +Glib::ustring ParamRadioButton::value_from_label(const Glib::ustring label) +{ + Glib::ustring value = ""; + + for (GSList * list = choices; list != NULL; list = g_slist_next(list)) { + optionentry * entr = reinterpret_cast<optionentry *>(list->data); + if ( !entr->guitext->compare(label) ) { + value = *(entr->value); + break; + } + } + + return value; + +} + +/** * Creates a combobox widget for an enumeration parameter. */ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) |
