[balsa/gtk3] Implement gboolean libbalsa_conf_has_key()
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Implement gboolean libbalsa_conf_has_key()
- Date: Thu, 14 Mar 2013 19:33:37 +0000 (UTC)
commit 8345c8175bed39d9e162dd837179b3351c37c76e
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Mar 14 12:28:53 2013 -0400
Implement gboolean libbalsa_conf_has_key()
* libbalsa/libbalsa-conf.c (libbalsa_conf_has_key): new
function.
* libbalsa/libbalsa-conf.h: ditto.
ChangeLog | 6 ++++++
libbalsa/libbalsa-conf.c | 10 ++++++++++
libbalsa/libbalsa-conf.h | 1 +
3 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 76c688d..9fa09c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-03-14 Peter Bloomfield
+
+ * libbalsa/libbalsa-conf.c (libbalsa_conf_has_key): new
+ function.
+ * libbalsa/libbalsa-conf.h: ditto.
+
2013-03-11 Peter Bloomfield
Lock mailbox to avoid race
diff --git a/libbalsa/libbalsa-conf.c b/libbalsa/libbalsa-conf.c
index c7c1f8c..7fbf0ac 100644
--- a/libbalsa/libbalsa-conf.c
+++ b/libbalsa/libbalsa-conf.c
@@ -269,6 +269,16 @@ libbalsa_conf_has_group(const char *group)
g_key_file_has_group(lbc_conf_priv.key_file, group));
}
+gboolean
+libbalsa_conf_has_key(const gchar * key)
+{
+ /* g_key_file_has_key returns FALSE on error, but that is OK */
+ return (g_key_file_has_key(lbc_conf.key_file, lbc_groups->data,
+ key, NULL) ||
+ g_key_file_has_key(lbc_conf_priv.key_file, lbc_groups->data,
+ key, NULL));
+}
+
static void
lbc_remove_key(LibBalsaConf * conf, const char *key)
{
diff --git a/libbalsa/libbalsa-conf.h b/libbalsa/libbalsa-conf.h
index 406a995..99521ac 100644
--- a/libbalsa/libbalsa-conf.h
+++ b/libbalsa/libbalsa-conf.h
@@ -33,6 +33,7 @@ void libbalsa_conf_remove_group_(const char *group, gboolean priv);
(libbalsa_conf_remove_group_((group),TRUE))
gboolean libbalsa_conf_has_group(const char *group);
+gboolean libbalsa_conf_has_key(const gchar *key);
/* Wrapper for iterating over groups. */
typedef gboolean (*LibBalsaConfForeachFunc)(const gchar * key,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]