diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-03-29 23:52:42 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-03-29 23:52:42 +0000 |
| commit | a168040d5a452544328a1e6ad35aaac351f94d44 (patch) | |
| tree | fae1ba829f543a473da281bd5fa6e4deabbf6912 /src/preferences.cpp | |
| parent | Removed function pointers from SPObject and subclasses. (diff) | |
| parent | Dutch translation update (diff) | |
| download | inkscape-a168040d5a452544328a1e6ad35aaac351f94d44.tar.gz inkscape-a168040d5a452544328a1e6ad35aaac351f94d44.zip | |
merged from trunk
(bzr r11608.1.56)
Diffstat (limited to 'src/preferences.cpp')
| -rw-r--r-- | src/preferences.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/preferences.cpp b/src/preferences.cpp index 4615fd6e1..1d7009a99 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -13,6 +13,7 @@ #include <cstring> #include <sstream> #include <glibmm/fileutils.h> +#include <glibmm/convert.h> #include <glibmm/i18n.h> #include <glib.h> #include <glib/gstdio.h> @@ -489,21 +490,32 @@ void Preferences::setString(Glib::ustring const &pref_path, Glib::ustring const void Preferences::setStyle(Glib::ustring const &pref_path, SPCSSAttr *style) { - gchar *css_str = sp_repr_css_write_string(style); - _setRawValue(pref_path, css_str); - g_free(css_str); + Glib::ustring css_str; + sp_repr_css_write_string(style, css_str); + _setRawValue(pref_path, css_str.c_str()); } void Preferences::mergeStyle(Glib::ustring const &pref_path, SPCSSAttr *style) { SPCSSAttr *current = getStyle(pref_path); sp_repr_css_merge(current, style); - gchar *css_str = sp_repr_css_write_string(current); - _setRawValue(pref_path, css_str); - g_free(css_str); + Glib::ustring css_str; + sp_repr_css_write_string(current, css_str); + _setRawValue(pref_path, css_str.c_str()); sp_repr_css_attr_unref(current); } +/** + * Remove an entry + * Make sure observers have been removed before calling + */ +void Preferences::remove(Glib::ustring const &pref_path) +{ + Inkscape::XML::Node *node = _getNode(pref_path, false); + if (node && node->parent()) { + node->parent()->removeChild(node); + } +} /** * Class that holds additional information for registered Observers. |
