summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/preferences-widget.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2007-12-16 18:09:15 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2007-12-16 18:09:15 +0000
commita81c104b848a3538815235cc9763a5c02591061f (patch)
tree5a9026c279e6ac51822d27156497427b3ddcc36c /src/ui/widget/preferences-widget.cpp
parentfix possible crash where event_context is destroyed during fill operation due... (diff)
downloadinkscape-a81c104b848a3538815235cc9763a5c02591061f.tar.gz
inkscape-a81c104b848a3538815235cc9763a5c02591061f.zip
add default unit to grid preferences.
(bzr r4238)
Diffstat (limited to 'src/ui/widget/preferences-widget.cpp')
-rw-r--r--src/ui/widget/preferences-widget.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp
index 29f86745e..7b94512cf 100644
--- a/src/ui/widget/preferences-widget.cpp
+++ b/src/ui/widget/preferences-widget.cpp
@@ -356,6 +356,23 @@ void PrefColorPicker::on_changed (guint32 rgba)
}
}
+void PrefUnit::init(const std::string& prefs_path, const std::string& attr)
+{
+ _prefs_path = prefs_path;
+ _attr = attr;
+ setUnitType(UNIT_TYPE_LINEAR);
+ gchar const * prefval = prefs_get_string_attribute(_prefs_path.c_str(), _attr.c_str());
+ setUnit(prefval);
+}
+
+void PrefUnit::on_changed()
+{
+ if (this->is_visible()) //only take action if user changed value
+ {
+ prefs_set_string_attribute(_prefs_path.c_str(), _attr.c_str(), getUnitAbbr().c_str());
+ }
+}
+
} // namespace Widget
} // namespace UI
} // namespace Inkscape