diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2001-01-21 13:56:55 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-01-21 13:56:55 +0800 |
commit | ac6ce9637e4abaa35ede7aecf4ca1126dc57809c (patch) | |
tree | b5376fb673e9535939c93b2168e0a2f2e3ac3029 | |
parent | d623f94d7f9d69ce6622e1764f42cac15e6699eb (diff) | |
download | gsoc2013-evolution-ac6ce9637e4abaa35ede7aecf4ca1126dc57809c.tar gsoc2013-evolution-ac6ce9637e4abaa35ede7aecf4ca1126dc57809c.tar.gz gsoc2013-evolution-ac6ce9637e4abaa35ede7aecf4ca1126dc57809c.tar.bz2 gsoc2013-evolution-ac6ce9637e4abaa35ede7aecf4ca1126dc57809c.tar.lz gsoc2013-evolution-ac6ce9637e4abaa35ede7aecf4ca1126dc57809c.tar.xz gsoc2013-evolution-ac6ce9637e4abaa35ede7aecf4ca1126dc57809c.tar.zst gsoc2013-evolution-ac6ce9637e4abaa35ede7aecf4ca1126dc57809c.zip |
Added function e_xml_get_bool_prop_by_name_with_default.
2001-01-21 Christopher James Lahey <clahey@helixcode.com>
* gal/util/e-xml-utils.c, gal/util/e-xml-utils.h: Added function
e_xml_get_bool_prop_by_name_with_default.
svn path=/trunk/; revision=7675
-rw-r--r-- | e-util/e-xml-utils.c | 20 | ||||
-rw-r--r-- | e-util/e-xml-utils.h | 3 |
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); |