aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-xml-utils.c20
-rw-r--r--e-util/e-xml-utils.h3
2 files changed, 23 insertions, 0 deletions
diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c
index 4710c8bced..701598e000 100644
--- a/e-util/e-xml-utils.c
+++ b/e-util/e-xml-utils.c
@@ -120,6 +120,26 @@ e_xml_get_bool_prop_by_name(const xmlNode *parent, const xmlChar *prop_name)
return ret_val;
}
+gboolean
+e_xml_get_bool_prop_by_name_with_default(const xmlNode *parent, const xmlChar *prop_name, gboolean def)
+{
+ xmlChar *prop;
+ gboolean ret_val = def;
+
+ g_return_val_if_fail (parent != NULL, 0);
+ g_return_val_if_fail (prop_name != NULL, 0);
+
+ prop = xmlGetProp ((xmlNode *)parent, prop_name);
+ if (prop) {
+ if(!strcasecmp(prop, "true"))
+ ret_val = TRUE;
+ else
+ ret_val = FALSE;
+ xmlFree(prop);
+ }
+ return ret_val;
+}
+
void
e_xml_set_bool_prop_by_name(xmlNode *parent, const xmlChar *prop_name, gboolean value)
{
diff --git a/e-util/e-xml-utils.h b/e-util/e-xml-utils.h
index 0a722112f0..254e0261cb 100644
--- a/e-util/e-xml-utils.h
+++ b/e-util/e-xml-utils.h
@@ -41,6 +41,9 @@ void e_xml_set_integer_prop_by_name (xmlNode *parent,
gboolean e_xml_get_bool_prop_by_name (const xmlNode *parent,
const xmlChar *prop_name);
+gboolean e_xml_get_bool_prop_by_name_with_default (const xmlNode *parent,
+ const xmlChar *prop_name,
+ gboolean def);
void e_xml_set_bool_prop_by_name (xmlNode *parent,
const xmlChar *prop_name,
gboolean value);