From 7139c8a3275224df37c3e59628355f6b3e3398b4 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 27 Apr 2017 15:49:12 +0200 Subject: Fixing remove prefs (bzr r15620.1.7) --- src/preferences-skeleton.h | 310 --------------------------------- src/preferences.cpp | 29 +++ src/ui/dialog/inkscape-preferences.cpp | 2 + 3 files changed, 31 insertions(+), 310 deletions(-) diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 44775988c..ed00092b2 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -72,316 +72,6 @@ static char const preferences_skeleton[] = " inkscape:window-width=\"640\"\n" " inkscape:window-height=\"480\" />\n" " \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" "\n" " \n" 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); } } diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 2f83a08e9..6e12104f0 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -907,6 +907,8 @@ InkscapePreferences::defaultLpeUpdater(Glib::ustring pref_path, Inkscape::UI::Wi } else { prefs->remove(pref_path); + prefs->remove((Glib::ustring)"/live_effects/gdsgddssdggdsgdsgdsgs"); + prefs->remove((Glib::ustring)"/ddsdsdsgdsg"); } } -- cgit v1.2.3