Commit 6e82ddd5 authored by winckel's avatar winckel

Replaced right-click on messageselect handler by a popup menu that control...

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
parent 0d5e035e
...@@ -147,14 +147,16 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -147,14 +147,16 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
if (gtk_tree_model_get_iter (model, &iter, path)) if (gtk_tree_model_get_iter (model, &iter, path))
{ {
GValue buffer_store = G_VALUE_INIT;
gpointer buffer; gpointer buffer;
GValue message_id_store = G_VALUE_INIT; uint32_t message_id;
guint 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); gtk_tree_model_get (model, &iter, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID, &origin_task_id,
buffer = g_value_get_pointer (&buffer_store); COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE, &instance, COL_BUFFER, &buffer, -1);
g_debug(" Get iter %p %p", buffer_current, buffer); g_debug(" Get iter %p %p", buffer_current, buffer);
...@@ -175,22 +177,88 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -175,22 +177,88 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
/* Clear event */ /* Clear event */
ui_tree_view_last_event = NULL; 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) 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); g_debug("Message selected right click %d %d %d %d", message_id, origin_task_id, destination_task_id, instance);
/* 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_set_active (
GTK_CHECK_MENU_ITEM(ui_filters.messages.items[item].menu_item), GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_FROM_TASK].menu_enable),
!gtk_check_menu_item_get_active ( ui_filters.origin_tasks.items[item].enabled);
GTK_CHECK_MENU_ITEM(ui_filters.messages.items[item].menu_item))); /* Set menu item label */
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))); 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;
}
return FALSE; 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 ...@@ -202,9 +270,6 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
{ {
buffer_current = buffer; 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 */ /* Clear the view */
CHECK_FCT_DO(ui_signal_dissect_clear_view(text_view), return FALSE); 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 ...@@ -250,6 +315,41 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
return TRUE; 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) void ui_signal_add_to_list(gpointer data, gpointer user_data)
{ {
gboolean goto_last = user_data ? TRUE : FALSE; gboolean goto_last = user_data ? TRUE : FALSE;
...@@ -542,9 +642,9 @@ gboolean ui_callback_on_menu_none(GtkWidget *widget, gpointer data) ...@@ -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); gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) FALSE);
refresh_message_list = TRUE; refresh_message_list = TRUE;
if (filters_changed); if (filters_changed)
{ {
ui_tree_view_refilter(); ui_tree_view_refilter ();
filters_changed = FALSE; filters_changed = FALSE;
} }
...@@ -561,9 +661,9 @@ gboolean ui_callback_on_menu_all(GtkWidget *widget, gpointer data) ...@@ -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); gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) TRUE);
refresh_message_list = TRUE; refresh_message_list = TRUE;
if (filters_changed); if (filters_changed)
{ {
ui_tree_view_refilter(); ui_tree_view_refilter ();
filters_changed = FALSE; filters_changed = FALSE;
} }
...@@ -581,7 +681,7 @@ gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer data) ...@@ -581,7 +681,7 @@ gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer data)
filter_entry->enabled = enabled; filter_entry->enabled = enabled;
if (refresh_message_list) if (refresh_message_list)
{ {
ui_tree_view_refilter(); ui_tree_view_refilter ();
} }
else else
{ {
...@@ -595,7 +695,7 @@ gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer data) ...@@ -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) 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); g_debug("ui_callback_on_tree_column_header_click %d", col);
switch (col) switch (col)
......
...@@ -37,13 +37,16 @@ gboolean ui_callback_on_tree_view_select(GtkWidget *widget, ...@@ -37,13 +37,16 @@ gboolean ui_callback_on_tree_view_select(GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
gpointer data); gpointer data);
gboolean gboolean ui_callback_on_select_signal(GtkTreeSelection *selection,
ui_callback_on_select_signal(GtkTreeSelection *selection,
GtkTreeModel *model, GtkTreeModel *model,
GtkTreePath *path, GtkTreePath *path,
gboolean path_currently_selected, gboolean path_currently_selected,
gpointer userdata); 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, gboolean ui_callback_signal_go_to_first(GtkWidget *widget,
gpointer data); gpointer data);
......
...@@ -392,83 +392,89 @@ int ui_filters_file_write(const char *file_name) ...@@ -392,83 +392,89 @@ int ui_filters_file_write(const char *file_name)
return RC_OK; 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)
{ {
if (*menu == NULL)
{
GtkWidget *menu_items; GtkWidget *menu_items;
int item; int item;
gpointer data; gpointer data;
*menu = gtk_menu_new(); *menu = gtk_menu_new ();
/* Create the "NONE" menu-item */ /* Create the "NONE" menu-item */
{ {
/* Create a new menu-item with a name */ /* Create a new menu-item with a name */
menu_items = gtk_menu_item_new_with_label("NONE"); menu_items = gtk_menu_item_new_with_label ("NONE");
/* Add it to the menu. */ /* Add it to the menu. */
gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items); gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items);
g_debug("ui_create_filter_menu %lx", (long) menu_items); g_debug("ui_create_filter_menu %lx", (long) menu_items);
g_signal_connect(G_OBJECT(menu_items), "activate", g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_none), *menu);
G_CALLBACK(ui_callback_on_menu_none), *menu);
/* Show the widget */ /* Show the widget */
gtk_widget_show(menu_items); gtk_widget_show (menu_items);
} }
/* Create the "ALL" menu-item */ /* Create the "ALL" menu-item */
{ {
/* Create a new menu-item with a name */ /* Create a new menu-item with a name */
menu_items = gtk_menu_item_new_with_label("ALL"); menu_items = gtk_menu_item_new_with_label ("ALL");
/* Add it to the menu. */ /* Add it to the menu. */
gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items); gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items);
g_debug("ui_create_filter_menu %lx", (long) menu_items); g_debug("ui_create_filter_menu %lx", (long) menu_items);
g_signal_connect(G_OBJECT(menu_items), "activate", g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_all), *menu);
G_CALLBACK(ui_callback_on_menu_all), *menu);
/* Show the widget */ /* Show the widget */
gtk_widget_show(menu_items); gtk_widget_show (menu_items);
} }
/* Create separator */ /* Create separator */
{ {
menu_items = gtk_menu_item_new(); menu_items = gtk_menu_item_new ();
/* Add it to the menu. */ /* Add it to the menu. */
gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items); gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items);
/* Show the widget */ /* Show the widget */
gtk_widget_show(menu_items); gtk_widget_show (menu_items);
} }
/* Creates menu-items */ /* Creates menu-items */
for (item = 0; item < filter->used; item++) for (item = 0; item < filter->used; item++)
{ {
/* Create a new menu-item with a name */ /* Create a new menu-item with a name */
menu_items = gtk_check_menu_item_new_with_label( menu_items = gtk_check_menu_item_new_with_label (filter->items[item].name);
filter->items[item].name);
/* Add it to the menu. */ /* Add it to the menu. */
gtk_menu_shell_append(GTK_MENU_SHELL(*menu), menu_items); gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_items), gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_items), filter->items[item].enabled);
filter->items[item].enabled);
/* Connect function to be called when the menu item is selected */ /* Connect function to be called when the menu item is selected */
data = &filter->items[item]; data = &filter->items[item];
g_debug("ui_create_filter_menu %lx %lx", (long) menu_items, (long) data); g_debug("ui_create_filter_menu %lx %lx", (long) menu_items, (long) data);
g_signal_connect(G_OBJECT(menu_items), "activate", g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_item_selected), data);
G_CALLBACK(ui_callback_on_menu_item_selected), data);
/* Save the menu_item reference */ /* Save the menu_item reference */
filter->items[item].menu_item = menu_items; filter->items[item].menu_item = menu_items;
/* Show the widget */ /* Show the widget */
gtk_widget_show(menu_items); 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) static void ui_destroy_filter_menu_item(GtkWidget *widget, gpointer data)
{ {
if (GTK_IS_MENU_ITEM(widget)) if (GTK_IS_MENU_ITEM(widget))
...@@ -524,10 +530,7 @@ void ui_destroy_filter_menu(ui_filter_e filter) ...@@ -524,10 +530,7 @@ void ui_destroy_filter_menu(ui_filter_e filter)
void ui_show_filter_menu(GtkWidget **menu, ui_filter_t *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 ()); gtk_menu_popup (GTK_MENU (*menu), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time ());
} }
...@@ -56,7 +56,7 @@ int ui_filters_read(const char *file_name); ...@@ -56,7 +56,7 @@ int ui_filters_read(const char *file_name);
int ui_filters_file_write(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); void ui_destroy_filter_menus(void);
......
...@@ -28,6 +28,9 @@ static ui_store_t ui_store; ...@@ -28,6 +28,9 @@ static ui_store_t ui_store;
static GValue colors[] = 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];
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)
...@@ -38,35 +41,16 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ...@@ -38,35 +41,16 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter,
uint32_t destination_task_id; uint32_t destination_task_id;
uint32_t instance; uint32_t instance;
gboolean enabled = FALSE; gboolean enabled = TRUE;
if (ui_filters.filters_enabled)
{
gtk_tree_model_get (model, iter, COL_MSG_NUM, &msg_number, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID, 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); &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) && (store->filtered_last_msg < msg_number)) if ((enabled) && (store->filtered_last_msg < msg_number))
{ {
store->filtered_last_msg = msg_number; store->filtered_last_msg = msg_number;
...@@ -74,6 +58,7 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ...@@ -74,6 +58,7 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter,
} }
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; return enabled;
} }
...@@ -119,7 +104,7 @@ static void ui_tree_view_init_list(GtkWidget *list) ...@@ -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_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, "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_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);
...@@ -257,6 +242,88 @@ static gboolean ui_tree_view_search(GtkTreeModel *model, gint column, const gcha ...@@ -257,6 +242,88 @@ static gboolean ui_tree_view_search(GtkTreeModel *model, gint column, const gcha
return 1; 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) int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
{ {
GtkWidget *hbox; GtkWidget *hbox;
...@@ -266,7 +333,7 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) ...@@ -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[0], G_TYPE_STRING);
g_value_init (&colors[1], G_TYPE_STRING); g_value_init (&colors[1], G_TYPE_STRING);
g_value_set_string (&colors[0], "Grey"); 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); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
...@@ -289,7 +356,7 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) ...@@ -289,7 +356,7 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
ui_tree_view_init_list (ui_main_data.messages_list); 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_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); gtk_paned_pack1 (GTK_PANED (hbox), scrolled_window, FALSE, TRUE);
ui_main_data.text_view = ui_signal_dissect_new (hbox); ui_main_data.text_view = ui_signal_dissect_new (hbox);
...@@ -307,6 +374,8 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) ...@@ -307,6 +374,8 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
ui_main_data.selection = selection; ui_main_data.selection = selection;
ui_tree_view_create_menu (&ui_tree_view_menu);
return 0; return 0;
} }
...@@ -374,7 +443,7 @@ static gboolean updateForegroundColor (GtkTreeModel *model, GtkTreePath *path, G ...@@ -374,7 +443,7 @@ static gboolean updateForegroundColor (GtkTreeModel *model, GtkTreePath *path, G
return FALSE; return FALSE;
} }
void ui_tree_view_refilter(void) void ui_tree_view_refilter()
{ {
ui_store.filtered_last_msg = 0; ui_store.filtered_last_msg = 0;
ui_store.filtered_msg_number = 0; ui_store.filtered_msg_number = 0;
...@@ -382,7 +451,7 @@ void ui_tree_view_refilter(void) ...@@ -382,7 +451,7 @@ void ui_tree_view_refilter(void)
/* Update foreground color of messages, this will also update filtered model */ /* Update foreground color of messages, this will also update filtered model */
if (ui_store.store != NULL) 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); 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_ #ifndef UI_TREE_VIEW_H_
#define UI_TREE_VIEW_H_ #define UI_TREE_VIEW_H_
typedef enum typedef enum col_type_e
{ {
COL_MSG_NUM = 0, COL_MSG_NUM = 0,
COL_LTE_TIME, COL_LTE_TIME,
...@@ -17,7 +17,25 @@ typedef enum ...@@ -17,7 +17,25 @@ typedef enum
COL_BUFFER, COL_BUFFER,
NUM_COLS 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; extern GdkEventButton *ui_tree_view_last_event;
......
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