diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2017-04-27 13:49:12 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2017-04-27 13:49:12 +0000 |
| commit | 7139c8a3275224df37c3e59628355f6b3e3398b4 (patch) | |
| tree | 7de9c789f6fb2265fff298742ce0638e28a43e83 /src/preferences.cpp | |
| parent | Add end of preferences GUI (diff) | |
| download | inkscape-7139c8a3275224df37c3e59628355f6b3e3398b4.tar.gz inkscape-7139c8a3275224df37c3e59628355f6b3e3398b4.zip | |
Fixing remove prefs
(bzr r15620.1.7)
Diffstat (limited to 'src/preferences.cpp')
| -rw-r--r-- | src/preferences.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/preferences.cpp b/src/preferences.cpp index 4d522a1d8..2849fe068 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -512,6 +512,35 @@ void Preferences::remove(Glib::ustring const &pref_path) Inkscape::XML::Node *node = _getNode(pref_path, false); if (node && node->parent()) { node->parent()->removeChild(node); + } else { //Handle to remove also attributes in path not only the container node + // verify path + g_assert( pref_path.at(0) == '/' ); + if (_prefs_doc == NULL){ + return; + } + node = _prefs_doc->root(); + Inkscape::XML::Node *child = NULL; + gchar **splits = g_strsplit(pref_path.c_str(), "/", 0); + if ( splits ) { + for (int part_i = 0; splits[part_i]; ++part_i) { + // skip empty path segments + if (!splits[part_i][0]) { + continue; + } + if (!node->firstChild()) { + node->setAttribute(splits[part_i], NULL); + g_strfreev(splits); + return; + } + for (child = node->firstChild(); child; child = child->next()) { + if (!strcmp(splits[part_i], child->attribute("id"))) { + break; + } + } + node = child; + } + } + g_strfreev(splits); } } |
