From: Andrea Zagli Date: Sat, 8 Oct 2016 10:03:59 +0000 (+0200) Subject: Plg. file: take into account of key description in ::key_set_key. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=6c4f9720e75fb98f392de2564c0a11c20d781abe;p=zakconfi%2Flibzakconfi Plg. file: take into account of key description in ::key_set_key. --- diff --git a/plugins/file/plgfile.c b/plugins/file/plgfile.c index 1b35385..0ed064a 100644 --- a/plugins/file/plgfile.c +++ b/plugins/file/plgfile.c @@ -499,13 +499,35 @@ zak_confi_file_plugin_key_set_key (ZakConfiPluggable *pluggable, ZakConfiKey *ck) { gboolean ret; + GError *error; gchar *path; + gchar *group; + gchar *key; ZakConfiFilePluginPrivate *priv = ZAK_CONFI_FILE_PLUGIN_GET_PRIVATE (pluggable); path = g_strdup_printf ("%s/%s", ck->path, ck->key); ret = zak_confi_file_plugin_path_set_value (pluggable, path, ck->value); + + group = NULL; + key = NULL; + if (!zak_confi_file_plugin_path_get_group_and_key (path, &group, &key)) + { + return FALSE; + } + + g_key_file_set_comment (priv->kfile, group, key, ck->description, NULL); + g_free (group); + g_free (key); + + error = NULL; + ret = g_key_file_save_to_file (priv->kfile, priv->cnc_string, &error); + if (error != NULL) + { + ret = FALSE; + } + g_free (path); return ret;