Commit 1947e4c4 authored by winckel's avatar winckel

Added a foreground change for disabled messages when filtering is disabled.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4471 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent cd05a7a7
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#include "locate_root.h" #include "locate_root.h"
#include "xml_parse.h" #include "xml_parse.h"
static gboolean refresh_message_list = TRUE;
static gboolean filters_changed = FALSE;
gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data) gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data)
{ {
gboolean refresh = (data != NULL) ? TRUE : FALSE; gboolean refresh = (data != NULL) ? TRUE : FALSE;
...@@ -57,7 +60,7 @@ gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data) ...@@ -57,7 +60,7 @@ gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data)
enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(button)); enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(button));
g_message("Filters enabled event occurred %d", enabled); g_debug("Filters enabled event occurred %d", enabled);
changed = ui_filters_enable (enabled); changed = ui_filters_enable (enabled);
...@@ -533,9 +536,17 @@ gboolean ui_callback_on_menu_none(GtkWidget *widget, gpointer data) ...@@ -533,9 +536,17 @@ gboolean ui_callback_on_menu_none(GtkWidget *widget, gpointer data)
{ {
GtkWidget *menu = (GtkWidget *) data; GtkWidget *menu = (GtkWidget *) data;
g_message("ui_callback_on_menu_none occurred %lx %lx)", (long) widget, (long) data); g_debug("ui_callback_on_menu_none occurred %lx %lx)", (long) widget, (long) data);
refresh_message_list = FALSE;
gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) FALSE); gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) FALSE);
refresh_message_list = TRUE;
if (filters_changed);
{
ui_tree_view_refilter();
filters_changed = FALSE;
}
return TRUE; return TRUE;
} }
...@@ -544,9 +555,17 @@ gboolean ui_callback_on_menu_all(GtkWidget *widget, gpointer data) ...@@ -544,9 +555,17 @@ gboolean ui_callback_on_menu_all(GtkWidget *widget, gpointer data)
{ {
GtkWidget *menu = (GtkWidget *) data; GtkWidget *menu = (GtkWidget *) data;
g_message("ui_callback_on_menu_all occurred %lx %lx)", (long) widget, (long) data); g_debug("ui_callback_on_menu_all occurred %lx %lx)", (long) widget, (long) data);
refresh_message_list = FALSE;
gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) TRUE); gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) TRUE);
refresh_message_list = TRUE;
if (filters_changed);
{
ui_tree_view_refilter();
filters_changed = FALSE;
}
return TRUE; return TRUE;
} }
...@@ -560,7 +579,14 @@ gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer data) ...@@ -560,7 +579,14 @@ gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer data)
if (filter_entry->enabled != enabled) if (filter_entry->enabled != enabled)
{ {
filter_entry->enabled = enabled; filter_entry->enabled = enabled;
ui_tree_view_refilter (); if (refresh_message_list)
{
ui_tree_view_refilter();
}
else
{
filters_changed = TRUE;
}
} }
g_debug("ui_callback_on_menu_item_selected occurred %p %p %s %d (%d messages to display)", widget, data, filter_entry->name, enabled, ui_tree_view_get_filtered_number()); g_debug("ui_callback_on_menu_item_selected occurred %p %p %s %d (%d messages to display)", widget, data, filter_entry->name, enabled, ui_tree_view_get_filtered_number());
...@@ -571,7 +597,7 @@ gboolean ui_callback_on_tree_column_header_click(GtkWidget *widget, gpointer dat ...@@ -571,7 +597,7 @@ gboolean ui_callback_on_tree_column_header_click(GtkWidget *widget, gpointer dat
{ {
col_type_e col = (col_type_e) data; col_type_e col = (col_type_e) data;
g_message("ui_callback_on_tree_column_header_click %d", col); g_debug("ui_callback_on_tree_column_header_click %d", col);
switch (col) switch (col)
{ {
case COL_MESSAGE: case COL_MESSAGE:
......
...@@ -204,11 +204,9 @@ gboolean ui_filters_message_enabled(const uint32_t message, const uint32_t origi ...@@ -204,11 +204,9 @@ gboolean ui_filters_message_enabled(const uint32_t message, const uint32_t origi
{ {
gboolean result; gboolean result;
result = (!ui_filters.filters_enabled) result = (ui_item_enabled(&ui_filters.messages, message) && ui_item_enabled(&ui_filters.origin_tasks, origin_task)
|| (ui_item_enabled(&ui_filters.messages, message) && ui_item_enabled(&ui_filters.destination_tasks, destination_task)
&& ui_item_enabled(&ui_filters.origin_tasks, origin_task) && ui_item_enabled(&ui_filters.instances, instance));
&& ui_item_enabled(&ui_filters.destination_tasks, destination_task)
&& ui_item_enabled(&ui_filters.instances, instance));
return result; return result;
} }
......
...@@ -25,6 +25,9 @@ typedef struct ...@@ -25,6 +25,9 @@ typedef struct
static ui_store_t ui_store; static ui_store_t ui_store;
static GValue colors[] =
{ G_VALUE_INIT, G_VALUE_INIT };
GdkEventButton *ui_tree_view_last_event; GdkEventButton *ui_tree_view_last_event;
static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ui_store_t *store) static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ui_store_t *store)
...@@ -41,14 +44,35 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ...@@ -41,14 +44,35 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter,
&origin_task_id, COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE, &instance, -1); &origin_task_id, COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE, &instance, -1);
if (msg_number != 0) if (msg_number != 0)
{ {
enabled = ui_filters_message_enabled (message_id, origin_task_id, destination_task_id, instance); enabled = ui_filters_message_enabled(message_id, origin_task_id, destination_task_id, instance);
#if 0
if (store->filtered_last_msg < msg_number)
{
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.filters_enabled);
if ((enabled) && (ui_store.filtered_last_msg < msg_number)) if ((enabled) && (store->filtered_last_msg < msg_number))
{ {
ui_store.filtered_last_msg = msg_number; store->filtered_last_msg = msg_number;
ui_store.filtered_msg_number++; store->filtered_msg_number++;
} }
g_debug("%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, ui_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; return enabled;
...@@ -85,7 +109,7 @@ static void ui_tree_view_init_list(GtkWidget *list) ...@@ -85,7 +109,7 @@ static void ui_tree_view_init_list(GtkWidget *list)
gtk_cell_renderer_set_alignment (renderer_right, 1, 0.5); gtk_cell_renderer_set_alignment (renderer_right, 1, 0.5);
gtk_cell_renderer_set_padding (renderer_right, 5, 0); gtk_cell_renderer_set_padding (renderer_right, 5, 0);
column = gtk_tree_view_column_new_with_attributes ("MN", renderer_right, "text", COL_MSG_NUM, NULL); column = gtk_tree_view_column_new_with_attributes ("MN", renderer_right, "text", COL_MSG_NUM, "foreground", COL_FOREGROUND, NULL);
gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_column_set_alignment (column, 0.5); gtk_tree_view_column_set_alignment (column, 0.5);
gtk_tree_view_append_column (GTK_TREE_VIEW(list), column); gtk_tree_view_append_column (GTK_TREE_VIEW(list), column);
...@@ -95,7 +119,7 @@ static void ui_tree_view_init_list(GtkWidget *list) ...@@ -95,7 +119,7 @@ static void ui_tree_view_init_list(GtkWidget *list)
gtk_tree_view_column_set_alignment (column, 0.5); gtk_tree_view_column_set_alignment (column, 0.5);
gtk_tree_view_append_column (GTK_TREE_VIEW(list), column); gtk_tree_view_append_column (GTK_TREE_VIEW(list), column);
column = gtk_tree_view_column_new_with_attributes ("Signal", renderer_left, "text", COL_MESSAGE, NULL); column = gtk_tree_view_column_new_with_attributes ("Signal", renderer_left, "text", COL_MESSAGE, "foreground", COL_FOREGROUND, NULL);
gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_column_set_alignment (column, 0.5); gtk_tree_view_column_set_alignment (column, 0.5);
gtk_tree_view_append_column (GTK_TREE_VIEW(list), column); gtk_tree_view_append_column (GTK_TREE_VIEW(list), column);
...@@ -135,6 +159,7 @@ static void ui_tree_view_init_list(GtkWidget *list) ...@@ -135,6 +159,7 @@ static void ui_tree_view_init_list(GtkWidget *list)
G_TYPE_UINT, // COL_MESSAGE_ID G_TYPE_UINT, // COL_MESSAGE_ID
G_TYPE_UINT, // COL_FROM_TASK_ID G_TYPE_UINT, // COL_FROM_TASK_ID
G_TYPE_UINT, // COL_TO_TASK_ID G_TYPE_UINT, // COL_TO_TASK_ID
G_TYPE_STRING, // COL_FOREGROUND
// Reference to the buffer here to avoid maintaining multiple lists. // Reference to the buffer here to avoid maintaining multiple lists.
G_TYPE_POINTER); G_TYPE_POINTER);
...@@ -158,6 +183,9 @@ static void ui_tree_view_add_to_list(GtkWidget *list, const gchar *lte_time, con ...@@ -158,6 +183,9 @@ static void ui_tree_view_add_to_list(GtkWidget *list, const gchar *lte_time, con
const char *destination_task, uint32_t instance, gpointer buffer) const char *destination_task, uint32_t instance, gpointer buffer)
{ {
GtkTreeIter iter; GtkTreeIter iter;
gboolean enabled;
enabled = ui_filters_message_enabled(message_id, origin_task_id, destination_task_id, instance);
gtk_list_store_append (ui_store.store, &iter); gtk_list_store_append (ui_store.store, &iter);
gtk_list_store_set (ui_store.store, &iter, gtk_list_store_set (ui_store.store, &iter,
...@@ -174,6 +202,7 @@ static void ui_tree_view_add_to_list(GtkWidget *list, const gchar *lte_time, con ...@@ -174,6 +202,7 @@ static void ui_tree_view_add_to_list(GtkWidget *list, const gchar *lte_time, con
COL_BUFFER , buffer, COL_BUFFER , buffer,
/* End of columns */ /* End of columns */
-1); -1);
gtk_list_store_set_value (ui_store.store, &iter, COL_FOREGROUND, &colors[enabled ? 1 : 0]);
} }
void ui_tree_view_destroy_list(GtkWidget *list) void ui_tree_view_destroy_list(GtkWidget *list)
...@@ -234,6 +263,11 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) ...@@ -234,6 +263,11 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
GtkTreeSelection *selection; GtkTreeSelection *selection;
GtkWidget *scrolled_window; GtkWidget *scrolled_window;
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");
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
...@@ -322,14 +356,36 @@ void ui_tree_view_select_row(gint row) ...@@ -322,14 +356,36 @@ void ui_tree_view_select_row(gint row)
} }
} }
static gboolean updateForegroundColor (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
{
uint32_t message_id;
uint32_t origin_task_id;
uint32_t destination_task_id;
uint32_t instance;
gboolean enabled = FALSE;
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, -1);
enabled = ui_filters_message_enabled(message_id, origin_task_id, destination_task_id, instance);
gtk_list_store_set_value (GTK_LIST_STORE(model), iter, COL_FOREGROUND, &colors[enabled ? 1 : 0]);
return FALSE;
}
void ui_tree_view_refilter(void) void ui_tree_view_refilter(void)
{ {
ui_store.filtered_last_msg = 0; ui_store.filtered_last_msg = 0;
ui_store.filtered_msg_number = 0; ui_store.filtered_msg_number = 0;
if (ui_store.filtered != NULL)
/* Update foreground color of messages, this will also update filtered model */
if (ui_store.store != NULL)
{ {
gtk_tree_model_filter_refilter (ui_store.filtered); 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);
} }
guint ui_tree_view_get_filtered_number(void) guint ui_tree_view_get_filtered_number(void)
......
...@@ -13,6 +13,7 @@ typedef enum ...@@ -13,6 +13,7 @@ typedef enum
COL_MESSAGE_ID, COL_MESSAGE_ID,
COL_FROM_TASK_ID, COL_FROM_TASK_ID,
COL_TO_TASK_ID, COL_TO_TASK_ID,
COL_FOREGROUND,
COL_BUFFER, COL_BUFFER,
NUM_COLS NUM_COLS
......
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