From 01d0aa7cba1e4bcd885bc21b690996712ed75a34 Mon Sep 17 00:00:00 2001 From: winckel <winckel@eurecom.fr> Date: Thu, 7 Nov 2013 09:59:06 +0000 Subject: [PATCH] Integrated consol logging within dialog box. Updated use of dialog box. git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4339 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- common/utils/itti_analyzer/libparser/xml_parse.c | 9 ++++----- common/utils/itti_analyzer/libui/ui_filters.c | 4 +--- common/utils/itti_analyzer/libui/ui_notif_dlg.c | 2 ++ common/utils/itti_analyzer/libui/ui_notifications.c | 10 +++++++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/common/utils/itti_analyzer/libparser/xml_parse.c b/common/utils/itti_analyzer/libparser/xml_parse.c index 20bc0dd9129..03062ac2c1d 100644 --- a/common/utils/itti_analyzer/libparser/xml_parse.c +++ b/common/utils/itti_analyzer/libparser/xml_parse.c @@ -665,8 +665,8 @@ int xml_parse_buffer(const char *xml_buffer, const int size) { doc = xmlReadMemory(xml_buffer, size, NULL, NULL, 0); if (doc == NULL) { - g_warning("Failed to parse buffer: %s", xml_buffer); -// ui_notification_dialog(DIALOG_WARNING, "Fail to parse XML buffer"); + g_warning("Failed to parse XML buffer: %s", xml_buffer); + ui_notification_dialog(GTK_MESSAGE_ERROR, "parse messages format definition", "Fail to parse XML buffer"); return RC_FAIL; } @@ -683,8 +683,7 @@ int xml_parse_file(const char *filename) { doc = xmlReadFile (filename, NULL, 0); if (doc == NULL) { - g_warning("Failed to parse %s", filename); -// ui_notification_dialog(DIALOG_WARNING, "Failed to parse file \"%s\"", filename); + ui_notification_dialog(GTK_MESSAGE_ERROR, "parse messages format definition", "Failed to parse file \"%s\"", filename); return RC_FAIL; } @@ -786,7 +785,7 @@ int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_ gpointer user_data) { if (root == NULL) { -// ui_notification_dialog(DIALOG_ERROR, "No message XML file provided"); + g_error("No messages format definition provided"); return RC_FAIL; } diff --git a/common/utils/itti_analyzer/libui/ui_filters.c b/common/utils/itti_analyzer/libui/ui_filters.c index c046b0d5e44..6db828c1238 100644 --- a/common/utils/itti_analyzer/libui/ui_filters.c +++ b/common/utils/itti_analyzer/libui/ui_filters.c @@ -302,7 +302,6 @@ int ui_filters_read(const char *file_name) if (doc == NULL) { - g_warning("Failed to parse \"%s\"", file_name); ui_notification_dialog (GTK_MESSAGE_ERROR, "open filters", "Failed to parse file \"%s\"", file_name); return RC_FAIL; } @@ -311,8 +310,7 @@ int ui_filters_read(const char *file_name) if (ret != RC_OK) { - g_warning("Found no filter definition in \"%s\"", file_name); - ui_notification_dialog (GTK_MESSAGE_ERROR, "open filters", "Found no filter definitions in \"%s\"", file_name); + ui_notification_dialog (GTK_MESSAGE_WARNING, "open filters", "Found no filter definitions in \"%s\"", file_name); return RC_FAIL; } diff --git a/common/utils/itti_analyzer/libui/ui_notif_dlg.c b/common/utils/itti_analyzer/libui/ui_notif_dlg.c index 97908006d75..42dc60a1582 100644 --- a/common/utils/itti_analyzer/libui/ui_notif_dlg.c +++ b/common/utils/itti_analyzer/libui/ui_notif_dlg.c @@ -16,6 +16,8 @@ int ui_notification_dialog(GtkMessageType type, const char *title, const char *f vsnprintf (buffer, sizeof(buffer), fmt, args); + g_warning("%s", buffer); + dialogbox = gtk_message_dialog_new (GTK_WINDOW(ui_main_data.window), GTK_DIALOG_MODAL, type, GTK_BUTTONS_OK, "%s", buffer); diff --git a/common/utils/itti_analyzer/libui/ui_notifications.c b/common/utils/itti_analyzer/libui/ui_notifications.c index 1e900618440..d78bc5e8257 100644 --- a/common/utils/itti_analyzer/libui/ui_notifications.c +++ b/common/utils/itti_analyzer/libui/ui_notifications.c @@ -12,6 +12,7 @@ #include "ui_main_screen.h" #include "ui_menu_bar.h" #include "ui_notifications.h" +#include "ui_notif_dlg.h" #include "ui_callbacks.h" #include "ui_filters.h" @@ -78,7 +79,7 @@ int ui_messages_read(char *filename) source = open (filename, O_RDONLY); if (source < 0) { - g_warning( "Failed to open file \"%s\": %s", filename, g_strerror (errno)); + ui_notification_dialog (GTK_MESSAGE_ERROR, "open messages", "Failed to open file \"%s\": %s", filename, g_strerror (errno)); result = RC_FAIL; } else @@ -93,7 +94,7 @@ int ui_messages_read(char *filename) if (read_data == -1) { - g_warning("Failed to read from file \"%s\": %s", filename, g_strerror (errno)); + ui_notification_dialog (GTK_MESSAGE_ERROR, "open messages", "Failed to read from file \"%s\": %s", filename, g_strerror (errno)); result = RC_FAIL; break; } @@ -112,6 +113,7 @@ int ui_messages_read(char *filename) if (read (source, input_data, input_data_length) < 0) { g_warning("Failed to read from file \"%s\": %s", filename, g_strerror (errno)); + ui_notification_dialog (GTK_MESSAGE_ERROR, "open messages", "Failed to read from file \"%s\": %s", filename, g_strerror (errno)); result = RC_FAIL; break; } @@ -145,7 +147,9 @@ int ui_messages_read(char *filename) case ITTI_STATISTIC_MESSAGE_TYPE: default: - g_warning("Received unknow (or not implemented) message from socket type: %d", message_header.message_type); + ui_notification_dialog (GTK_MESSAGE_WARNING, "open messages", + "Unknown (or not implemented) record type %d in file \"%s\"", + message_header.message_type, filename); break; } -- GitLab