**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
#include <fstream>
#include <iostream>
+#include <algorithm>
#include "settings.h"
#include <synfig/general.h>
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
return true;
}
+//! Compare two key names, putting pref.* keys first
+static bool
+compare_pref_first (synfig::String first, synfig::String second)
+{
+ return first.substr(0, 5) == "pref."
+ ? second.substr(0, 5) == "pref."
+ ? first < second
+ : true
+ : second.substr(0, 5) == "pref."
+ ? false
+ : first < second;
+}
+
Settings::KeyList
Settings::get_key_list()const
{
}
// Sort the keys
- key_list.sort();
+ // We make sure the 'pref.*' keys come first to fix bug 1694393,
+ // where windows were being created before the parameter
+ // specifying which window manager hint to use had been loaded
+ key_list.sort(compare_pref_first);
return key_list;
}
for(iter=key_list.begin();iter!=key_list.end();++iter)
{
if(!file)return false;
- file<<*iter<<'='<<get_value(*iter)<<endl;
+ String ret = get_value(*iter);
+ if (ret != String()) file<<*iter<<'='<<ret<<endl;
}
}
}
catch(...)
{
- synfig::error("Settings::load_from_file(): Attept to set key \"%s\" with a value of \"%s\" has thrown an exception.",key.c_str(),value.c_str());
+ synfig::error("Settings::load_from_file(): Attempt to set key \"%s\" with a value of \"%s\" has thrown an exception.",key.c_str(),value.c_str());
throw;
}
}