summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2005-05-20 02:05:38 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2005-05-20 02:05:38 +0000
commit74d3204304e3344629f31fa9beebd44113c032a4 (patch)
treef007af77f6a428a4ee4979d4102e2cac0caf56f8
parent461d60a0f3543e07e19e8a5739097566e0851793 (diff)
Fl_Preferences::getUserdataPath() didn't work for sub-groups (STR
#872) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4361 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES2
-rw-r--r--FL/Fl_Preferences.H1
-rw-r--r--src/Fl_Preferences.cxx6
3 files changed, 6 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 465f2d1bf..f9c124c55 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #648, STR #692, STR #730, STR
#744, STR #745)
+ - Fl_Preferences::getUserdataPath() didn't work for
+ sub-groups (STR #872)
- Fixed some redraw issues on Windows XP.
- FLUID didn't set the initial size of widgets properly
(STR #850)
diff --git a/FL/Fl_Preferences.H b/FL/Fl_Preferences.H
index 7bf53e110..20eb88c6b 100644
--- a/FL/Fl_Preferences.H
+++ b/FL/Fl_Preferences.H
@@ -117,6 +117,7 @@ private:
Node *search( const char *path, int offset=0 );
Node *addChild( const char *path );
void setParent( Node *parent );
+ Node *parent() { return parent_; }
char remove();
char dirty();
// entry methods
diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx
index 18a66bfee..dabaa09c0 100644
--- a/src/Fl_Preferences.cxx
+++ b/src/Fl_Preferences.cxx
@@ -87,7 +87,7 @@ Fl_Preferences::Fl_Preferences( const char *path, const char *vendor, const char
*/
Fl_Preferences::Fl_Preferences( Fl_Preferences &parent, const char *key )
{
- rootNode = 0;
+ rootNode = parent.rootNode;
node = parent.node->addChild( key );
}
@@ -100,7 +100,7 @@ Fl_Preferences::Fl_Preferences( Fl_Preferences &parent, const char *key )
*/
Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, const char *key )
{
- rootNode = 0;
+ rootNode = parent->rootNode;
node = parent->node->addChild( key );
}
@@ -112,7 +112,7 @@ Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, const char *key )
*/
Fl_Preferences::~Fl_Preferences()
{
- delete rootNode;
+ if (!node->parent()) delete rootNode;
// DO NOT delete nodes! The root node will do that after writing the preferences
}