Don't #define __GNOME_I18N_H__ if it's already defined.
* gal/util/e-i18n.h: Don't #define __GNOME_I18N_H__ if it's already defined. *gal/util/e-xml-utils.c: Functions moved from Gnumeric: e_xml_get_child_by_name_by_lang_list, e_xml_get_child_by_name_by_lang_list_with_score (static), e_xml_get_child_by_name_no_lang. New functions (for completness): e_xml_get_integer_prop_by_name_with_default, e_xml_get_string_prop_by_name_with_default, e_xml_get_uint_prop_by_name, e_xml_get_uint_prop_by_name_with_default, e_xml_set_uint_prop_by_name. Now every e_xml_get_*_prop_by_name function just calls e_xml_get_*_prop_by_name_with_default with some sensible default value. Formatting fixes here and there. svn path=/trunk/; revision=7874
This commit is contained in:
@ -34,6 +34,8 @@
|
|||||||
# define N_(String) (String)
|
# define N_(String) (String)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GNOME_I18N_H__
|
||||||
#define __GNOME_I18N_H__ 1
|
#define __GNOME_I18N_H__ 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __E_I18N_H__ */
|
#endif /* __E_I18N_H__ */
|
||||||
|
@ -21,21 +21,23 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <libgnome/libgnome.h>
|
||||||
#include "gal/util/e-i18n.h"
|
#include "gal/util/e-i18n.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <gnome-xml/parser.h>
|
#include <gnome-xml/parser.h>
|
||||||
#include <gnome-xml/xmlmemory.h>
|
#include <gnome-xml/xmlmemory.h>
|
||||||
#include "e-xml-utils.h"
|
#include "e-xml-utils.h"
|
||||||
|
|
||||||
xmlNode *e_xml_get_child_by_name(const xmlNode *parent, const xmlChar *child_name)
|
xmlNode *
|
||||||
|
e_xml_get_child_by_name (const xmlNode *parent, const xmlChar *child_name)
|
||||||
{
|
{
|
||||||
xmlNode *child;
|
xmlNode *child;
|
||||||
|
|
||||||
g_return_val_if_fail(parent != NULL, NULL);
|
g_return_val_if_fail (parent != NULL, NULL);
|
||||||
g_return_val_if_fail(child_name != NULL, NULL);
|
g_return_val_if_fail (child_name != NULL, NULL);
|
||||||
|
|
||||||
for (child = parent->childs; child; child = child->next) {
|
for (child = parent->childs; child != NULL; child = child->next) {
|
||||||
if ( !xmlStrcmp( child->name, child_name ) ) {
|
if (xmlStrcmp (child->name, child_name) == 0) {
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,52 +49,143 @@ xmlNode *e_xml_get_child_by_name(const xmlNode *parent, const xmlChar *child_nam
|
|||||||
* child with the name child_name and no "lang" attribute.
|
* child with the name child_name and no "lang" attribute.
|
||||||
*/
|
*/
|
||||||
xmlNode *
|
xmlNode *
|
||||||
e_xml_get_child_by_name_by_lang(const xmlNode *parent, const xmlChar *child_name, const char *lang)
|
e_xml_get_child_by_name_by_lang (const xmlNode *parent, const xmlChar *child_name, const gchar *lang)
|
||||||
{
|
{
|
||||||
xmlNode *child;
|
xmlNode *child;
|
||||||
/* This is the default version of the string. */
|
/* This is the default version of the string. */
|
||||||
xmlNode *C = NULL;
|
xmlNode *C = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail(parent != NULL, NULL);
|
g_return_val_if_fail (parent != NULL, NULL);
|
||||||
g_return_val_if_fail(child_name != NULL, NULL);
|
g_return_val_if_fail (child_name != NULL, NULL);
|
||||||
|
|
||||||
if (lang == NULL)
|
if (lang == NULL) {
|
||||||
lang = setlocale(LC_MESSAGES, NULL);
|
lang = setlocale (LC_MESSAGES, NULL);
|
||||||
|
}
|
||||||
for (child = parent->childs; child; child = child->next) {
|
for (child = parent->childs; child != NULL; child = child->next) {
|
||||||
if ( !xmlStrcmp( child->name, child_name ) ) {
|
if (xmlStrcmp (child->name, child_name) == 0) {
|
||||||
char *this_lang = xmlGetProp(child, "lang");
|
xmlChar *this_lang = xmlGetProp (child, "lang");
|
||||||
if ( this_lang == NULL ) {
|
if (this_lang == NULL) {
|
||||||
C = child;
|
C = child;
|
||||||
}
|
} else if (xmlStrcmp(this_lang, "lang") == 0) {
|
||||||
else if (!strcmp(this_lang, "lang"))
|
|
||||||
return child;
|
return child;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return C;
|
return C;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static xmlNode *
|
||||||
e_xml_get_integer_prop_by_name(const xmlNode *parent, const xmlChar *prop_name)
|
e_xml_get_child_by_name_by_lang_list_with_score (const xmlNode *parent, const gchar *name, GList *lang_list, gint *best_lang_score)
|
||||||
|
{
|
||||||
|
xmlNodePtr best_node = NULL, node;
|
||||||
|
|
||||||
|
for (node = parent->childs; node != NULL; node = node->next) {
|
||||||
|
xmlChar *lang;
|
||||||
|
|
||||||
|
if (node->name == NULL || strcmp (node->name, name) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lang = xmlGetProp (node, "xml:lang");
|
||||||
|
if (lang != NULL) {
|
||||||
|
GList *l;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
for (l = lang_list, i = 0; l != NULL && i < *best_lang_score; l = l->next, i++) {
|
||||||
|
if (strcmp ((gchar *) l->data, lang) == 0) {
|
||||||
|
best_node = node;
|
||||||
|
*best_lang_score = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (best_node == NULL) {
|
||||||
|
best_node = node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xmlFree (lang);
|
||||||
|
if (*best_lang_score == 0) {
|
||||||
|
return best_node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return best_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* e_xml_get_child_by_name_by_lang_list:
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
xmlNode *
|
||||||
|
e_xml_get_child_by_name_by_lang_list (const xmlNode *parent, const gchar *name, GList *lang_list)
|
||||||
|
{
|
||||||
|
gint best_lang_score = INT_MAX;
|
||||||
|
|
||||||
|
g_return_val_if_fail (parent != NULL, NULL);
|
||||||
|
g_return_val_if_fail (name != NULL, NULL);
|
||||||
|
|
||||||
|
if (lang_list == NULL) {
|
||||||
|
lang_list = gnome_i18n_get_language_list ("LC_MESSAGES");
|
||||||
|
}
|
||||||
|
return e_xml_get_child_by_name_by_lang_list_with_score (parent, name, lang_list, &best_lang_score);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* e_xml_get_child_by_name_no_lang
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
xmlNode *
|
||||||
|
e_xml_get_child_by_name_no_lang (const xmlNode *parent, const gchar *name)
|
||||||
|
{
|
||||||
|
xmlNodePtr node;
|
||||||
|
|
||||||
|
g_return_val_if_fail (parent != NULL, NULL);
|
||||||
|
g_return_val_if_fail (name != NULL, NULL);
|
||||||
|
|
||||||
|
for (node = parent->childs; node != NULL; node = node->next) {
|
||||||
|
xmlChar *lang;
|
||||||
|
|
||||||
|
if (node->name == NULL || strcmp (node->name, name) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lang = xmlGetProp (node, "xml:lang");
|
||||||
|
if (lang == NULL) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
xmlFree (lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
e_xml_get_integer_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (parent != NULL, 0);
|
||||||
|
g_return_val_if_fail (prop_name != NULL, 0);
|
||||||
|
|
||||||
|
return e_xml_get_integer_prop_by_name_with_default (parent, prop_name, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
e_xml_get_integer_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, gint def)
|
||||||
{
|
{
|
||||||
xmlChar *prop;
|
xmlChar *prop;
|
||||||
int ret_val = 0;
|
gint ret_val = def;
|
||||||
|
|
||||||
g_return_val_if_fail (parent != NULL, 0);
|
g_return_val_if_fail (parent != NULL, 0);
|
||||||
g_return_val_if_fail (prop_name != NULL, 0);
|
g_return_val_if_fail (prop_name != NULL, 0);
|
||||||
|
|
||||||
prop = xmlGetProp ((xmlNode *)parent, prop_name);
|
prop = xmlGetProp ((xmlNode *) parent, prop_name);
|
||||||
if (prop) {
|
if (prop != NULL) {
|
||||||
ret_val = atoi (prop);
|
(void) sscanf (prop, "%d", &ret_val);
|
||||||
xmlFree (prop);
|
xmlFree (prop);
|
||||||
}
|
}
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
e_xml_set_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name, int value)
|
e_xml_set_integer_prop_by_name (xmlNode *parent, const xmlChar *prop_name, gint value)
|
||||||
{
|
{
|
||||||
xmlChar *valuestr;
|
gchar *valuestr;
|
||||||
|
|
||||||
g_return_if_fail (parent != NULL);
|
g_return_if_fail (parent != NULL);
|
||||||
g_return_if_fail (prop_name != NULL);
|
g_return_if_fail (prop_name != NULL);
|
||||||
@ -102,24 +195,54 @@ e_xml_set_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name, int va
|
|||||||
g_free (valuestr);
|
g_free (valuestr);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
guint
|
||||||
e_xml_get_bool_prop_by_name(const xmlNode *parent, const xmlChar *prop_name)
|
e_xml_get_uint_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (parent != NULL, 0);
|
||||||
|
g_return_val_if_fail (prop_name != NULL, 0);
|
||||||
|
|
||||||
|
return e_xml_get_uint_prop_by_name_with_default (parent, prop_name, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
e_xml_get_uint_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, guint def)
|
||||||
{
|
{
|
||||||
xmlChar *prop;
|
xmlChar *prop;
|
||||||
gboolean ret_val = FALSE;
|
guint ret_val = def;
|
||||||
|
|
||||||
g_return_val_if_fail (parent != NULL, 0);
|
g_return_val_if_fail (parent != NULL, 0);
|
||||||
g_return_val_if_fail (prop_name != NULL, 0);
|
g_return_val_if_fail (prop_name != NULL, 0);
|
||||||
|
|
||||||
prop = xmlGetProp ((xmlNode *)parent, prop_name);
|
prop = xmlGetProp ((xmlNode *) parent, prop_name);
|
||||||
if (prop) {
|
if (prop != NULL) {
|
||||||
if(!strcasecmp(prop, "true"))
|
(void) sscanf (prop, "%u", &ret_val);
|
||||||
ret_val = TRUE;
|
xmlFree (prop);
|
||||||
xmlFree(prop);
|
|
||||||
}
|
}
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_xml_set_uint_prop_by_name (xmlNode *parent, const xmlChar *prop_name, guint value)
|
||||||
|
{
|
||||||
|
gchar *valuestr;
|
||||||
|
|
||||||
|
g_return_if_fail (parent != NULL);
|
||||||
|
g_return_if_fail (prop_name != NULL);
|
||||||
|
|
||||||
|
valuestr = g_strdup_printf ("%u", value);
|
||||||
|
xmlSetProp (parent, prop_name, valuestr);
|
||||||
|
g_free (valuestr);
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
e_xml_get_bool_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (parent != NULL, 0);
|
||||||
|
g_return_val_if_fail (prop_name != NULL, 0);
|
||||||
|
|
||||||
|
return e_xml_get_bool_prop_by_name_with_default (parent, prop_name, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
e_xml_get_bool_prop_by_name_with_default(const xmlNode *parent, const xmlChar *prop_name, gboolean def)
|
e_xml_get_bool_prop_by_name_with_default(const xmlNode *parent, const xmlChar *prop_name, gboolean def)
|
||||||
{
|
{
|
||||||
@ -129,121 +252,124 @@ e_xml_get_bool_prop_by_name_with_default(const xmlNode *parent, const xmlChar *p
|
|||||||
g_return_val_if_fail (parent != NULL, 0);
|
g_return_val_if_fail (parent != NULL, 0);
|
||||||
g_return_val_if_fail (prop_name != NULL, 0);
|
g_return_val_if_fail (prop_name != NULL, 0);
|
||||||
|
|
||||||
prop = xmlGetProp ((xmlNode *)parent, prop_name);
|
prop = xmlGetProp ((xmlNode *) parent, prop_name);
|
||||||
if (prop) {
|
if (prop != NULL) {
|
||||||
if(!strcasecmp(prop, "true"))
|
if (strcasecmp (prop, "true") == 0) {
|
||||||
ret_val = TRUE;
|
ret_val = TRUE;
|
||||||
else
|
} else if (strcasecmp (prop, "false") == 0) {
|
||||||
ret_val = FALSE;
|
ret_val = FALSE;
|
||||||
|
}
|
||||||
xmlFree(prop);
|
xmlFree(prop);
|
||||||
}
|
}
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
e_xml_set_bool_prop_by_name(xmlNode *parent, const xmlChar *prop_name, gboolean value)
|
e_xml_set_bool_prop_by_name (xmlNode *parent, const xmlChar *prop_name, gboolean value)
|
||||||
{
|
{
|
||||||
g_return_if_fail (parent != NULL);
|
g_return_if_fail (parent != NULL);
|
||||||
g_return_if_fail (prop_name != NULL);
|
g_return_if_fail (prop_name != NULL);
|
||||||
|
|
||||||
if (value)
|
if (value) {
|
||||||
xmlSetProp (parent, prop_name, "true");
|
xmlSetProp (parent, prop_name, "true");
|
||||||
else
|
|
||||||
xmlSetProp (parent, prop_name, "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
e_xml_get_double_prop_by_name(const xmlNode *parent, const xmlChar *prop_name)
|
|
||||||
{
|
|
||||||
xmlChar *prop;
|
|
||||||
double ret_val = 0;
|
|
||||||
|
|
||||||
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) {
|
|
||||||
sscanf (prop, "%lf", &ret_val);
|
|
||||||
xmlFree (prop);
|
|
||||||
}
|
|
||||||
return ret_val;
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
e_xml_get_double_prop_by_name_with_default(const xmlNode *parent, const xmlChar *prop_name,
|
|
||||||
gdouble def)
|
|
||||||
{
|
|
||||||
xmlChar *prop;
|
|
||||||
double ret_val = 0;
|
|
||||||
|
|
||||||
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) {
|
|
||||||
sscanf (prop, "%lf", &ret_val);
|
|
||||||
xmlFree (prop);
|
|
||||||
} else {
|
} else {
|
||||||
ret_val = def;
|
xmlSetProp (parent, prop_name, "false");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble
|
||||||
|
e_xml_get_double_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (parent != NULL, 0);
|
||||||
|
g_return_val_if_fail (prop_name != NULL, 0);
|
||||||
|
|
||||||
|
return e_xml_get_double_prop_by_name_with_default (parent, prop_name, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble
|
||||||
|
e_xml_get_double_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, gdouble def)
|
||||||
|
{
|
||||||
|
xmlChar *prop;
|
||||||
|
gdouble 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 != NULL) {
|
||||||
|
(void) sscanf (prop, "%lf", &ret_val);
|
||||||
|
xmlFree (prop);
|
||||||
}
|
}
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
e_xml_set_double_prop_by_name(xmlNode *parent, const xmlChar *prop_name, double value)
|
e_xml_set_double_prop_by_name(xmlNode *parent, const xmlChar *prop_name, gdouble value)
|
||||||
{
|
{
|
||||||
xmlChar *valuestr;
|
gchar *valuestr;
|
||||||
|
|
||||||
g_return_if_fail (parent != NULL);
|
g_return_if_fail (parent != NULL);
|
||||||
g_return_if_fail (prop_name != NULL);
|
g_return_if_fail (prop_name != NULL);
|
||||||
|
|
||||||
if (fabs (value) < 1e9 && fabs (value) > 1e-5)
|
if (fabs (value) < 1e9 && fabs (value) > 1e-5) {
|
||||||
valuestr = g_strdup_printf ("%f", value);
|
valuestr = g_strdup_printf ("%f", value);
|
||||||
else
|
} else {
|
||||||
valuestr = g_strdup_printf ("%.*g", DBL_DIG, value);
|
valuestr = g_strdup_printf ("%.*g", DBL_DIG, value);
|
||||||
|
}
|
||||||
xmlSetProp (parent, prop_name, valuestr);
|
xmlSetProp (parent, prop_name, valuestr);
|
||||||
g_free (valuestr);
|
g_free (valuestr);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
gchar *
|
||||||
e_xml_get_string_prop_by_name(const xmlNode *parent, const xmlChar *prop_name)
|
e_xml_get_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (parent != NULL, 0);
|
||||||
|
g_return_val_if_fail (prop_name != NULL, 0);
|
||||||
|
|
||||||
|
return e_xml_get_string_prop_by_name_with_default (parent, prop_name, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
gchar *
|
||||||
|
e_xml_get_string_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, const gchar *def)
|
||||||
{
|
{
|
||||||
xmlChar *prop;
|
xmlChar *prop;
|
||||||
char *ret_val = NULL;
|
gchar *ret_val;
|
||||||
|
|
||||||
g_return_val_if_fail (parent != NULL, 0);
|
g_return_val_if_fail (parent != NULL, 0);
|
||||||
g_return_val_if_fail (prop_name != NULL, 0);
|
g_return_val_if_fail (prop_name != NULL, 0);
|
||||||
|
|
||||||
prop = xmlGetProp ((xmlNode *)parent, prop_name);
|
prop = xmlGetProp ((xmlNode *) parent, prop_name);
|
||||||
if (prop) {
|
if (prop != NULL) {
|
||||||
ret_val = g_strdup (prop);
|
ret_val = g_strdup (prop);
|
||||||
xmlFree (prop);
|
xmlFree (prop);
|
||||||
|
} else {
|
||||||
|
ret_val = g_strdup (def);
|
||||||
}
|
}
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
e_xml_set_string_prop_by_name(xmlNode *parent, const xmlChar *prop_name, const char *value)
|
e_xml_set_string_prop_by_name (xmlNode *parent, const xmlChar *prop_name, const gchar *value)
|
||||||
{
|
{
|
||||||
g_return_if_fail (parent != NULL);
|
g_return_if_fail (parent != NULL);
|
||||||
g_return_if_fail (prop_name != NULL);
|
g_return_if_fail (prop_name != NULL);
|
||||||
|
|
||||||
if (value)
|
if (value != NULL) {
|
||||||
xmlSetProp (parent, prop_name, value);
|
xmlSetProp (parent, prop_name, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gchar *
|
||||||
char *
|
e_xml_get_translated_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
|
||||||
e_xml_get_translated_string_prop_by_name(const xmlNode *parent, const xmlChar *prop_name)
|
|
||||||
{
|
{
|
||||||
xmlChar *prop;
|
xmlChar *prop;
|
||||||
char *ret_val = NULL;
|
gchar *ret_val = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (parent != NULL, 0);
|
g_return_val_if_fail (parent != NULL, 0);
|
||||||
g_return_val_if_fail (prop_name != NULL, 0);
|
g_return_val_if_fail (prop_name != NULL, 0);
|
||||||
|
|
||||||
prop = xmlGetProp ((xmlNode *)parent, prop_name);
|
prop = xmlGetProp ((xmlNode *) parent, prop_name);
|
||||||
if (prop) {
|
if (prop != NULL) {
|
||||||
ret_val = g_strdup (_(prop));
|
ret_val = g_strdup (_(prop));
|
||||||
xmlFree (prop);
|
xmlFree (prop);
|
||||||
}
|
}
|
||||||
|
@ -26,44 +26,65 @@
|
|||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
#include <gnome-xml/tree.h>
|
#include <gnome-xml/tree.h>
|
||||||
|
|
||||||
xmlNode *e_xml_get_child_by_name (const xmlNode *parent,
|
xmlNode *e_xml_get_child_by_name (const xmlNode *parent,
|
||||||
const xmlChar *child_name);
|
const xmlChar *child_name);
|
||||||
/* lang set to NULL means use the current locale. */
|
/* lang set to NULL means use the current locale. */
|
||||||
xmlNode *e_xml_get_child_by_name_by_lang (const xmlNode *parent,
|
xmlNode *e_xml_get_child_by_name_by_lang (const xmlNode *parent,
|
||||||
const xmlChar *child_name,
|
const xmlChar *child_name,
|
||||||
const char *lang);
|
const gchar *lang);
|
||||||
|
/* lang_list set to NULL means use the current locale. */
|
||||||
|
xmlNode *e_xml_get_child_by_name_by_lang_list (const xmlNode *parent,
|
||||||
|
const gchar *name,
|
||||||
|
GList *lang_list);
|
||||||
|
xmlNode *e_xml_get_child_by_name_no_lang (const xmlNode *parent,
|
||||||
|
const gchar *name);
|
||||||
|
|
||||||
int e_xml_get_integer_prop_by_name (const xmlNode *parent,
|
gint e_xml_get_integer_prop_by_name (const xmlNode *parent,
|
||||||
const xmlChar *prop_name);
|
const xmlChar *prop_name);
|
||||||
void e_xml_set_integer_prop_by_name (xmlNode *parent,
|
gint e_xml_get_integer_prop_by_name_with_default (const xmlNode *parent,
|
||||||
const xmlChar *prop_name,
|
const xmlChar *prop_name,
|
||||||
int value);
|
gint def);
|
||||||
|
void e_xml_set_integer_prop_by_name (xmlNode *parent,
|
||||||
|
const xmlChar *prop_name,
|
||||||
|
gint value);
|
||||||
|
|
||||||
gboolean e_xml_get_bool_prop_by_name (const xmlNode *parent,
|
guint e_xml_get_uint_prop_by_name (const xmlNode *parent,
|
||||||
const xmlChar *prop_name);
|
const xmlChar *prop_name);
|
||||||
gboolean e_xml_get_bool_prop_by_name_with_default (const xmlNode *parent,
|
guint e_xml_get_uint_prop_by_name_with_default (const xmlNode *parent,
|
||||||
const xmlChar *prop_name,
|
const xmlChar *prop_name,
|
||||||
gboolean def);
|
guint def);
|
||||||
void e_xml_set_bool_prop_by_name (xmlNode *parent,
|
void e_xml_set_uint_prop_by_name (xmlNode *parent,
|
||||||
const xmlChar *prop_name,
|
const xmlChar *prop_name,
|
||||||
gboolean value);
|
guint value);
|
||||||
|
|
||||||
double e_xml_get_double_prop_by_name (const xmlNode *parent,
|
gboolean e_xml_get_bool_prop_by_name (const xmlNode *parent,
|
||||||
const xmlChar *prop_name);
|
const xmlChar *prop_name);
|
||||||
double e_xml_get_double_prop_by_name_with_default(const xmlNode *parent,
|
gboolean e_xml_get_bool_prop_by_name_with_default (const xmlNode *parent,
|
||||||
const xmlChar *prop_name,
|
const xmlChar *prop_name,
|
||||||
gdouble def);
|
gboolean def);
|
||||||
void e_xml_set_double_prop_by_name (xmlNode *parent,
|
void e_xml_set_bool_prop_by_name (xmlNode *parent,
|
||||||
const xmlChar *prop_name,
|
const xmlChar *prop_name,
|
||||||
double value);
|
gboolean value);
|
||||||
|
|
||||||
char *e_xml_get_string_prop_by_name (const xmlNode *parent,
|
gdouble e_xml_get_double_prop_by_name (const xmlNode *parent,
|
||||||
const xmlChar *prop_name);
|
const xmlChar *prop_name);
|
||||||
void e_xml_set_string_prop_by_name (xmlNode *parent,
|
gdouble e_xml_get_double_prop_by_name_with_default (const xmlNode *parent,
|
||||||
const xmlChar *prop_name,
|
const xmlChar *prop_name,
|
||||||
const char *value);
|
gdouble def);
|
||||||
|
void e_xml_set_double_prop_by_name ( xmlNode *parent,
|
||||||
|
const xmlChar *prop_name,
|
||||||
|
gdouble value);
|
||||||
|
|
||||||
char *e_xml_get_translated_string_prop_by_name (const xmlNode *parent,
|
gchar *e_xml_get_string_prop_by_name (const xmlNode *parent,
|
||||||
const xmlChar *prop_name);
|
const xmlChar *prop_name);
|
||||||
|
gchar *e_xml_get_string_prop_by_name_with_default (const xmlNode *parent,
|
||||||
|
const xmlChar *prop_name,
|
||||||
|
const gchar *def);
|
||||||
|
void e_xml_set_string_prop_by_name (xmlNode *parent,
|
||||||
|
const xmlChar *prop_name,
|
||||||
|
const gchar *value);
|
||||||
|
|
||||||
|
gchar *e_xml_get_translated_string_prop_by_name (const xmlNode *parent,
|
||||||
|
const xmlChar *prop_name);
|
||||||
|
|
||||||
#endif /* __E_XML_UTILS__ */
|
#endif /* __E_XML_UTILS__ */
|
||||||
|
Reference in New Issue
Block a user