Commit 57dea23f authored by winckel's avatar winckel

Added messages background color selector.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4486 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 6e82ddd5
......@@ -187,7 +187,7 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
/* 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;
ui_tree_view_menu_enable[MENU_MESSAGE].filter_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 (
......@@ -198,14 +198,13 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
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;
ui_tree_view_menu_enable[MENU_MESSAGE].filter_item = &ui_filters.messages.items[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;
ui_tree_view_menu_enable[MENU_FROM_TASK].filter_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 (
......@@ -216,14 +215,13 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
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;
ui_tree_view_menu_enable[MENU_FROM_TASK].filter_item = &ui_filters.origin_tasks.items[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;
ui_tree_view_menu_enable[MENU_TO_TASK].filter_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 (
......@@ -235,14 +233,14 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
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;
ui_tree_view_menu_enable[MENU_TO_TASK].filter_item =
&ui_filters.destination_tasks.items[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;
ui_tree_view_menu_enable[MENU_INSTANCE].filter_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 (
......@@ -253,8 +251,7 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
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;
ui_tree_view_menu_enable[MENU_INSTANCE].filter_item = &ui_filters.instances.items[item];
}
gtk_menu_popup (GTK_MENU (ui_tree_view_menu), NULL, NULL, NULL, NULL, 0,
......@@ -319,11 +316,11 @@ 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)
if (menu_enable->filter_item != NULL)
{
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_enable->menu_item),
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_enable->filter_item->menu_item),
gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(menu_enable->menu_enable)));
menu_enable->menu_item = NULL;
menu_enable->filter_item = NULL;
}
return TRUE;
......@@ -331,19 +328,29 @@ gboolean ui_callback_on_menu_enable(GtkWidget *widget, gpointer data)
gboolean ui_callback_on_menu_color(GtkWidget *widget, gpointer data)
{
ui_tree_view_menu_enable_t *menu_enable = data;
GdkRGBA color;
GtkWidget *color_chooser;
gint response;
color_chooser = gtk_color_chooser_dialog_new ("Select color", GTK_WINDOW(ui_main_data.window));
color_chooser = gtk_color_chooser_dialog_new ("Select message background 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)
{
int red, green, blue;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER(color_chooser), &color);
g_message("Selected color %f %f %f", color.red, color.green, color.blue);
red = (int) (color.red * 255);
green = (int) (color.green * 255);
blue = (int) (color.blue * 255);
g_debug("Selected color for %s %f->%02x %f->%02x %f->%02x", menu_enable->filter_item->name, color.red, red, color.green, green, color.blue, blue);
snprintf (menu_enable->filter_item->background, BACKGROUND_SIZE, "#%02x%02x%02x", red, green, blue);
ui_tree_view_refilter ();
}
gtk_widget_destroy (color_chooser);
......
......@@ -14,6 +14,7 @@
const uint32_t FILTER_ALLOC_NUMBER = 100;
const uint32_t FILTER_ID_UNDEFINED = ~0;
const char * const COLOR_WHITE = "#ffffff";
ui_filters_t ui_filters;
......@@ -125,7 +126,8 @@ static void ui_filter_set_enabled(uint8_t *enabled, ui_entry_enabled_e entry_ena
}
}
static int ui_filter_add(ui_filter_t *filter, uint32_t value, const char *name, ui_entry_enabled_e entry_enabled)
static int ui_filter_add(ui_filter_t *filter, uint32_t value, const char *name, ui_entry_enabled_e entry_enabled,
const char *background)
{
int item = ui_filters_search_name (filter, name);
......@@ -145,12 +147,17 @@ static int ui_filter_add(ui_filter_t *filter, uint32_t value, const char *name,
/* New entry */
strncpy (filter->items[item].name, name, SIGNAL_NAME_LENGTH);
ui_filter_set_enabled (&filter->items[item].enabled, entry_enabled, TRUE);
strncpy (filter->items[item].background, background != NULL ? background : COLOR_WHITE, BACKGROUND_SIZE);
filter->used++;
}
else
{
ui_filter_set_enabled (&filter->items[item].enabled, entry_enabled, FALSE);
if (background != NULL)
{
strncpy (filter->items[item].background, background, BACKGROUND_SIZE);
}
}
g_debug("filter \"%s\" add %d \"%s\" %d", filter->name, value, name, entry_enabled);
......@@ -158,24 +165,25 @@ static int ui_filter_add(ui_filter_t *filter, uint32_t value, const char *name,
return (item);
}
void ui_filters_add(ui_filter_e filter, uint32_t value, const char *name, ui_entry_enabled_e entry_enabled)
void ui_filters_add(ui_filter_e filter, uint32_t value, const char *name, ui_entry_enabled_e entry_enabled,
const char *background)
{
switch (filter)
{
case FILTER_MESSAGES:
ui_filter_add (&ui_filters.messages, value, name, entry_enabled);
ui_filter_add (&ui_filters.messages, value, name, entry_enabled, background);
break;
case FILTER_ORIGIN_TASKS:
ui_filter_add (&ui_filters.origin_tasks, value, name, entry_enabled);
ui_filter_add (&ui_filters.origin_tasks, value, name, entry_enabled, background);
break;
case FILTER_DESTINATION_TASKS:
ui_filter_add (&ui_filters.destination_tasks, value, name, entry_enabled);
ui_filter_add (&ui_filters.destination_tasks, value, name, entry_enabled, background);
break;
case FILTER_INSTANCES:
ui_filter_add (&ui_filters.instances, value, name, entry_enabled);
ui_filter_add (&ui_filters.instances, value, name, entry_enabled, background);
break;
default:
......@@ -200,13 +208,14 @@ static gboolean ui_item_enabled(ui_filter_t *filter, const uint32_t value)
return (FALSE);
}
gboolean ui_filters_message_enabled(const uint32_t message, const uint32_t origin_task, const uint32_t destination_task, const uint32_t instance)
gboolean ui_filters_message_enabled(const uint32_t message, const uint32_t origin_task, const uint32_t destination_task,
const uint32_t instance)
{
gboolean result;
result = (ui_item_enabled(&ui_filters.messages, message) && ui_item_enabled(&ui_filters.origin_tasks, origin_task)
&& ui_item_enabled(&ui_filters.destination_tasks, destination_task)
&& ui_item_enabled(&ui_filters.instances, instance));
result = (ui_item_enabled (&ui_filters.messages, message) && ui_item_enabled (&ui_filters.origin_tasks, origin_task)
&& ui_item_enabled (&ui_filters.destination_tasks, destination_task)
&& ui_item_enabled (&ui_filters.instances, instance));
return result;
}
......@@ -264,7 +273,7 @@ static int xml_parse_filters(xmlDocPtr doc)
if (filter_node != NULL)
{
filter = ui_filter_from_name ((const char*) filter_node->name);
g_debug ("Found filter %s %d", filter_node->name, filter);
g_debug("Found filter %s %d", filter_node->name, filter);
if (filter == FILTER_UNKNOWN)
{
......@@ -282,13 +291,21 @@ static int xml_parse_filters(xmlDocPtr doc)
if (cur_node != NULL)
{
char *background = NULL;
if (cur_node->properties->next != NULL)
{
background = (char *) cur_node->properties->next->children->content;
}
g_debug(" Found entry %s %s", cur_node->name, cur_node->properties->children->content);
ui_filters_add (
filter,
FILTER_ID_UNDEFINED,
(const char*) cur_node->name,
cur_node->properties->children->content[0] == '0' ?
ENTRY_ENABLED_FALSE : ENTRY_ENABLED_TRUE);
ENTRY_ENABLED_FALSE : ENTRY_ENABLED_TRUE,
background);
filters_entries++;
cur_node = cur_node->next;
......@@ -315,7 +332,8 @@ static int xml_parse_filters(xmlDocPtr doc)
ret = RC_OK;
}
g_message("Parsed XML filters definition found %d entries (%d messages to display)", filters_entries, ui_tree_view_get_filtered_number());
g_message(
"Parsed XML filters definition found %d entries (%d messages to display)", filters_entries, ui_tree_view_get_filtered_number());
return ret;
}
......@@ -356,8 +374,8 @@ static void write_filter(FILE *filter_file, ui_filter_t *filter)
fprintf (filter_file, " <%s>\n", filter->name);
for (item = 0; item < filter->used; item++)
{
fprintf (filter_file, " <%s enabled=\"%d\"/>\n", filter->items[item].name,
filter->items[item].enabled ? 1 : 0);
fprintf (filter_file, " <%s enabled=\"%d\" background_color=\"%s\"/>\n", filter->items[item].name,
filter->items[item].enabled ? 1 : 0, filter->items[item].background);
}
fprintf (filter_file, " </%s>\n", filter->name);
}
......@@ -479,7 +497,7 @@ static void ui_destroy_filter_menu_item(GtkWidget *widget, gpointer data)
{
if (GTK_IS_MENU_ITEM(widget))
{
gtk_widget_destroy(widget);
gtk_widget_destroy (widget);
}
}
......@@ -487,9 +505,9 @@ static void ui_destroy_filter_menu_widget(GtkWidget **menu)
{
if (*menu != NULL)
{
gtk_container_foreach(GTK_CONTAINER(*menu), ui_destroy_filter_menu_item, NULL);
gtk_container_foreach (GTK_CONTAINER(*menu), ui_destroy_filter_menu_item, NULL);
gtk_widget_destroy(*menu);
gtk_widget_destroy (*menu);
*menu = NULL;
}
}
......
......@@ -5,6 +5,8 @@
#include "itti_types.h"
#define BACKGROUND_SIZE 10
typedef enum
{
FILTER_UNKNOWN, FILTER_MESSAGES, FILTER_ORIGIN_TASKS, FILTER_DESTINATION_TASKS, FILTER_INSTANCES,
......@@ -20,6 +22,7 @@ typedef struct
uint32_t id;
char name[SIGNAL_NAME_LENGTH];
uint8_t enabled;
char background[BACKGROUND_SIZE];
GtkWidget *menu_item;
} ui_filter_item_t;
......@@ -48,9 +51,11 @@ gboolean ui_filters_enable(gboolean enabled);
int ui_filters_search_id(ui_filter_t *filter, uint32_t value);
void ui_filters_add(ui_filter_e filter, uint32_t value, const char *name, ui_entry_enabled_e entry_enabled);
void ui_filters_add(ui_filter_e filter, uint32_t value, const char *name, ui_entry_enabled_e entry_enabled,
const char *background);
gboolean ui_filters_message_enabled(const uint32_t message, const uint32_t origin_task, const uint32_t destination_task, const uint32_t instance);
gboolean ui_filters_message_enabled(const uint32_t message, const uint32_t origin_task, const uint32_t destination_task,
const uint32_t instance);
int ui_filters_read(const char *file_name);
......
......@@ -26,7 +26,7 @@ typedef struct
static ui_store_t ui_store;
static GValue colors[] =
{ G_VALUE_INIT, G_VALUE_INIT };
{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];
......@@ -49,7 +49,7 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter,
&origin_task_id, COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE, &instance, -1);
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 ((enabled) && (store->filtered_last_msg < msg_number))
{
......@@ -94,7 +94,8 @@ static void ui_tree_view_init_list(GtkWidget *list)
gtk_cell_renderer_set_alignment (renderer_right, 1, 0.5);
gtk_cell_renderer_set_padding (renderer_right, 5, 0);
column = gtk_tree_view_column_new_with_attributes ("MN", renderer_right, "text", COL_MSG_NUM, "foreground", COL_FOREGROUND, NULL);
column = gtk_tree_view_column_new_with_attributes ("MN", renderer_right, "text", COL_MSG_NUM, "foreground",
COL_FOREGROUND, "background", COL_BACKGROUND, 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);
......@@ -104,7 +105,8 @@ 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 ("Message", 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, "background", COL_BACKGROUND, 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);
......@@ -145,6 +147,7 @@ static void ui_tree_view_init_list(GtkWidget *list)
G_TYPE_UINT, // COL_FROM_TASK_ID
G_TYPE_UINT, // COL_TO_TASK_ID
G_TYPE_STRING, // COL_FOREGROUND
G_TYPE_STRING, // COL_BACKGROUND
// Reference to the buffer here to avoid maintaining multiple lists.
G_TYPE_POINTER);
......@@ -170,21 +173,17 @@ static void ui_tree_view_add_to_list(GtkWidget *list, const gchar *lte_time, con
GtkTreeIter iter;
gboolean enabled;
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);
gtk_list_store_append (ui_store.store, &iter);
gtk_list_store_set (ui_store.store, &iter,
/* Columns */
COL_MSG_NUM , message_number,
COL_LTE_TIME , lte_time,
COL_MESSAGE , signal_name,
COL_FROM_TASK , origin_task,
COL_TO_TASK , destination_task,
COL_INSTANCE , instance,
COL_MESSAGE_ID , message_id,
COL_FROM_TASK_ID , origin_task_id,
COL_TO_TASK_ID , destination_task_id,
COL_BUFFER , buffer,
COL_MSG_NUM,
message_number, COL_LTE_TIME, lte_time, COL_MESSAGE, signal_name, COL_FROM_TASK, origin_task,
COL_TO_TASK, destination_task, COL_INSTANCE, instance, COL_MESSAGE_ID, message_id,
COL_FROM_TASK_ID, origin_task_id, COL_TO_TASK_ID, destination_task_id, COL_BUFFER, buffer,
COL_BACKGROUND,
ui_filters.messages.items[ui_filters_search_id (&ui_filters.messages, message_id)].background,
/* End of columns */
-1);
gtk_list_store_set_value (ui_store.store, &iter, COL_FOREGROUND, &colors[enabled ? 1 : 0]);
......@@ -246,81 +245,80 @@ static void ui_tree_view_create_menu(GtkWidget **menu)
{
GtkWidget *menu_items;
*menu = gtk_menu_new();
*menu = gtk_menu_new ();
/* Create the "Message enable" menu-item */
{
/* Create a new menu-item */
menu_items = gtk_check_menu_item_new();
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]);
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);
gtk_widget_show (menu_items);
}
/* Create the "Destination task enable" menu-item */
{
/* Create a new menu-item */
menu_items = gtk_check_menu_item_new();
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]);
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);
gtk_widget_show (menu_items);
}
/* Create the "Origin task enable" menu-item */
{
/* Create a new menu-item */
menu_items = gtk_check_menu_item_new();
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]);
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);
gtk_widget_show (menu_items);
}
/* Create the "Instance enable" menu-item */
{
/* Create a new menu-item */
menu_items = gtk_check_menu_item_new();
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]);
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);
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");
menu_items = gtk_menu_item_new_with_label ("Select message background 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);
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),
&ui_tree_view_menu_enable[MENU_MESSAGE]);
/* Show the widget */
gtk_widget_show(menu_items);
gtk_widget_show (menu_items);
}
}
......@@ -392,7 +390,7 @@ int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_
for (i = ui_store.instance_number; i <= instance; i++)
{
sprintf (name, "%d", i);
ui_filters_add (FILTER_INSTANCES, i, name, ENTRY_ENABLED_TRUE);
ui_filters_add (FILTER_INSTANCES, i, name, ENTRY_ENABLED_TRUE, NULL);
}
ui_store.instance_number = (instance + 1);
ui_destroy_filter_menu (FILTER_INSTANCES);
......@@ -425,7 +423,7 @@ void ui_tree_view_select_row(gint row)
}
}
static gboolean updateForegroundColor (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
static gboolean updateColors(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
{
uint32_t message_id;
uint32_t origin_task_id;
......@@ -434,11 +432,14 @@ static gboolean updateForegroundColor (GtkTreeModel *model, GtkTreePath *path, G
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_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]);
gtk_list_store_set (GTK_LIST_STORE(model), iter, COL_FOREGROUND, g_value_get_string (&colors[enabled ? 1 : 0]),
COL_BACKGROUND,
ui_filters.messages.items[ui_filters_search_id (&ui_filters.messages, message_id)].background,
-1);
return FALSE;
}
......@@ -451,7 +452,7 @@ void ui_tree_view_refilter()
/* 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), updateColors, NULL);
}
g_debug("ui_tree_view_refilter: last message %d, %d messages displayed", ui_store.filtered_last_msg, ui_store.filtered_msg_number);
......
#ifndef UI_TREE_VIEW_H_
#define UI_TREE_VIEW_H_
#include "ui_filters.h"
typedef enum col_type_e
{
COL_MSG_NUM = 0,
......@@ -14,6 +16,7 @@ typedef enum col_type_e
COL_FROM_TASK_ID,
COL_TO_TASK_ID,
COL_FOREGROUND,
COL_BACKGROUND,
COL_BUFFER,
NUM_COLS
......@@ -31,7 +34,7 @@ typedef enum ui_tree_view_menu_type_e
typedef struct ui_tree_view_menu_enable_s
{
GtkWidget *menu_enable;
GtkWidget *menu_item;
ui_filter_item_t *filter_item;
} ui_tree_view_menu_enable_t;
extern GtkWidget *ui_tree_view_menu;
......
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