summaryrefslogtreecommitdiff
path: root/src/lib-config
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-11-26 02:17:14 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-11-26 02:17:14 +0000
commita954fa03d053992d0ca84cfd8475d4ba09192220 (patch)
tree2009a48800e9d58200e22cce4d0b91d7afb40d9b /src/lib-config
parent532d6c1e9d1f7daefd7854498a4c4ee2a3d2a8e3 (diff)
downloadirssi-a954fa03d053992d0ca84cfd8475d4ba09192220.zip
Added modify counter which is increased every time something is changed
in configuration. Autosaving settings doesn't even try to save them if config isn't changed. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@871 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/lib-config')
-rw-r--r--src/lib-config/iconfig.h5
-rw-r--r--src/lib-config/set.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/lib-config/iconfig.h b/src/lib-config/iconfig.h
index f6910642..c00fdd0c 100644
--- a/src/lib-config/iconfig.h
+++ b/src/lib-config/iconfig.h
@@ -46,12 +46,13 @@ typedef struct {
struct _config_rec {
char *fname;
int handle;
- int create_mode;
+ int create_mode;
+ int modifycounter; /* increase every time something is changed */
char *last_error;
CONFIG_NODE *mainnode;
GHashTable *cache; /* path -> node (for querying) */
- GHashTable *cache_nodes; /* node -> path (for removing) */
+ GHashTable *cache_nodes; /* node -> path (for removing) */
GScanner *scanner;
diff --git a/src/lib-config/set.c b/src/lib-config/set.c
index f48aa3b9..342d2b70 100644
--- a/src/lib-config/set.c
+++ b/src/lib-config/set.c
@@ -37,6 +37,7 @@ void config_node_remove(CONFIG_REC *rec, CONFIG_NODE *parent, CONFIG_NODE *node)
g_return_if_fail(parent != NULL);
g_return_if_fail(node != NULL);
+ rec->modifycounter++;
cache_remove(rec, node);
parent->value = g_slist_remove(parent->value, node);
@@ -114,6 +115,7 @@ void config_node_set_str(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key,
}
node->value = g_strdup(value);
+ rec->modifycounter++;
}
void config_node_set_int(CONFIG_NODE *parent, const char *key, int value)