diff options
-rw-r--r-- | src/include/report/event_config.h | 16 | ||||
-rw-r--r-- | src/lib/event_config.c | 17 | ||||
-rw-r--r-- | src/lib/event_xml_parser.c | 10 |
3 files changed, 26 insertions, 17 deletions
diff --git a/src/include/report/event_config.h b/src/include/report/event_config.h index e2310885..75fb0c78 100644 --- a/src/include/report/event_config.h +++ b/src/include/report/event_config.h @@ -47,9 +47,9 @@ typedef struct char *value; char *label; option_type_t type; - char *description; //can be used as tooltip in gtk app - char *allowed_value; - int required; + //char *description; //can be used as tooltip in gtk app + //char *allowed_value; + //int required; } event_option_t; event_option_t *new_event_option(void); @@ -58,10 +58,10 @@ void free_event_option(event_option_t *p); //structure to hold the option data typedef struct { - char *name; //name of the event "Bugzilla" "RedHat Support Uploader" - char *title; //window title - not used right now, maybe the "name" is enough? - char *action;//action description to show in gui like: Upload report to the Red Hat bugzilla" - char *description; + char *screen_name; //name of the event "Bugzilla" "RedHat Support Uploader" + //char *title; //window title - not used right now, maybe the "name" is enough? + //char *action;//action description to show in gui like: Upload report to the Red Hat bugzilla" + char *description; // "Report to ...."/"Save to file" GList *options; } event_config_t; @@ -75,7 +75,7 @@ void load_event_description_from_file(event_config_t *event_config, const char* void load_event_config_data(void); /* Frees all loaded data */ void free_event_config_data(void); -event_config_t *get_event_config(const char *name); +event_config_t *get_event_config(const char *event_name); extern GHashTable *g_event_config_list; // for iterating through entire list of all loaded configs diff --git a/src/lib/event_config.c b/src/lib/event_config.c index a79ee40c..02df048f 100644 --- a/src/lib/event_config.c +++ b/src/lib/event_config.c @@ -19,8 +19,8 @@ void free_event_option(event_option_t *p) free(p->name); free(p->value); free(p->label); - free(p->description); - free(p->allowed_value); + //free(p->description); + //free(p->allowed_value); free(p); } @@ -28,9 +28,9 @@ void free_event_config(event_config_t *p) { if (!p) return; - free(p->name); - free(p->title); - free(p->action); + free(p->screen_name); + //free(p->title); + //free(p->action); free(p->description); for (GList *opt = p->options; opt; opt = opt->next) free_event_option(opt->data); @@ -39,6 +39,11 @@ void free_event_config(event_config_t *p) } +static int mystrcmp(gconstpointer a, gconstpointer b) +{ + return strcmp( ((event_option_t *)a)->name, (char *)b); +} + // (Re)loads data from /etc/abrt/events/*.{conf,xml} void load_event_config_data(void) { @@ -91,7 +96,7 @@ void load_event_config_data(void) while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value)) { event_option_t *opt; - GList *elem = g_list_find(event_config->options, name); + GList *elem = g_list_find_custom(event_config->options, name, &mystrcmp); if (elem) { opt = elem->data; diff --git a/src/lib/event_xml_parser.c b/src/lib/event_xml_parser.c index be4a9e09..c1f200ec 100644 --- a/src/lib/event_xml_parser.c +++ b/src/lib/event_xml_parser.c @@ -6,7 +6,7 @@ #define DESCRIPTION_ELEMENT "description" #define ALLOW_EMPTY_ELEMENT "allow-empty" #define OPTION_ELEMENT "option" -#define ACTION_ELEMENT "action" +//#define ACTION_ELEMENT "action" #define NAME_ELEMENT "name" static int in_option = 0; //FIXME @@ -110,6 +110,7 @@ static void text(GMarkupParseContext *context, option->label = _text; return; } + /* if (strcmp(inner_element, DESCRIPTION_ELEMENT) == 0) { VERB2 log("tooltip:'%s'", _text); @@ -117,10 +118,12 @@ static void text(GMarkupParseContext *context, option->description = _text; return; } + */ } else { /* we're not in option, so the description is for the event */ + /* if (strcmp(inner_element, ACTION_ELEMENT) == 0) { VERB2 log("action description:'%s'", _text); @@ -128,11 +131,12 @@ static void text(GMarkupParseContext *context, ui->action = _text; return; } + */ if (strcmp(inner_element, NAME_ELEMENT) == 0) { VERB2 log("event name:'%s'", _text); - free(ui->name); - ui->name = _text; + free(ui->screen_name); + ui->screen_name = _text; return; } if (strcmp(inner_element, DESCRIPTION_ELEMENT) == 0) |