diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-05-06 00:57:18 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Zenotz <jtx@jtx.marker.es> | 2013-05-06 00:57:18 +0000 |
| commit | 658579b7ba73d404953808a0b399c747d7724804 (patch) | |
| tree | 8032e88a23b043b876e19eb7ac99663ff96d0a4e /src/extension/param/radiobutton.cpp | |
| parent | Removed auto select nodes, not decide for the user. Added auto update all sel... (diff) | |
| parent | Fix for 1171434 : trunk: INX <optiongroup> broken^ (diff) | |
| download | inkscape-658579b7ba73d404953808a0b399c747d7724804.tar.gz inkscape-658579b7ba73d404953808a0b399c747d7724804.zip | |
update to trunk
(bzr r11950.1.112)
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) |
