From 6e82ddd5603312456ade0dc52bf5a129f04eb958 Mon Sep 17 00:00:00 2001
From: winckel <winckel@eurecom.fr>
Date: Thu, 21 Nov 2013 13:26:17 +0000
Subject: [PATCH] Replaced right-click on messageselect  handler by a popup
 menu that control all filtered items for the row.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4485 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 .../utils/itti_analyzer/libui/ui_callbacks.c  | 150 +++++++++++++++---
 .../utils/itti_analyzer/libui/ui_callbacks.h  |  15 +-
 common/utils/itti_analyzer/libui/ui_filters.c | 131 +++++++--------
 common/utils/itti_analyzer/libui/ui_filters.h |   2 +-
 .../utils/itti_analyzer/libui/ui_tree_view.c  | 139 ++++++++++++----
 .../utils/itti_analyzer/libui/ui_tree_view.h  |  22 ++-
 6 files changed, 326 insertions(+), 133 deletions(-)

diff --git a/common/utils/itti_analyzer/libui/ui_callbacks.c b/common/utils/itti_analyzer/libui/ui_callbacks.c
index 0a4cce4997..5bfcdaec26 100644
--- a/common/utils/itti_analyzer/libui/ui_callbacks.c
+++ b/common/utils/itti_analyzer/libui/ui_callbacks.c
@@ -147,14 +147,16 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
 
         if (gtk_tree_model_get_iter (model, &iter, path))
         {
-            GValue buffer_store = G_VALUE_INIT;
             gpointer buffer;
 
-            GValue message_id_store = G_VALUE_INIT;
-            guint message_id;
+            uint32_t message_id;
+            uint32_t origin_task_id;
+            uint32_t destination_task_id;
+            uint32_t instance;
+            char label[100];
 
-            gtk_tree_model_get_value (model, &iter, COL_BUFFER, &buffer_store);
-            buffer = g_value_get_pointer (&buffer_store);
+            gtk_tree_model_get (model, &iter, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID, &origin_task_id,
+                                COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE, &instance, COL_BUFFER, &buffer, -1);
 
             g_debug("  Get iter %p %p", buffer_current, buffer);
 
@@ -175,22 +177,88 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
                         /* Clear event */
                         ui_tree_view_last_event = NULL;
 
-                        gtk_tree_model_get (model, &iter, COL_MESSAGE_ID, &message_id, -1);
-                        item = ui_filters_search_id (&ui_filters.messages, message_id);
-
                         if (ui_main_data.menu_filter_messages == NULL)
                         {
-                            ui_create_filter_menu (&ui_main_data.menu_filter_messages, &ui_filters.messages);
+                            ui_create_filter_menus ();
                         }
 
-                        g_debug("Message selected right click %d %d %s", message_id, item, ui_filters.messages.items[item].name);
-                        gtk_check_menu_item_set_active (
-                                GTK_CHECK_MENU_ITEM(ui_filters.messages.items[item].menu_item),
-                                !gtk_check_menu_item_get_active (
-                                        GTK_CHECK_MENU_ITEM(ui_filters.messages.items[item].menu_item)));
-                        g_debug("Message selected right click new state %d", gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(ui_filters.messages.items[item].menu_item)));
+                        g_debug("Message selected right click %d %d %d %d", message_id, origin_task_id, destination_task_id, instance);
 
-                        return FALSE;
+                        /* Message Id menu */
+                        {
+                            /* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */
+                            ui_tree_view_menu_enable[MENU_MESSAGE].menu_item = NULL;
+                            item = ui_filters_search_id (&ui_filters.messages, message_id);
+                            /* Update the menu item check state based on message ID state */
+                            gtk_check_menu_item_set_active (
+                                    GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_MESSAGE].menu_enable),
+                                    ui_filters.messages.items[item].enabled);
+                            /* Set menu item label */
+                            sprintf (label, "Message:  %s", message_id_to_string (message_id));
+                            gtk_menu_item_set_label (GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_MESSAGE].menu_enable),
+                                                     label);
+                            /* Save menu item associated to this row */
+                            ui_tree_view_menu_enable[MENU_MESSAGE].menu_item =
+                                    ui_filters.messages.items[item].menu_item;
+                        }
+
+                        /* Origin task id */
+                        {
+                            /* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */
+                            ui_tree_view_menu_enable[MENU_FROM_TASK].menu_item = NULL;
+                            item = ui_filters_search_id (&ui_filters.origin_tasks, origin_task_id);
+                            /* Update the menu item check state based on message ID state */
+                            gtk_check_menu_item_set_active (
+                                    GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_FROM_TASK].menu_enable),
+                                    ui_filters.origin_tasks.items[item].enabled);
+                            /* Set menu item label */
+                            sprintf (label, "From:  %s", task_id_to_string (origin_task_id, origin_task_id_type));
+                            gtk_menu_item_set_label (
+                                    GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_FROM_TASK].menu_enable), label);
+                            /* Save menu item associated to this row */
+                            ui_tree_view_menu_enable[MENU_FROM_TASK].menu_item =
+                                    ui_filters.origin_tasks.items[item].menu_item;
+                        }
+
+                        /* Destination task id */
+                        {
+                            /* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */
+                            ui_tree_view_menu_enable[MENU_TO_TASK].menu_item = NULL;
+                            item = ui_filters_search_id (&ui_filters.destination_tasks, destination_task_id);
+                            /* Update the menu item check state based on message ID state */
+                            gtk_check_menu_item_set_active (
+                                    GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_TO_TASK].menu_enable),
+                                    ui_filters.destination_tasks.items[item].enabled);
+                            /* Set menu item label */
+                            sprintf (label, "To:  %s",
+                                     task_id_to_string (destination_task_id, destination_task_id_type));
+                            gtk_menu_item_set_label (GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_TO_TASK].menu_enable),
+                                                     label);
+                            /* Save menu item associated to this row */
+                            ui_tree_view_menu_enable[MENU_TO_TASK].menu_item =
+                                    ui_filters.destination_tasks.items[item].menu_item;
+                        }
+
+                        /* Instance */
+                        {
+                            /* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */
+                            ui_tree_view_menu_enable[MENU_INSTANCE].menu_item = NULL;
+                            item = ui_filters_search_id (&ui_filters.instances, instance);
+                            /* Update the menu item check state based on message ID state */
+                            gtk_check_menu_item_set_active (
+                                    GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_INSTANCE].menu_enable),
+                                    ui_filters.instances.items[item].enabled);
+                            /* Set menu item label */
+                            sprintf (label, "Instance:  %d", instance);
+                            gtk_menu_item_set_label (GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_INSTANCE].menu_enable),
+                                                     label);
+                            /* Save menu item associated to this row */
+                            ui_tree_view_menu_enable[MENU_INSTANCE].menu_item =
+                                    ui_filters.instances.items[item].menu_item;
+                        }
+
+                        gtk_menu_popup (GTK_MENU (ui_tree_view_menu), NULL, NULL, NULL, NULL, 0,
+                                        gtk_get_current_event_time ());
                     }
                 }
 
@@ -202,9 +270,6 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
             {
                 buffer_current = buffer;
 
-                gtk_tree_model_get_value (model, &iter, COL_MESSAGE_ID, &message_id_store);
-                message_id = g_value_get_uint (&message_id_store);
-
                 /* Clear the view */
                 CHECK_FCT_DO(ui_signal_dissect_clear_view(text_view), return FALSE);
 
@@ -250,6 +315,41 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
     return TRUE;
 }
 
+gboolean ui_callback_on_menu_enable(GtkWidget *widget, gpointer data)
+{
+    ui_tree_view_menu_enable_t *menu_enable = data;
+
+    if (menu_enable->menu_item != NULL)
+    {
+        gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_enable->menu_item),
+                                        gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(menu_enable->menu_enable)));
+        menu_enable->menu_item = NULL;
+    }
+
+    return TRUE;
+}
+
+gboolean ui_callback_on_menu_color(GtkWidget *widget, gpointer data)
+{
+    GdkRGBA color;
+    GtkWidget *color_chooser;
+    gint response;
+
+    color_chooser = gtk_color_chooser_dialog_new ("Select color", GTK_WINDOW(ui_main_data.window));
+    gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER(color_chooser), FALSE);
+    response = gtk_dialog_run (GTK_DIALOG (color_chooser));
+
+    if (response == GTK_RESPONSE_OK)
+    {
+        gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER(color_chooser), &color);
+
+        g_message("Selected color %f %f %f", color.red, color.green, color.blue);
+    }
+    gtk_widget_destroy (color_chooser);
+
+    return TRUE;
+}
+
 void ui_signal_add_to_list(gpointer data, gpointer user_data)
 {
     gboolean goto_last = user_data ? TRUE : FALSE;
@@ -542,9 +642,9 @@ gboolean ui_callback_on_menu_none(GtkWidget *widget, gpointer data)
     gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) FALSE);
     refresh_message_list = TRUE;
 
-    if (filters_changed);
+    if (filters_changed)
     {
-        ui_tree_view_refilter();
+        ui_tree_view_refilter ();
         filters_changed = FALSE;
     }
 
@@ -561,9 +661,9 @@ gboolean ui_callback_on_menu_all(GtkWidget *widget, gpointer data)
     gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) TRUE);
     refresh_message_list = TRUE;
 
-    if (filters_changed);
+    if (filters_changed)
     {
-        ui_tree_view_refilter();
+        ui_tree_view_refilter ();
         filters_changed = FALSE;
     }
 
@@ -581,7 +681,7 @@ gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer data)
         filter_entry->enabled = enabled;
         if (refresh_message_list)
         {
-            ui_tree_view_refilter();
+            ui_tree_view_refilter ();
         }
         else
         {
@@ -595,7 +695,7 @@ gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer data)
 
 gboolean ui_callback_on_tree_column_header_click(GtkWidget *widget, gpointer data)
 {
-    col_type_e col = (col_type_e) data;
+    col_type_t col = (col_type_t) data;
 
     g_debug("ui_callback_on_tree_column_header_click %d", col);
     switch (col)
diff --git a/common/utils/itti_analyzer/libui/ui_callbacks.h b/common/utils/itti_analyzer/libui/ui_callbacks.h
index 66db3504d0..bc6d006f56 100644
--- a/common/utils/itti_analyzer/libui/ui_callbacks.h
+++ b/common/utils/itti_analyzer/libui/ui_callbacks.h
@@ -37,12 +37,15 @@ gboolean ui_callback_on_tree_view_select(GtkWidget *widget,
                                          GdkEvent  *event,
                                          gpointer   data);
 
-gboolean
-ui_callback_on_select_signal(GtkTreeSelection *selection,
-                             GtkTreeModel     *model,
-                             GtkTreePath      *path,
-                             gboolean          path_currently_selected,
-                             gpointer          userdata);
+gboolean ui_callback_on_select_signal(GtkTreeSelection *selection,
+                                      GtkTreeModel     *model,
+                                      GtkTreePath      *path,
+                                      gboolean          path_currently_selected,
+                                      gpointer          userdata);
+
+gboolean ui_callback_on_menu_enable (GtkWidget *widget, gpointer data);
+
+gboolean ui_callback_on_menu_color (GtkWidget *widget, gpointer data);
 
 gboolean ui_callback_signal_go_to_first(GtkWidget *widget,
                                         gpointer   data);
diff --git a/common/utils/itti_analyzer/libui/ui_filters.c b/common/utils/itti_analyzer/libui/ui_filters.c
index 38db199817..fa98ba48e1 100644
--- a/common/utils/itti_analyzer/libui/ui_filters.c
+++ b/common/utils/itti_analyzer/libui/ui_filters.c
@@ -392,83 +392,89 @@ int ui_filters_file_write(const char *file_name)
     return RC_OK;
 }
 
-void ui_create_filter_menu(GtkWidget **menu, ui_filter_t *filter)
+static void ui_create_filter_menu(GtkWidget **menu, ui_filter_t *filter)
 {
-    GtkWidget *menu_items;
-    int item;
-    gpointer data;
+    if (*menu == NULL)
+    {
+        GtkWidget *menu_items;
+        int item;
+        gpointer data;
 
-    *menu = gtk_menu_new();
+        *menu = gtk_menu_new ();
 
-    /* Create the "NONE" menu-item */
-    {
-        /* Create a new menu-item with a name */
-        menu_items = gtk_menu_item_new_with_label("NONE");
+        /* Create the "NONE" menu-item */
+        {
+            /* Create a new menu-item with a name */
+            menu_items = gtk_menu_item_new_with_label ("NONE");
 
-        /* Add it to the menu. */
-        gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items);
+            /* Add it to the menu. */
+            gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items);
 
-        g_debug("ui_create_filter_menu %lx", (long) menu_items);
-        g_signal_connect(G_OBJECT(menu_items), "activate",
-                G_CALLBACK(ui_callback_on_menu_none), *menu);
+            g_debug("ui_create_filter_menu %lx", (long) menu_items);
+            g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_none), *menu);
 
-        /* Show the widget */
-        gtk_widget_show(menu_items);
-    }
+            /* Show the widget */
+            gtk_widget_show (menu_items);
+        }
 
-    /* Create the "ALL" menu-item */
-    {
-        /* Create a new menu-item with a name */
-        menu_items = gtk_menu_item_new_with_label("ALL");
+        /* Create the "ALL" menu-item */
+        {
+            /* Create a new menu-item with a name */
+            menu_items = gtk_menu_item_new_with_label ("ALL");
 
-        /* Add it to the menu. */
-        gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items);
+            /* Add it to the menu. */
+            gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items);
 
-        g_debug("ui_create_filter_menu %lx", (long) menu_items);
-        g_signal_connect(G_OBJECT(menu_items), "activate",
-                G_CALLBACK(ui_callback_on_menu_all), *menu);
+            g_debug("ui_create_filter_menu %lx", (long) menu_items);
+            g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_all), *menu);
 
-        /* Show the widget */
-        gtk_widget_show(menu_items);
-    }
+            /* Show the widget */
+            gtk_widget_show (menu_items);
+        }
 
-    /* Create separator */
-    {
-        menu_items = gtk_menu_item_new();
+        /* Create separator */
+        {
+            menu_items = gtk_menu_item_new ();
 
-        /* Add it to the menu. */
-        gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items);
+            /* Add it to the menu. */
+            gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items);
 
-        /* Show the widget */
-        gtk_widget_show(menu_items);
-    }
+            /* Show the widget */
+            gtk_widget_show (menu_items);
+        }
 
-    /* Creates menu-items */
-    for (item = 0; item < filter->used; item++)
-    {
-        /* Create a new menu-item with a name */
-        menu_items = gtk_check_menu_item_new_with_label(
-                filter->items[item].name);
-
-        /* Add it to the menu. */
-        gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items);
-
-        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_items),
-                filter->items[item].enabled);
-
-        /* Connect function to be called when the menu item is selected */
-        data = &filter->items[item];
-        g_debug("ui_create_filter_menu %lx %lx", (long) menu_items, (long) data);
-        g_signal_connect(G_OBJECT(menu_items), "activate",
-                G_CALLBACK(ui_callback_on_menu_item_selected), data);
-        /* Save the menu_item reference */
-        filter->items[item].menu_item = menu_items;
-
-        /* Show the widget */
-        gtk_widget_show(menu_items);
+        /* Creates menu-items */
+        for (item = 0; item < filter->used; item++)
+        {
+            /* Create a new menu-item with a name */
+            menu_items = gtk_check_menu_item_new_with_label (filter->items[item].name);
+
+            /* Add it to the menu. */
+            gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items);
+
+            gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_items), filter->items[item].enabled);
+
+            /* Connect function to be called when the menu item is selected */
+            data = &filter->items[item];
+            g_debug("ui_create_filter_menu %lx %lx", (long) menu_items, (long) data);
+            g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_item_selected), data);
+            /* Save the menu_item reference */
+            filter->items[item].menu_item = menu_items;
+
+            /* Show the widget */
+            gtk_widget_show (menu_items);
+        }
     }
 }
 
+void ui_create_filter_menus(void)
+{
+    ui_create_filter_menu (&ui_main_data.menu_filter_messages, &ui_filters.messages);
+    ui_create_filter_menu (&ui_main_data.menu_filter_origin_tasks, &ui_filters.origin_tasks);
+    ui_create_filter_menu (&ui_main_data.menu_filter_destination_tasks, &ui_filters.destination_tasks);
+    ui_create_filter_menu (&ui_main_data.menu_filter_instances, &ui_filters.instances);
+}
+
 static void ui_destroy_filter_menu_item(GtkWidget *widget, gpointer data)
 {
     if (GTK_IS_MENU_ITEM(widget))
@@ -524,10 +530,7 @@ void ui_destroy_filter_menu(ui_filter_e filter)
 
 void ui_show_filter_menu(GtkWidget **menu, ui_filter_t *filter)
 {
-    if (*menu == NULL)
-    {
-        ui_create_filter_menu (menu, filter);
-    }
+    ui_create_filter_menu (menu, filter);
 
     gtk_menu_popup (GTK_MENU (*menu), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time ());
 }
diff --git a/common/utils/itti_analyzer/libui/ui_filters.h b/common/utils/itti_analyzer/libui/ui_filters.h
index 411d0411c2..5998de7b92 100644
--- a/common/utils/itti_analyzer/libui/ui_filters.h
+++ b/common/utils/itti_analyzer/libui/ui_filters.h
@@ -56,7 +56,7 @@ int ui_filters_read(const char *file_name);
 
 int ui_filters_file_write(const char *file_name);
 
-void ui_create_filter_menu(GtkWidget **menu, ui_filter_t *filter);
+void ui_create_filter_menus(void);
 
 void ui_destroy_filter_menus(void);
 
diff --git a/common/utils/itti_analyzer/libui/ui_tree_view.c b/common/utils/itti_analyzer/libui/ui_tree_view.c
index d3abb5d12e..026a49b04b 100644
--- a/common/utils/itti_analyzer/libui/ui_tree_view.c
+++ b/common/utils/itti_analyzer/libui/ui_tree_view.c
@@ -28,6 +28,9 @@ static ui_store_t ui_store;
 static GValue colors[] =
     { G_VALUE_INIT, G_VALUE_INIT };
 
+GtkWidget *ui_tree_view_menu;
+ui_tree_view_menu_enable_t ui_tree_view_menu_enable[NUM_MENU_TYPE];
+
 GdkEventButton *ui_tree_view_last_event;
 
 static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ui_store_t *store)
@@ -38,41 +41,23 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter,
     uint32_t destination_task_id;
     uint32_t instance;
 
-    gboolean enabled = FALSE;
+    gboolean enabled = TRUE;
 
-    gtk_tree_model_get (model, iter, COL_MSG_NUM, &msg_number, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID,
-                        &origin_task_id, COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE, &instance, -1);
-    if (msg_number != 0)
+    if (ui_filters.filters_enabled)
     {
-        enabled = ui_filters_message_enabled(message_id, origin_task_id, destination_task_id, instance);
-
-#if  0
-        if (store->filtered_last_msg < msg_number)
+        gtk_tree_model_get (model, iter, COL_MSG_NUM, &msg_number, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID,
+                            &origin_task_id, COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE, &instance, -1);
+        if (msg_number != 0)
         {
-            GtkTreePath *path = gtk_tree_model_get_path (model, iter);
-            GtkTreePath *true_path = gtk_tree_model_filter_convert_path_to_child_path (GTK_TREE_MODEL_FILTER (store->filtered), path);
-            g_message ("gtk_tree_model_get: %p %p", path, true_path);
-            GtkTreeIter iter_;
-            gtk_tree_model_get_iter (GTK_TREE_MODEL(store->store), &iter_, true_path);
-
-            GValue colors = G_VALUE_INIT;
-            g_value_init (&colors, G_TYPE_STRING);
-            g_value_set_string (&colors, (enabled ? "Black" : "Grey"));
-
-            // gtk_list_store_set_value (ui_store.store, &iter_, COL_FOREGROUND, &gvalue);
-            // gtk_list_store_set (ui_store.store, &iter_, COL_FOREGROUND, (enabled ? "Black" : "Grey"), -1);
-            // gtk_list_store_set_value (GTK_LIST_STORE(model), iter, COL_FOREGROUND, &colors);
-        }
-#endif
+            enabled = ui_filters_message_enabled(message_id, origin_task_id, destination_task_id, instance);
 
-        enabled |= (!ui_filters.filters_enabled);
-
-        if ((enabled) && (store->filtered_last_msg < msg_number))
-        {
-            store->filtered_last_msg = msg_number;
-            store->filtered_msg_number++;
+            if ((enabled) && (store->filtered_last_msg < msg_number))
+            {
+                store->filtered_last_msg = msg_number;
+                store->filtered_msg_number++;
+            }
+            g_debug("ui_tree_filter_messages: %p %p %d m:%d o:%d d:%d i:%d %d %d", model, iter, msg_number, message_id, origin_task_id, destination_task_id, instance, enabled, store->filtered_msg_number);
         }
-        g_debug("ui_tree_filter_messages: %p %p %d m:%d o:%d d:%d i:%d %d %d", model, iter, msg_number, message_id, origin_task_id, destination_task_id, instance, enabled, store->filtered_msg_number);
     }
 
     return enabled;
@@ -119,7 +104,7 @@ static void ui_tree_view_init_list(GtkWidget *list)
     gtk_tree_view_column_set_alignment (column, 0.5);
     gtk_tree_view_append_column (GTK_TREE_VIEW(list), column);
 
-    column = gtk_tree_view_column_new_with_attributes ("Signal", renderer_left, "text", COL_MESSAGE, "foreground", COL_FOREGROUND, NULL);
+    column = gtk_tree_view_column_new_with_attributes ("Message", renderer_left, "text", COL_MESSAGE, "foreground", COL_FOREGROUND, NULL);
     gtk_tree_view_column_set_resizable (column, TRUE);
     gtk_tree_view_column_set_alignment (column, 0.5);
     gtk_tree_view_append_column (GTK_TREE_VIEW(list), column);
@@ -257,6 +242,88 @@ static gboolean ui_tree_view_search(GtkTreeModel *model, gint column, const gcha
     return 1;
 }
 
+static void ui_tree_view_create_menu(GtkWidget **menu)
+{
+    GtkWidget *menu_items;
+
+    *menu = gtk_menu_new();
+
+    /* Create the "Message enable" menu-item */
+    {
+        /* Create a new menu-item */
+        menu_items = gtk_check_menu_item_new();
+        ui_tree_view_menu_enable[MENU_MESSAGE].menu_enable = menu_items;
+
+        /* Add it to the menu. */
+        gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items);
+        g_signal_connect(G_OBJECT(menu_items), "activate",
+                G_CALLBACK(ui_callback_on_menu_enable), &ui_tree_view_menu_enable[MENU_MESSAGE]);
+
+        /* Show the widget */
+        gtk_widget_show(menu_items);
+    }
+
+    /* Create the "Destination task enable" menu-item */
+    {
+        /* Create a new menu-item */
+        menu_items = gtk_check_menu_item_new();
+        ui_tree_view_menu_enable[MENU_FROM_TASK].menu_enable = menu_items;
+
+        /* Add it to the menu. */
+        gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items);
+        g_signal_connect(G_OBJECT(menu_items), "activate",
+                G_CALLBACK(ui_callback_on_menu_enable), &ui_tree_view_menu_enable[MENU_FROM_TASK]);
+
+        /* Show the widget */
+        gtk_widget_show(menu_items);
+    }
+
+    /* Create the "Origin task enable" menu-item */
+    {
+        /* Create a new menu-item */
+        menu_items = gtk_check_menu_item_new();
+        ui_tree_view_menu_enable[MENU_TO_TASK].menu_enable = menu_items;
+
+        /* Add it to the menu. */
+        gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items);
+        g_signal_connect(G_OBJECT(menu_items), "activate",
+                G_CALLBACK(ui_callback_on_menu_enable), &ui_tree_view_menu_enable[MENU_TO_TASK]);
+
+        /* Show the widget */
+        gtk_widget_show(menu_items);
+    }
+
+    /* Create the "Instance enable" menu-item */
+    {
+        /* Create a new menu-item */
+        menu_items = gtk_check_menu_item_new();
+        ui_tree_view_menu_enable[MENU_INSTANCE].menu_enable = menu_items;
+
+        /* Add it to the menu. */
+        gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items);
+        g_signal_connect(G_OBJECT(menu_items), "activate",
+                G_CALLBACK(ui_callback_on_menu_enable), &ui_tree_view_menu_enable[MENU_INSTANCE]);
+
+        /* Show the widget */
+        gtk_widget_show(menu_items);
+    }
+
+    /* Create the "Color" menu-item */
+    if (0)
+    {
+        /* Create a new menu-item with a name */
+        menu_items = gtk_menu_item_new_with_label("Select color");
+
+        /* Add it to the menu. */
+        gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items);
+        g_signal_connect(G_OBJECT(menu_items), "activate",
+                G_CALLBACK(ui_callback_on_menu_color), *menu);
+
+        /* Show the widget */
+        gtk_widget_show(menu_items);
+    }
+}
+
 int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
 {
     GtkWidget *hbox;
@@ -266,7 +333,7 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
     g_value_init (&colors[0], G_TYPE_STRING);
     g_value_init (&colors[1], G_TYPE_STRING);
     g_value_set_string (&colors[0], "Grey");
-    g_value_set_string (&colors[1], "Black");
+    g_value_set_string (&colors[1], "#585858");
 
     scrolled_window = gtk_scrolled_window_new (NULL, NULL);
 
@@ -289,7 +356,7 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
     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_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW(scrolled_window), 670);
     gtk_paned_pack1 (GTK_PANED (hbox), scrolled_window, FALSE, TRUE);
     ui_main_data.text_view = ui_signal_dissect_new (hbox);
 
@@ -307,6 +374,8 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
 
     ui_main_data.selection = selection;
 
+    ui_tree_view_create_menu (&ui_tree_view_menu);
+
     return 0;
 }
 
@@ -374,7 +443,7 @@ static gboolean updateForegroundColor (GtkTreeModel *model, GtkTreePath *path, G
     return FALSE;
 }
 
-void ui_tree_view_refilter(void)
+void ui_tree_view_refilter()
 {
     ui_store.filtered_last_msg = 0;
     ui_store.filtered_msg_number = 0;
@@ -382,7 +451,7 @@ void ui_tree_view_refilter(void)
     /* Update foreground color of messages, this will also update filtered model */
     if (ui_store.store != NULL)
     {
-        gtk_tree_model_foreach(GTK_TREE_MODEL(ui_store.store), updateForegroundColor, NULL);
+        gtk_tree_model_foreach (GTK_TREE_MODEL(ui_store.store), updateForegroundColor, NULL);
     }
 
     g_debug("ui_tree_view_refilter: last message %d, %d messages displayed", ui_store.filtered_last_msg, ui_store.filtered_msg_number);
diff --git a/common/utils/itti_analyzer/libui/ui_tree_view.h b/common/utils/itti_analyzer/libui/ui_tree_view.h
index fd736857ec..286a6aa5eb 100644
--- a/common/utils/itti_analyzer/libui/ui_tree_view.h
+++ b/common/utils/itti_analyzer/libui/ui_tree_view.h
@@ -1,7 +1,7 @@
 #ifndef UI_TREE_VIEW_H_
 #define UI_TREE_VIEW_H_
 
-typedef enum
+typedef enum col_type_e
 {
     COL_MSG_NUM = 0,
     COL_LTE_TIME,
@@ -17,7 +17,25 @@ typedef enum
 
     COL_BUFFER,
     NUM_COLS
-} col_type_e;
+} col_type_t;
+
+typedef enum ui_tree_view_menu_type_e
+{
+    MENU_MESSAGE = 0,
+    MENU_FROM_TASK,
+    MENU_TO_TASK,
+    MENU_INSTANCE,
+    NUM_MENU_TYPE,
+} ui_tree_view_menu_type_t;
+
+typedef struct ui_tree_view_menu_enable_s
+{
+    GtkWidget *menu_enable;
+    GtkWidget *menu_item;
+} ui_tree_view_menu_enable_t;
+
+extern GtkWidget *ui_tree_view_menu;
+extern ui_tree_view_menu_enable_t ui_tree_view_menu_enable[NUM_MENU_TYPE];
 
 extern GdkEventButton *ui_tree_view_last_event;
 
-- 
GitLab