From fc1d5a881f4c4c4fad807e3d04842df1dd27b253 Mon Sep 17 00:00:00 2001 From: winckel Date: Tue, 19 Nov 2013 14:39:35 +0000 Subject: [PATCH] Added support for other log levels in ITTI. Renamed messages list tree view. git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4432 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- .../utils/itti_analyzer/libui/ui_callbacks.c | 22 ++++++++----- .../itti_analyzer/libui/ui_main_screen.c | 2 +- .../itti_analyzer/libui/ui_main_screen.h | 2 +- .../utils/itti_analyzer/libui/ui_tree_view.c | 31 ++++++++++--------- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/common/utils/itti_analyzer/libui/ui_callbacks.c b/common/utils/itti_analyzer/libui/ui_callbacks.c index f4275f8d2c..5e1e4e8326 100644 --- a/common/utils/itti_analyzer/libui/ui_callbacks.c +++ b/common/utils/itti_analyzer/libui/ui_callbacks.c @@ -73,14 +73,17 @@ gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data) } ui_tree_view_refilter(); - if (ui_main_data.signalslist != NULL) + if (ui_main_data.messages_list != NULL) { GtkTreePath *path_row; - /* Select the message in requested row */ - gtk_tree_view_get_cursor(GTK_TREE_VIEW(ui_main_data.signalslist), &path_row, NULL); - /* Center the message in the middle of the list if possible */ - gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(ui_main_data.signalslist), path_row, NULL, TRUE, 0.5, 0.0); + /* Get the currently selected message */ + gtk_tree_view_get_cursor(GTK_TREE_VIEW(ui_main_data.messages_list), &path_row, NULL); + if (path_row != NULL) + { + /* Center the message in the middle of the list if possible */ + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(ui_main_data.messages_list), path_row, NULL, TRUE, 0.5, 0.0); + } } } @@ -185,6 +188,9 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel if ((strcmp(message_id_to_string(message_id), "ERROR_LOG") == 0) || (strcmp(message_id_to_string(message_id), "WARNING_LOG") == 0) + || (strcmp(message_id_to_string(message_id), "NOTICE_LOG") == 0) + || (strcmp(message_id_to_string(message_id), "INFO_LOG") == 0) + || (strcmp(message_id_to_string(message_id), "DEBUG_LOG") == 0) || (strcmp(message_id_to_string(message_id), "GENERIC_LOG") == 0)) { gchar *data; @@ -231,7 +237,7 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data) char lte_time[15]; - gtk_tree_view_get_cursor (GTK_TREE_VIEW(ui_main_data.signalslist), &path, &focus_column); + gtk_tree_view_get_cursor (GTK_TREE_VIEW(ui_main_data.messages_list), &path, &focus_column); signal_buffer = (buffer_t *) data; @@ -447,7 +453,7 @@ gboolean ui_callback_signal_go_to(GtkWidget *widget, gpointer data) gboolean ui_callback_signal_go_to_entry(GtkWidget *widget, gpointer data) { // gtk_entry_buffer_set_text(GTK_ENTRY(ui_main_data.signals_go_to_entry), ""); - gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.signalslist); + gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.messages_list); return TRUE; } @@ -480,7 +486,7 @@ gboolean ui_callback_signal_clear_list(GtkWidget *widget, gpointer data) ui_set_title (""); /* Clear list of signals */ - ui_tree_view_destroy_list (ui_main_data.signalslist); + ui_tree_view_destroy_list (ui_main_data.messages_list); if (ui_main_data.text_view != NULL) { diff --git a/common/utils/itti_analyzer/libui/ui_main_screen.c b/common/utils/itti_analyzer/libui/ui_main_screen.c index b0bccef9b2..e89e6eba10 100644 --- a/common/utils/itti_analyzer/libui/ui_main_screen.c +++ b/common/utils/itti_analyzer/libui/ui_main_screen.c @@ -117,7 +117,7 @@ static int ui_idle_callback(gpointer data) { g_debug("Entering idle state"); - gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.signalslist); + gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.messages_list); /* Read filters file */ if (ui_main_data.filters_file_name != NULL) diff --git a/common/utils/itti_analyzer/libui/ui_main_screen.h b/common/utils/itti_analyzer/libui/ui_main_screen.h index 5420d20296..67d80dcfec 100644 --- a/common/utils/itti_analyzer/libui/ui_main_screen.h +++ b/common/utils/itti_analyzer/libui/ui_main_screen.h @@ -14,7 +14,7 @@ typedef struct { GtkWidget *progressbar_window; GtkWidget *progressbar; - GtkWidget *signalslist; + GtkWidget *messages_list; ui_text_view_t *text_view; /* Buttons */ diff --git a/common/utils/itti_analyzer/libui/ui_tree_view.c b/common/utils/itti_analyzer/libui/ui_tree_view.c index b67870fa16..7dfbda73e1 100644 --- a/common/utils/itti_analyzer/libui/ui_tree_view.c +++ b/common/utils/itti_analyzer/libui/ui_tree_view.c @@ -248,21 +248,21 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - ui_main_data.signalslist = gtk_tree_view_new(); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(ui_main_data.signalslist), TRUE); - gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW(ui_main_data.signalslist), ui_tree_view_search, NULL, NULL); - gtk_tree_view_set_search_entry (GTK_TREE_VIEW(ui_main_data.signalslist), GTK_ENTRY(ui_main_data.signals_go_to_entry)); + ui_main_data.messages_list = gtk_tree_view_new(); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(ui_main_data.messages_list), TRUE); + gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW(ui_main_data.messages_list), ui_tree_view_search, NULL, NULL); + gtk_tree_view_set_search_entry (GTK_TREE_VIEW(ui_main_data.messages_list), GTK_ENTRY(ui_main_data.signals_go_to_entry)); /* Disable multiple selection */ - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ui_main_data.signalslist)); + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ui_main_data.messages_list)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE); hbox = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add(GTK_CONTAINER(scrolled_window), ui_main_data.signalslist); + gtk_container_add(GTK_CONTAINER(scrolled_window), ui_main_data.messages_list); - ui_tree_view_init_list(ui_main_data.signalslist); - gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(ui_main_data.signalslist), TRUE); + ui_tree_view_init_list(ui_main_data.messages_list); + gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(ui_main_data.messages_list), TRUE); gtk_scrolled_window_set_min_content_width(GTK_SCROLLED_WINDOW(scrolled_window), 620); gtk_paned_pack1 (GTK_PANED (hbox), scrolled_window, FALSE, TRUE); @@ -270,7 +270,7 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); - g_signal_connect(G_OBJECT(ui_main_data.signalslist), "button-press-event", G_CALLBACK (onButtonPressed), NULL); + g_signal_connect(G_OBJECT(ui_main_data.messages_list), "button-press-event", G_CALLBACK (onButtonPressed), NULL); // g_signal_connect(G_OBJECT(ui_main_data.signalslist), "button-release-event", G_CALLBACK (onButtonRelease), NULL); /* Connect callback on row selection */ @@ -306,7 +306,7 @@ int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_ ui_destroy_filter_menu(FILTER_INSTANCES); } - ui_tree_view_add_to_list(ui_main_data.signalslist, lte_time, message_number, message_id, message_name, + ui_tree_view_add_to_list(ui_main_data.messages_list, lte_time, message_number, message_id, message_name, origin_task_id, origin_task, destination_task_id, destination_task, instance, (buffer_t *)buffer); return RC_OK; @@ -318,10 +318,13 @@ void ui_tree_view_select_row(gint row) path_row = gtk_tree_path_new_from_indices(row, -1); - /* Select the message in requested row */ - gtk_tree_view_set_cursor(GTK_TREE_VIEW(ui_main_data.signalslist), path_row, NULL, FALSE); - /* Center the message in the middle of the list if possible */ - gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(ui_main_data.signalslist), path_row, NULL, TRUE, 0.5, 0.0); + if (path_row != NULL) + { + /* Select the message in requested row */ + gtk_tree_view_set_cursor(GTK_TREE_VIEW(ui_main_data.messages_list), path_row, NULL, FALSE); + /* Center the message in the middle of the list if possible */ + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(ui_main_data.messages_list), path_row, NULL, TRUE, 0.5, 0.0); + } } void ui_tree_view_refilter(void)