diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-07-14 21:09:41 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-07-14 21:09:41 +0000 |
| commit | d32efb61f1c2c18d1018e510bbe9bafc04a03905 (patch) | |
| tree | b447bf9856baf1cf485e38c4ce55edb27285129e /src/extension/param/radiobutton.cpp | |
| parent | Merged from trunk (r12305) (diff) | |
| parent | Minor C++ish refactoring pass. (diff) | |
| download | inkscape-d32efb61f1c2c18d1018e510bbe9bafc04a03905.tar.gz inkscape-d32efb61f1c2c18d1018e510bbe9bafc04a03905.zip | |
Merged from trunk (r12419).
(bzr r11608.1.107)
Diffstat (limited to 'src/extension/param/radiobutton.cpp')
| -rw-r--r-- | src/extension/param/radiobutton.cpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 38ed1fe77..75d5a40e3 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -18,6 +18,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/radiobutton.h> @@ -186,6 +190,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 +239,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 +266,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) |
