diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2014-04-01 17:00:00 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2014-04-01 17:00:00 +0000 |
| commit | 208ccdf9782984702f79b8ba416e67dd1e2c2dfa (patch) | |
| tree | 79d15123aa526c49c6386db6245fbfc6b7a63eaf /src/preferences.cpp | |
| parent | update to trunk (diff) | |
| parent | partial 2geom update: (diff) | |
| download | inkscape-208ccdf9782984702f79b8ba416e67dd1e2c2dfa.tar.gz inkscape-208ccdf9782984702f79b8ba416e67dd1e2c2dfa.zip | |
update to trunk
(bzr r12588.1.32)
Diffstat (limited to 'src/preferences.cpp')
| -rw-r--r-- | src/preferences.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/preferences.cpp b/src/preferences.cpp index b4b873dc8..2fec3b307 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -438,9 +438,7 @@ void Preferences::setBool(Glib::ustring const &pref_path, bool value) */ void Preferences::setInt(Glib::ustring const &pref_path, int value) { - gchar intstr[32]; - g_snprintf(intstr, 32, "%d", value); - _setRawValue(pref_path, intstr); + _setRawValue(pref_path, Glib::ustring::compose("%1",value)); } /** @@ -451,9 +449,7 @@ void Preferences::setInt(Glib::ustring const &pref_path, int value) */ void Preferences::setDouble(Glib::ustring const &pref_path, double value) { - gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; - g_ascii_dtostr(buf, G_ASCII_DTOSTR_BUF_SIZE, value); - _setRawValue(pref_path, buf); + _setRawValue(pref_path, Glib::ustring::compose("%1",value)); } /** @@ -465,11 +461,8 @@ void Preferences::setDouble(Glib::ustring const &pref_path, double value) */ void Preferences::setDoubleUnit(Glib::ustring const &pref_path, double value, Glib::ustring const &unit_abbr) { - gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; - g_ascii_dtostr(buf, G_ASCII_DTOSTR_BUF_SIZE, value); - Glib::ustring str(buf); - str += unit_abbr; - _setRawValue(pref_path, str.c_str()); + Glib::ustring str = Glib::ustring::compose("%1%2",value,unit_abbr); + _setRawValue(pref_path, str); } void Preferences::setColor(Glib::ustring const &pref_path, guint32 value) @@ -487,14 +480,14 @@ void Preferences::setColor(Glib::ustring const &pref_path, guint32 value) */ void Preferences::setString(Glib::ustring const &pref_path, Glib::ustring const &value) { - _setRawValue(pref_path, value.c_str()); + _setRawValue(pref_path, value); } void Preferences::setStyle(Glib::ustring const &pref_path, SPCSSAttr *style) { Glib::ustring css_str; sp_repr_css_write_string(style, css_str); - _setRawValue(pref_path, css_str.c_str()); + _setRawValue(pref_path, css_str); } void Preferences::mergeStyle(Glib::ustring const &pref_path, SPCSSAttr *style) @@ -503,7 +496,7 @@ void Preferences::mergeStyle(Glib::ustring const &pref_path, SPCSSAttr *style) sp_repr_css_merge(current, style); Glib::ustring css_str; sp_repr_css_write_string(current, css_str); - _setRawValue(pref_path, css_str.c_str()); + _setRawValue(pref_path, css_str); sp_repr_css_attr_unref(current); } @@ -738,7 +731,7 @@ void Preferences::_getRawValue(Glib::ustring const &path, gchar const *&result) } } -void Preferences::_setRawValue(Glib::ustring const &path, gchar const *value) +void Preferences::_setRawValue(Glib::ustring const &path, Glib::ustring const &value) { // create node and attribute keys Glib::ustring node_key, attr_key; @@ -746,7 +739,7 @@ void Preferences::_setRawValue(Glib::ustring const &path, gchar const *value) // set the attribute Inkscape::XML::Node *node = _getNode(node_key, true); - node->setAttribute(attr_key.c_str(), value); + node->setAttribute(attr_key.c_str(), value.c_str()); } // The _extract* methods are where the actual wrok is done - they define how preferences are stored |
