- Added preferences load/save feature.

altough till lacking exception handling
  if no sgpem.cfg file is present, segmentation fault
  therefore no loading is ever done by now.


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@979 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
matrevis 2006-09-01 00:58:12 +00:00
parent 58cf50b500
commit 0912042b50
5 changed files with 717 additions and 453 deletions

View file

@ -24,6 +24,7 @@
#include "string_utils.hh"
#include <sstream>
// Do not include in header file:
#include "singleton.tcc"
using namespace sgpem;
@ -238,7 +239,7 @@ GlobalPreferences::key_file_read(KeyFile& kf)
{
std::ostringstream ostr;
ostr << "policies-dir-" << i;
Glib::ustring key(ostr.str());
Glib::ustring key(ostr.str().c_str());
val = kf.search_value(key);
if (val)
{
@ -276,14 +277,14 @@ GlobalPreferences::key_file_write(KeyFile& kf)
std::ostringstream ostr;
n++;
ostr << "modules-dir-" << n; // << std::ends;
Glib::ustring key(ostr.str());
Glib::ustring key(ostr.str().c_str());
kf.insert_key_value(key, (*iter));
++iter;
}
Glib::ustring key("modules-dir-number");
std::ostringstream ostr;
ostr << n << std::ends;
Glib::ustring value(ostr.str());
Glib::ustring value(ostr.str().c_str());
kf.insert_key_value(key, value);
}
// add policies directories
@ -299,14 +300,14 @@ GlobalPreferences::key_file_write(KeyFile& kf)
std::ostringstream ostr;
n++;
ostr << "policies-dir-" << n; // << std::ends;
Glib::ustring key(ostr.str());
Glib::ustring key(ostr.str().c_str());
kf.insert_key_value(key, (*iter));
++iter;
}
Glib::ustring key("policies-dir-number");
std::ostringstream ostr;
ostr << n << std::ends;
Glib::ustring value(ostr.str());
Glib::ustring value(ostr.str().c_str());
kf.insert_key_value(key, value);
}
}