[gnote] actually commit changes to the GKeyFile
- From: Hubert Figuière <hub src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnote] actually commit changes to the GKeyFile
- Date: Tue, 16 Jun 2009 23:48:18 -0400 (EDT)
commit 2555185651ddf39a46703cfbb95b6f56427dafff
Author: Hubert Figuiere <hub figuiere net>
Date: Tue Jun 16 20:25:22 2009 -0400
actually commit changes to the GKeyFile
src/base/inifile.cpp | 1 +
src/base/inifile.hpp | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/base/inifile.cpp b/src/base/inifile.cpp
index 9f544c1..304dd6d 100644
--- a/src/base/inifile.cpp
+++ b/src/base/inifile.cpp
@@ -101,6 +101,7 @@ bool IniFile::get_bool(const char * group, const char * key, bool dflt)
void IniFile::set_bool(const char * group, const char * key, bool value)
{
g_key_file_set_boolean(m_keyfile, group, key, value);
+ m_dirty = true;
}
diff --git a/src/base/inifile.hpp b/src/base/inifile.hpp
index ee831c2..9905a9f 100644
--- a/src/base/inifile.hpp
+++ b/src/base/inifile.hpp
@@ -38,12 +38,16 @@ class IniFile
public:
IniFile(const std::string & filename)
- : m_filename(filename)
+ : m_dirty(false)
+ , m_filename(filename)
, m_keyfile(g_key_file_new())
{
}
~IniFile()
{
+ if(m_dirty) {
+ save();
+ }
g_key_file_free(m_keyfile);
}
@@ -53,7 +57,8 @@ public:
void set_bool(const char * group, const char * key, bool value);
private:
- std::string m_filename;
+ bool m_dirty;
+ std::string m_filename;
GKeyFile *m_keyfile;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]