From 6d1f476a71a9c61a90f49edda008ae3c2a340d65 Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Sun, 13 Mar 2011 15:46:30 +0100 Subject: teach event xml parser to understand --- src/lib/event_xml_parser.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'src/lib/event_xml_parser.c') diff --git a/src/lib/event_xml_parser.c b/src/lib/event_xml_parser.c index c144d845..f24606e0 100644 --- a/src/lib/event_xml_parser.c +++ b/src/lib/event_xml_parser.c @@ -1,13 +1,14 @@ #include "abrtlib.h" #include "event_config.h" -#define EVENT_ELEMENT "event" -#define LABEL_ELEMENT "label" -#define DESCRIPTION_ELEMENT "description" -#define ALLOW_EMPTY_ELEMENT "allow-empty" -#define OPTION_ELEMENT "option" -//#define ACTION_ELEMENT "action" -#define NAME_ELEMENT "name" +#define EVENT_ELEMENT "event" +#define LABEL_ELEMENT "label" +#define DESCRIPTION_ELEMENT "description" +#define ALLOW_EMPTY_ELEMENT "allow-empty" +#define OPTION_ELEMENT "option" +//#define ACTION_ELEMENT "action" +#define NAME_ELEMENT "name" +#define DEFAULT_VALUE_ELEMENT "default-value" struct my_parse_data { @@ -156,6 +157,19 @@ static void text(GMarkupParseContext *context, return; } /* + * we can add a separate filed for the default value + * in that case we can implement features like "reset to default value" + * but for now using "value" should be enough and clients doesn't + * have to know about the "defaul-value" + */ + if (strcmp(inner_element, DEFAULT_VALUE_ELEMENT) == 0) + { + VERB2 log("default value:'%s'", text_copy); + free(opt->value); + opt->value = text_copy; + return; + } + /* if (strcmp(inner_element, DESCRIPTION_ELEMENT) == 0) { VERB2 log("tooltip:'%s'", text_copy); -- cgit