Commit f83f7714 authored by winckel's avatar winckel

Moved load of filters or messages files after GTK has entered its main loop to...

Moved load of filters or messages files after GTK has entered its main loop to avoid issue when reloading files!
Excluded "MESSAGES_ID_MAX" message from filter.
Removed unused function "ui_callback_on_tree_view_select".
Change logging level of some logs.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4321 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent f5934888
......@@ -194,7 +194,7 @@ int buffer_has_enouch_data(buffer_t *buffer, uint32_t offset, uint32_t to_get)
return -1;
underflow = (buffer->size_bytes >= ((offset + to_get) / 8)) ? 0 : -1;
if (underflow && debug_buffers)
g_debug("Detected Underflow offset %u, to_get %u, buffer size %u\n",
g_warning("Detected Underflow offset %u, to_get %u, buffer size %u\n",
offset, to_get, buffer->size_bytes);
return underflow;
}
......@@ -24,7 +24,7 @@ int file_read_dump(buffer_t **buffer, const char *filename)
return RC_BAD_PARAM;
if ((fd = open(filename, O_RDONLY)) == -1) {
g_debug("Cannot open %s for reading, returned %d:%s\n",
g_warning("Cannot open %s for reading, returned %d:%s\n",
filename, errno, strerror(errno));
return RC_FAIL;
}
......@@ -35,7 +35,7 @@ int file_read_dump(buffer_t **buffer, const char *filename)
current_read = read(fd, data, READ_BUFFER_SIZE);
if (current_read == -1)
{
g_debug("Failed to read data from file, returned %d:%s\n",
g_warning("Failed to read data from file, returned %d:%s\n",
errno, strerror(errno));
return RC_FAIL;
}
......
......@@ -84,7 +84,7 @@ static int socket_read_itti_message(socket_data_t *socket_data,
g_assert(message_header != NULL);
// g_debug("Attempting to read signal header from socket");
g_debug("Attempting to read signal header from socket");
/* Read the sub-header of signal */
while (data_read != sizeof(itti_signal_header_t)) {
......
......@@ -206,8 +206,8 @@ int resolve_pointer_type(types_t **head)
if (next_type->type != TYPE_POINTER)
continue;
// g_debug("Trying to resolve pointer id %d with type %d\n",
// next_type->id, next_type->type_xml);
// g_debug("Trying to resolve pointer id %d with type %d",
// next_type->id, next_type->type_xml);
if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) {
/* We have to remove this reference */
......@@ -314,8 +314,8 @@ int resolve_function(types_t **head)
if (next_type->type != TYPE_FUNCTION)
continue;
// g_debug("Trying to resolve function id %d with type %d\n",
// next_type->id, next_type->type_xml);
// g_debug("Trying to resolve function id %d with type %d",
// next_type->id, next_type->type_xml);
if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) {
/* We have to remove this reference */
......
......@@ -25,7 +25,7 @@ static gboolean ui_handle_socket_connection_failed(gint fd);
gboolean ui_callback_on_open_messages(GtkWidget *widget, GdkEvent *event, gpointer data)
{
g_debug("Open replay event occurred");
g_debug("Open messages event occurred");
CHECK_FCT(ui_messages_open_file_chooser());
return TRUE;
......@@ -33,7 +33,7 @@ gboolean ui_callback_on_open_messages(GtkWidget *widget, GdkEvent *event, gpoint
gboolean ui_callback_on_save_messages(GtkWidget *widget, GdkEvent *event, gpointer data)
{
g_debug("Save replay event occurred");
g_debug("Save messages event occurred");
// CHECK_FCT(ui_file_chooser());
return TRUE;
}
......@@ -222,7 +222,7 @@ gboolean ui_pipe_callback(gint source, gpointer user_data)
case UI_PIPE_UPDATE_SIGNAL_LIST:
return ui_handle_update_signal_list (source, input_data, input_data_length);
default:
g_debug("[gui] Unhandled message type %u", input_header.message_type);
g_warning("[gui] Unhandled message type %u", input_header.message_type);
g_assert_not_reached();
}
return FALSE;
......@@ -309,13 +309,6 @@ gboolean ui_callback_signal_clear_list(GtkWidget *widget, GdkEvent *event, gpoin
return TRUE;
}
gboolean ui_callback_on_tree_view_select(GtkWidget *widget, GdkEvent *event, gpointer data)
{
/* We have to retrieve the ip address and port of remote host */
g_debug("List selection event occurred");
return TRUE;
}
static gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer data)
{
ui_filter_item_t *filter_entry = data;
......@@ -323,7 +316,7 @@ static gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer da
enabled = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(widget));
filter_entry->enabled = enabled;
// g_debug("ui_callback_on_menu_item_selected occurred %x %x %s %d", widget, data, filter_entry->name, enabled);
g_debug("ui_callback_on_menu_item_selected occurred %x %x %s %d", (int) widget, (int) data, filter_entry->name, enabled);
return TRUE;
}
......@@ -348,7 +341,7 @@ static void ui_create_filter_menu(GtkWidget **menu, ui_filter_t *filter)
/* Connect function to be called when the menu item is selected */
data = &filter->items[item];
// g_debug("ui_create_filter_menu %x %x", menu_items, data);
g_debug("ui_create_filter_menu %x %x", (int) menu_items, (int) data);
g_signal_connect(G_OBJECT (menu_items), "activate", G_CALLBACK(ui_callback_on_menu_item_selected), data);
/* Show the widget */
......@@ -388,7 +381,7 @@ gboolean ui_callback_on_tree_column_header_click(GtkWidget *widget, gpointer dat
{
col_type_e col = (col_type_e) data;
// g_debug("ui_callback_on_tree_column_header_click %x", col);
g_debug("ui_callback_on_tree_column_header_click %x", col);
switch (col)
{
case COL_SIGNAL:
......
......@@ -107,7 +107,7 @@ void ui_filters_add(ui_filter_e filter, uint32_t value, char *name)
break;
default:
g_error("unknown filter type %d", filter);
g_warning("unknown filter type %d", filter);
break;
}
}
......
......@@ -22,7 +22,7 @@ gboolean ui_callback_on_pipe_notification(
/* avoid reentrancy problems and stack overflow */
g_source_remove(pipe_input->pipe_input_id);
// g_debug("Received new data on pipe %d", pipe_input->pipe_input_id);
g_debug("Received new data on pipe %d", pipe_input->pipe_input_id);
if (pipe_input->input_cb(pipe_input->source_fd, pipe_input->user_data)) {
/* restore pipe handler */
......@@ -82,7 +82,7 @@ int ui_pipe_write_message(int pipe_fd, const uint16_t message_type,
ret = write(pipe_fd, &pipe_input_header, sizeof(pipe_input_header));
if (ret < 0) {
g_debug("Failed to write header to pipe: %s", g_strerror(errno));
g_warning("Failed to write header to pipe: %s", g_strerror(errno));
return ret;
}
......@@ -90,7 +90,7 @@ int ui_pipe_write_message(int pipe_fd, const uint16_t message_type,
if (message_size > 0) {
ret = write(pipe_fd, message, message_size);
if (ret < 0) {
g_debug("Failed to write message of size %u at 0x%p to pipe: %s",
g_warning("Failed to write message of size %u at 0x%p to pipe: %s",
message_size, message, g_strerror(errno));
return ret;
}
......
#if HAVE_CONFIG_H
# include "config.h"
#endif
......@@ -47,8 +46,8 @@ static void ui_gtk_parse_arg(int argc, char *argv[])
break;
case 'h':
ui_help();
exit(0);
ui_help ();
exit (0);
break;
case 'i':
......@@ -71,56 +70,67 @@ static void ui_gtk_parse_arg(int argc, char *argv[])
}
}
static int ui_idle_callback(gpointer data)
{
g_debug("Entering idle state");
/* Read filters file */
if (ui_main_data.filters_file_name != NULL)
{
// ui_filters_read(ui_main_data.filters_file_name);
}
/* Read messages file */
if (ui_main_data.messages_file_name != NULL)
{
ui_messages_read (ui_main_data.messages_file_name);
}
/* One shot execution */
return FALSE;
}
int ui_gtk_initialize(int argc, char *argv[])
{
GtkWidget *vbox;
memset(&ui_main_data, 0, sizeof(ui_main_data_t));
memset (&ui_main_data, 0, sizeof(ui_main_data_t));
/* Set some default initialization value */
ui_main_data.ip_entry_init = "127.0.0.1";
ui_main_data.port_entry_init = "10007";
ui_gtk_parse_arg(argc, argv);
ui_gtk_parse_arg (argc, argv);
/* Create the main window */
ui_main_data.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
ui_init_filters(TRUE, FALSE);
ui_main_data.window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
ui_init_filters (TRUE, FALSE);
gtk_window_set_position(GTK_WINDOW(ui_main_data.window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(ui_main_data.window), 1024, 800);
gtk_window_set_position (GTK_WINDOW(ui_main_data.window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size (GTK_WINDOW(ui_main_data.window), 1024, 800);
#if defined(PACKAGE_STRING)
gtk_window_set_title(GTK_WINDOW(ui_main_data.window), PACKAGE_STRING);
#else
gtk_window_set_title(GTK_WINDOW(ui_main_data.window), "itti debugger");
gtk_window_set_title (GTK_WINDOW(ui_main_data.window), "itti debugger");
#endif
gtk_window_set_resizable(GTK_WINDOW(ui_main_data.window), TRUE);
gtk_window_set_resizable (GTK_WINDOW(ui_main_data.window), TRUE);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
CHECK_FCT(ui_menu_bar_create(vbox));
CHECK_FCT(ui_toolbar_create(vbox));
// CHECK_FCT(ui_tree_view_create(ui_main_data.window, vbox));
CHECK_FCT(ui_notebook_create(vbox));
gtk_container_add(GTK_CONTAINER(ui_main_data.window), vbox);
gtk_container_add (GTK_CONTAINER(ui_main_data.window), vbox);
/* Assign the destroy event */
g_signal_connect(ui_main_data.window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
/* Show the application window */
gtk_widget_show_all (ui_main_data.window);
/* Read filters file */
if (ui_main_data.filters_file_name != NULL)
{
// ui_filters_read(ui_main_data.filters_file_name);
}
/* Read messages file */
if (ui_main_data.messages_file_name != NULL)
{
ui_messages_read(ui_main_data.messages_file_name);
}
g_idle_add (ui_idle_callback, NULL);
return RC_OK;
}
......@@ -70,7 +70,7 @@ int ui_messages_read(char *filename)
{
input_data_length = message_header.message_size - sizeof(itti_socket_header_t);
// g_debug ("%x, %x ,%x\n", message_header.message_type, message_header.message_size, input_data_length);
// g_debug ("%x, %x ,%x", message_header.message_type, message_header.message_size, input_data_length);
/* Checking for non-header part */
if (input_data_length > 0)
......@@ -113,7 +113,7 @@ int ui_messages_read(char *filename)
case ITTI_STATISTIC_MESSAGE_TYPE:
default:
g_debug("Received unknow (or not implemented) message from socket type: %d", message_header.message_type);
g_warning("Received unknow (or not implemented) message from socket type: %d", message_header.message_type);
break;
}
......@@ -127,7 +127,7 @@ int ui_messages_read(char *filename)
ui_set_sensitive_move_buttons (TRUE);
}
g_debug("Read %d messages from file \"%s\"\n", read_messages, filename);
g_message("Read %d messages from file \"%s\"\n", read_messages, filename);
close (source);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment