Commit 008f7c19 authored by winckel's avatar winckel

Added filters reload button and menu.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4490 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 9c5b9727
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
static gboolean refresh_message_list = TRUE; static gboolean refresh_message_list = TRUE;
static gboolean filters_changed = FALSE; 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;
...@@ -46,48 +46,47 @@ gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data) ...@@ -46,48 +46,47 @@ gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data)
return TRUE; return TRUE;
} }
gboolean ui_callback_on_save_messages(GtkWidget *widget, gpointer data) gboolean ui_callback_on_save_messages (GtkWidget *widget, gpointer data)
{ {
g_message("Save messages event occurred"); g_message("Save messages event occurred");
// CHECK_FCT(ui_file_chooser()); // CHECK_FCT(ui_file_chooser());
return TRUE; return TRUE;
} }
gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data) gboolean ui_callback_on_filters_enabled (GtkToolButton *button, gpointer data)
{ {
gboolean enabled; gboolean enabled;
gboolean changed; gboolean changed;
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_debug("Filters enabled event occurred %d", enabled); g_debug("Filters enabled event occurred %d", enabled);
changed = ui_filters_enable (enabled); changed = ui_filters_enable(enabled);
if (changed) if (changed)
{ {
/* Set the tool tip text */ /* Set the tool tip text */
if (enabled) if (enabled)
{ {
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(button), "Disable messages filtering"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), "Disable messages filtering");
} }
else else
{ {
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(button), "Enable messages filtering"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), "Enable messages filtering");
} }
ui_tree_view_refilter (); ui_tree_view_refilter();
if (ui_main_data.messages_list != NULL) if (ui_main_data.messages_list != NULL)
{ {
GtkTreePath *path_row; GtkTreePath *path_row;
/* Get the currently selected message */ /* Get the currently selected message */
gtk_tree_view_get_cursor (GTK_TREE_VIEW(ui_main_data.messages_list), &path_row, NULL); gtk_tree_view_get_cursor(GTK_TREE_VIEW(ui_main_data.messages_list), &path_row, NULL);
if (path_row != NULL) if (path_row != NULL)
{ {
/* Center the message in the middle of the list if possible */ /* Center the message in the middle of the list if possible */
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(ui_main_data.messages_list), path_row, NULL, TRUE, 0.5, gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(ui_main_data.messages_list), path_row, NULL, TRUE, 0.5, 0.0);
0.0);
} }
} }
} }
...@@ -95,49 +94,61 @@ gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data) ...@@ -95,49 +94,61 @@ gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data)
return TRUE; return TRUE;
} }
gboolean ui_callback_on_open_filters(GtkWidget *widget, gpointer data) gboolean ui_callback_on_open_filters (GtkWidget *widget, gpointer data)
{ {
gboolean refresh = (data != NULL) ? TRUE : FALSE;
g_message("Open filters event occurred"); g_message("Open filters event occurred");
CHECK_FCT(ui_filters_open_file_chooser());
if (refresh && (ui_main_data.filters_file_name != NULL))
{
CHECK_FCT(ui_filters_read (ui_main_data.filters_file_name));
}
else
{
CHECK_FCT(ui_filters_open_file_chooser());
}
return TRUE; return TRUE;
} }
gboolean ui_callback_on_save_filters(GtkWidget *widget, gpointer data) gboolean ui_callback_on_save_filters (GtkWidget *widget, gpointer data)
{ {
g_message("Save filters event occurred"); g_message("Save filters event occurred");
CHECK_FCT(ui_filters_save_file_chooser()); CHECK_FCT(ui_filters_save_file_chooser());
return TRUE; return TRUE;
} }
gboolean ui_callback_on_enable_filters(GtkWidget *widget, gpointer data) gboolean ui_callback_on_enable_filters (GtkWidget *widget, gpointer data)
{ {
gboolean enabled; gboolean enabled;
enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.filters_enabled)); enabled = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(ui_main_data.filters_enabled));
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.filters_enabled), !enabled); gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(ui_main_data.filters_enabled), !enabled);
return TRUE; return TRUE;
} }
gboolean ui_callback_on_about(GtkWidget *widget, gpointer data) gboolean ui_callback_on_about (GtkWidget *widget, gpointer data)
{ {
#if defined(PACKAGE_STRING) #if defined(PACKAGE_STRING)
ui_notification_dialog (GTK_MESSAGE_INFO, "about", "Eurecom %s", PACKAGE_STRING); ui_notification_dialog (GTK_MESSAGE_INFO, "about", "Eurecom %s", PACKAGE_STRING);
#else #else
ui_notification_dialog (GTK_MESSAGE_INFO, "about", "Eurecom itti_analyzer"); ui_notification_dialog(GTK_MESSAGE_INFO, "about", "Eurecom itti_analyzer");
#endif #endif
return TRUE; return TRUE;
} }
gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean ui_callback_on_select_signal (GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path,
gboolean path_currently_selected, gpointer user_data) gboolean path_currently_selected, gpointer user_data)
{ {
static gpointer buffer_current; static gpointer buffer_current;
ui_text_view_t *text_view; ui_text_view_t *text_view;
GtkTreeIter iter; GtkTreeIter iter;
g_debug("Message selected %d %p %p %s", path_currently_selected, buffer_current, path, gtk_tree_path_to_string(path)); g_debug("Message selected %d %p %p %s", path_currently_selected, buffer_current, path,
gtk_tree_path_to_string(path));
if (!path_currently_selected) if (!path_currently_selected)
{ {
...@@ -145,7 +156,7 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -145,7 +156,7 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
g_assert(text_view != NULL); g_assert(text_view != NULL);
if (gtk_tree_model_get_iter (model, &iter, path)) if (gtk_tree_model_get_iter(model, &iter, path))
{ {
gpointer buffer; gpointer buffer;
...@@ -155,14 +166,15 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -155,14 +166,15 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
uint32_t instance; uint32_t instance;
char label[100]; char label[100];
gtk_tree_model_get (model, &iter, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID, &origin_task_id, 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); 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);
if (ui_tree_view_last_event) if (ui_tree_view_last_event)
{ {
g_debug("last_event %p %d %d", ui_tree_view_last_event, ui_tree_view_last_event->type, ui_tree_view_last_event->button); g_debug("last_event %p %d %d", ui_tree_view_last_event, ui_tree_view_last_event->type,
ui_tree_view_last_event->button);
if (ui_tree_view_last_event->type == GDK_BUTTON_PRESS) if (ui_tree_view_last_event->type == GDK_BUTTON_PRESS)
{ {
...@@ -179,24 +191,25 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -179,24 +191,25 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
if (ui_main_data.menu_filter_messages == NULL) if (ui_main_data.menu_filter_messages == NULL)
{ {
ui_create_filter_menus (); ui_create_filter_menus();
} }
g_debug("Message selected right click %d %d %d %d", message_id, origin_task_id, destination_task_id, instance); g_debug("Message selected right click %d %d %d %d", message_id, origin_task_id,
destination_task_id, instance);
/* Message Id menu */ /* Message Id menu */
{ {
/* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */ /* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */
ui_tree_view_menu_enable[MENU_MESSAGE].filter_item = NULL; ui_tree_view_menu_enable[MENU_MESSAGE].filter_item = NULL;
item = ui_filters_search_id (&ui_filters.messages, message_id); item = ui_filters_search_id(&ui_filters.messages, message_id);
/* Update the menu item check state based on message ID state */ /* 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_tree_view_menu_enable[MENU_MESSAGE].menu_enable), GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_MESSAGE].menu_enable),
ui_filters.messages.items[item].enabled); ui_filters.messages.items[item].enabled);
/* Set menu item label */ /* Set menu item label */
sprintf (label, "Message: %s", message_id_to_string (message_id)); 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), gtk_menu_item_set_label(GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_MESSAGE].menu_enable),
label); label);
/* Save menu item associated to this row */ /* Save menu item associated to this row */
ui_tree_view_menu_enable[MENU_MESSAGE].filter_item = &ui_filters.messages.items[item]; ui_tree_view_menu_enable[MENU_MESSAGE].filter_item = &ui_filters.messages.items[item];
} }
...@@ -205,15 +218,15 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -205,15 +218,15 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
{ {
/* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */ /* 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].filter_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); item = ui_filters_search_id(&ui_filters.origin_tasks, origin_task_id);
/* Update the menu item check state based on message ID state */ /* 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_tree_view_menu_enable[MENU_FROM_TASK].menu_enable), GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_FROM_TASK].menu_enable),
ui_filters.origin_tasks.items[item].enabled); ui_filters.origin_tasks.items[item].enabled);
/* Set menu item label */ /* Set menu item label */
sprintf (label, "From: %s", task_id_to_string (origin_task_id, origin_task_id_type)); sprintf(label, "From: %s", task_id_to_string(origin_task_id, origin_task_id_type));
gtk_menu_item_set_label ( gtk_menu_item_set_label(GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_FROM_TASK].menu_enable),
GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_FROM_TASK].menu_enable), label); label);
/* Save menu item associated to this row */ /* Save menu item associated to this row */
ui_tree_view_menu_enable[MENU_FROM_TASK].filter_item = &ui_filters.origin_tasks.items[item]; ui_tree_view_menu_enable[MENU_FROM_TASK].filter_item = &ui_filters.origin_tasks.items[item];
} }
...@@ -222,16 +235,15 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -222,16 +235,15 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
{ {
/* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */ /* 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].filter_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); item = ui_filters_search_id(&ui_filters.destination_tasks, destination_task_id);
/* Update the menu item check state based on message ID state */ /* 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_tree_view_menu_enable[MENU_TO_TASK].menu_enable), GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_TO_TASK].menu_enable),
ui_filters.destination_tasks.items[item].enabled); ui_filters.destination_tasks.items[item].enabled);
/* Set menu item label */ /* Set menu item label */
sprintf (label, "To: %s", sprintf(label, "To: %s", task_id_to_string(destination_task_id, destination_task_id_type));
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),
gtk_menu_item_set_label (GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_TO_TASK].menu_enable), label);
label);
/* Save menu item associated to this row */ /* Save menu item associated to this row */
ui_tree_view_menu_enable[MENU_TO_TASK].filter_item = ui_tree_view_menu_enable[MENU_TO_TASK].filter_item =
&ui_filters.destination_tasks.items[item]; &ui_filters.destination_tasks.items[item];
...@@ -241,21 +253,21 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -241,21 +253,21 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
{ {
/* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */ /* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */
ui_tree_view_menu_enable[MENU_INSTANCE].filter_item = NULL; ui_tree_view_menu_enable[MENU_INSTANCE].filter_item = NULL;
item = ui_filters_search_id (&ui_filters.instances, instance); item = ui_filters_search_id(&ui_filters.instances, instance);
/* Update the menu item check state based on message ID state */ /* 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_tree_view_menu_enable[MENU_INSTANCE].menu_enable), GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_INSTANCE].menu_enable),
ui_filters.instances.items[item].enabled); ui_filters.instances.items[item].enabled);
/* Set menu item label */ /* Set menu item label */
sprintf (label, "Instance: %d", instance); sprintf(label, "Instance: %d", instance);
gtk_menu_item_set_label (GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_INSTANCE].menu_enable), gtk_menu_item_set_label(GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_INSTANCE].menu_enable),
label); label);
/* Save menu item associated to this row */ /* Save menu item associated to this row */
ui_tree_view_menu_enable[MENU_INSTANCE].filter_item = &ui_filters.instances.items[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, gtk_menu_popup(GTK_MENU (ui_tree_view_menu), NULL, NULL, NULL, NULL, 0,
gtk_get_current_event_time ()); gtk_get_current_event_time());
} }
} }
...@@ -275,12 +287,12 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -275,12 +287,12 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
CHECK_FCT_DO(dissect_signal_header((buffer_t*)buffer, ui_signal_set_text, text_view), return FALSE); CHECK_FCT_DO(dissect_signal_header((buffer_t*)buffer, ui_signal_set_text, text_view), return FALSE);
} }
if ((strcmp (message_id_to_string (message_id), "ERROR_LOG") == 0) if ((strcmp(message_id_to_string(message_id), "ERROR_LOG") == 0)
|| (strcmp (message_id_to_string (message_id), "WARNING_LOG") == 0) || (strcmp(message_id_to_string(message_id), "WARNING_LOG") == 0)
|| (strcmp (message_id_to_string (message_id), "NOTICE_LOG") == 0) || (strcmp(message_id_to_string(message_id), "NOTICE_LOG") == 0)
|| (strcmp (message_id_to_string (message_id), "INFO_LOG") == 0) || (strcmp(message_id_to_string(message_id), "INFO_LOG") == 0)
|| (strcmp (message_id_to_string (message_id), "DEBUG_LOG") == 0) || (strcmp(message_id_to_string(message_id), "DEBUG_LOG") == 0)
|| (strcmp (message_id_to_string (message_id), "GENERIC_LOG") == 0)) || (strcmp(message_id_to_string(message_id), "GENERIC_LOG") == 0))
{ {
gchar *data; gchar *data;
gint data_size; gint data_size;
...@@ -288,16 +300,17 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -288,16 +300,17 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
if (ui_main_data.display_message_header) if (ui_main_data.display_message_header)
{ {
ui_signal_set_text (text_view, "\n", 1); ui_signal_set_text(text_view, "\n", 1);
} }
message_header_type_size = get_message_header_type_size (); message_header_type_size = get_message_header_type_size();
data = (gchar *) buffer_at_offset ((buffer_t*) buffer, message_header_type_size); data = (gchar *) buffer_at_offset((buffer_t*) buffer, message_header_type_size);
data_size = get_message_size ((buffer_t*) buffer); data_size = get_message_size((buffer_t*) buffer);
g_debug(" message header type size: %u, data size: %u %p %d", message_header_type_size, data_size, buffer, ui_main_data.follow_last); g_debug(" message header type size: %u, data size: %u %p %d", message_header_type_size,
data_size, buffer, ui_main_data.follow_last);
ui_signal_set_text (text_view, data, data_size); ui_signal_set_text(text_view, data, data_size);
} }
else else
{ {
...@@ -312,21 +325,21 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -312,21 +325,21 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
return TRUE; return TRUE;
} }
gboolean ui_callback_on_menu_enable(GtkWidget *widget, gpointer data) gboolean ui_callback_on_menu_enable (GtkWidget *widget, gpointer data)
{ {
ui_tree_view_menu_enable_t *menu_enable = data; ui_tree_view_menu_enable_t *menu_enable = data;
if (menu_enable->filter_item != NULL) if (menu_enable->filter_item != NULL)
{ {
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_enable->filter_item->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))); gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu_enable->menu_enable)));
menu_enable->filter_item = NULL; menu_enable->filter_item = NULL;
} }
return TRUE; return TRUE;
} }
gboolean ui_callback_on_menu_color(GtkWidget *widget, gpointer data) gboolean ui_callback_on_menu_color (GtkWidget *widget, gpointer data)
{ {
ui_tree_view_menu_enable_t *menu_enable = data; ui_tree_view_menu_enable_t *menu_enable = data;
...@@ -334,30 +347,31 @@ gboolean ui_callback_on_menu_color(GtkWidget *widget, gpointer data) ...@@ -334,30 +347,31 @@ gboolean ui_callback_on_menu_color(GtkWidget *widget, gpointer data)
GtkWidget *color_chooser; GtkWidget *color_chooser;
gint response; gint response;
color_chooser = gtk_color_chooser_dialog_new ("Select message background 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); gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(color_chooser), FALSE);
response = gtk_dialog_run (GTK_DIALOG (color_chooser)); response = gtk_dialog_run(GTK_DIALOG (color_chooser));
if (response == GTK_RESPONSE_OK) if (response == GTK_RESPONSE_OK)
{ {
int red, green, blue; int red, green, blue;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER(color_chooser), &color); gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(color_chooser), &color);
red = (int) (color.red * 255); red = (int) (color.red * 255);
green = (int) (color.green * 255); green = (int) (color.green * 255);
blue = (int) (color.blue * 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); 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); snprintf(menu_enable->filter_item->background, BACKGROUND_SIZE, "#%02x%02x%02x", red, green, blue);
ui_tree_view_refilter (); ui_tree_view_refilter();
} }
gtk_widget_destroy (color_chooser); gtk_widget_destroy(color_chooser);
return TRUE; 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;
buffer_t *signal_buffer; buffer_t *signal_buffer;
...@@ -371,23 +385,23 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data) ...@@ -371,23 +385,23 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data)
char lte_time[15]; char lte_time[15];
gtk_tree_view_get_cursor (GTK_TREE_VIEW(ui_main_data.messages_list), &path, &focus_column); gtk_tree_view_get_cursor(GTK_TREE_VIEW(ui_main_data.messages_list), &path, &focus_column);
signal_buffer = (buffer_t *) data; signal_buffer = (buffer_t *) data;
lte_frame = get_lte_frame (signal_buffer); lte_frame = get_lte_frame(signal_buffer);
lte_slot = get_lte_slot (signal_buffer); lte_slot = get_lte_slot(signal_buffer);
sprintf (lte_time, "%d.%02d", lte_frame, lte_slot); sprintf(lte_time, "%d.%02d", lte_frame, lte_slot);
get_message_id (root, signal_buffer, &signal_buffer->message_id); get_message_id(root, signal_buffer, &signal_buffer->message_id);
origin_task_id = get_task_id (signal_buffer, origin_task_id_type); origin_task_id = get_task_id(signal_buffer, origin_task_id_type);
destination_task_id = get_task_id (signal_buffer, destination_task_id_type); destination_task_id = get_task_id(signal_buffer, destination_task_id_type);
instance = get_instance (signal_buffer); instance = get_instance(signal_buffer);
ui_tree_view_new_signal_ind (signal_buffer->message_number, lte_time, signal_buffer->message_id, ui_tree_view_new_signal_ind(signal_buffer->message_number, lte_time, signal_buffer->message_id,
message_id_to_string (signal_buffer->message_id), origin_task_id, message_id_to_string(signal_buffer->message_id), origin_task_id,
task_id_to_string (origin_task_id, origin_task_id_type), destination_task_id, task_id_to_string(origin_task_id, origin_task_id_type), destination_task_id,
task_id_to_string (destination_task_id, destination_task_id_type), instance, data); task_id_to_string(destination_task_id, destination_task_id_type), instance, data);
/* Increment number of messages */ /* Increment number of messages */
ui_main_data.nb_message_received++; ui_main_data.nb_message_received++;
...@@ -395,67 +409,65 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data) ...@@ -395,67 +409,65 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data)
if ((ui_main_data.follow_last) && (goto_last)) if ((ui_main_data.follow_last) && (goto_last))
{ {
/* Advance to the new last signal */ /* Advance to the new last signal */
ui_tree_view_select_row (ui_tree_view_get_filtered_number () - 1); ui_tree_view_select_row(ui_tree_view_get_filtered_number() - 1);
} }
} }
static gboolean ui_handle_update_signal_list(gint fd, void *data, size_t data_length) static gboolean ui_handle_update_signal_list (gint fd, void *data, size_t data_length)
{ {
pipe_new_signals_list_message_t *signal_list_message; pipe_new_signals_list_message_t *signal_list_message;
/* Enable buttons to move in the list of signals */ /* Enable buttons to move in the list of signals */
ui_set_sensitive_move_buttons (TRUE); ui_set_sensitive_move_buttons(TRUE);
signal_list_message = (pipe_new_signals_list_message_t *) data; signal_list_message = (pipe_new_signals_list_message_t *) data;
g_assert(signal_list_message != NULL); g_assert(signal_list_message != NULL);
g_assert(signal_list_message->signal_list != NULL); g_assert(signal_list_message->signal_list != NULL);
g_list_foreach (signal_list_message->signal_list, ui_signal_add_to_list, (gpointer) TRUE); g_list_foreach(signal_list_message->signal_list, ui_signal_add_to_list, (gpointer) TRUE);
/* Free the list but not user data associated with each element */ /* Free the list but not user data associated with each element */
g_list_free (signal_list_message->signal_list); g_list_free(signal_list_message->signal_list);
/* Free the message */ /* Free the message */
free (signal_list_message); free(signal_list_message);
ui_gtk_flush_events (); ui_gtk_flush_events();
return TRUE; return TRUE;
} }
static gboolean ui_handle_socket_connection_failed(gint fd) static gboolean ui_handle_socket_connection_failed (gint fd)
{ {
GtkWidget *dialogbox; GtkWidget *dialogbox;
dialogbox = gtk_message_dialog_new (GTK_WINDOW(ui_main_data.window), GTK_DIALOG_DESTROY_WITH_PARENT, dialogbox = gtk_message_dialog_new(GTK_WINDOW(ui_main_data.window), GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Failed to connect to provided host/ip address");
"Failed to connect to provided host/ip address");
gtk_dialog_run (GTK_DIALOG(dialogbox)); gtk_dialog_run(GTK_DIALOG(dialogbox));
gtk_widget_destroy (dialogbox); gtk_widget_destroy(dialogbox);
/* Re-enable connect button */ /* Re-enable connect button */
ui_enable_connect_button (); ui_enable_connect_button();
return TRUE; return TRUE;
} }
static gboolean ui_handle_socket_connection_lost(gint fd) static gboolean ui_handle_socket_connection_lost (gint fd)
{ {
GtkWidget *dialogbox; GtkWidget *dialogbox;
dialogbox = gtk_message_dialog_new (GTK_WINDOW(ui_main_data.window), GTK_DIALOG_DESTROY_WITH_PARENT, dialogbox = gtk_message_dialog_new(GTK_WINDOW(ui_main_data.window), GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Connection with remote host has been lost");
"Connection with remote host has been lost");
gtk_dialog_run (GTK_DIALOG(dialogbox)); gtk_dialog_run(GTK_DIALOG(dialogbox));
gtk_widget_destroy (dialogbox); gtk_widget_destroy(dialogbox);
/* Re-enable connect button */ /* Re-enable connect button */
ui_enable_connect_button (); ui_enable_connect_button();
return TRUE; return TRUE;
} }
static gboolean ui_handle_socket_xml_definition(gint fd, void *data, size_t data_length) static gboolean ui_handle_socket_xml_definition (gint fd, void *data, size_t data_length)
{ {
pipe_xml_definition_message_t *xml_definition_message; pipe_xml_definition_message_t *xml_definition_message;
...@@ -463,21 +475,21 @@ static gboolean ui_handle_socket_xml_definition(gint fd, void *data, size_t data ...@@ -463,21 +475,21 @@ static gboolean ui_handle_socket_xml_definition(gint fd, void *data, size_t data
g_assert(xml_definition_message != NULL); g_assert(xml_definition_message != NULL);
g_assert(data_length == sizeof(pipe_xml_definition_message_t)); g_assert(data_length == sizeof(pipe_xml_definition_message_t));
xml_parse_buffer (xml_definition_message->xml_definition, xml_definition_message->xml_definition_length); xml_parse_buffer(xml_definition_message->xml_definition, xml_definition_message->xml_definition_length);
free (data); free(data);
return TRUE; return TRUE;
} }
gboolean ui_pipe_callback(gint source, gpointer user_data) gboolean ui_pipe_callback (gint source, gpointer user_data)
{ {
void *input_data = NULL; void *input_data = NULL;
size_t input_data_length = 0; size_t input_data_length = 0;
pipe_input_header_t input_header; pipe_input_header_t input_header;
/* Read the header */ /* Read the header */
if (read (source, &input_header, sizeof(input_header)) < 0) if (read(source, &input_header, sizeof(input_header)) < 0)
{ {
g_warning("Failed to read from pipe %d: %s", source, g_strerror(errno)); g_warning("Failed to read from pipe %d: %s", source, g_strerror(errno));
return FALSE; return FALSE;
...@@ -488,9 +500,9 @@ gboolean ui_pipe_callback(gint source, gpointer user_data) ...@@ -488,9 +500,9 @@ gboolean ui_pipe_callback(gint source, gpointer user_data)
/* Checking for non-header part */ /* Checking for non-header part */
if (input_data_length > 0) if (input_data_length > 0)
{ {
input_data = malloc (input_data_length); input_data = malloc(input_data_length);
if (read (source, input_data, input_data_length) < 0) if (read(source, input_data, input_data_length) < 0)
{ {
g_warning("Failed to read from pipe %d: %s", source, g_strerror(errno)); g_warning("Failed to read from pipe %d: %s", source, g_strerror(errno));
return FALSE; return FALSE;
...@@ -499,233 +511,234 @@ gboolean ui_pipe_callback(gint source, gpointer user_data) ...@@ -499,233 +511,234 @@ gboolean ui_pipe_callback(gint source, gpointer user_data)
switch (input_header.message_type) switch (input_header.message_type)
{ {
case UI_PIPE_CONNECTION_FAILED: case UI_PIPE_CONNECTION_FAILED:
return ui_handle_socket_connection_failed (source); return ui_handle_socket_connection_failed(source);
case UI_PIPE_XML_DEFINITION: case UI_PIPE_XML_DEFINITION:
return ui_handle_socket_xml_definition (source, input_data, input_data_length); return ui_handle_socket_xml_definition(source, input_data, input_data_length);
case UI_PIPE_CONNECTION_LOST: case UI_PIPE_CONNECTION_LOST:
return ui_handle_socket_connection_lost (source); return ui_handle_socket_connection_lost(source);
case UI_PIPE_UPDATE_SIGNAL_LIST: case UI_PIPE_UPDATE_SIGNAL_LIST:
return ui_handle_update_signal_list (source, input_data, input_data_length); return ui_handle_update_signal_list(source, input_data, input_data_length);
default: default:
g_warning("[gui] Unhandled message type %u", input_header.message_type); g_warning("[gui] Unhandled message type %u", input_header.message_type);
g_assert_not_reached(); g_assert_not_reached();
} }
return FALSE; return FALSE;
} }
gboolean ui_callback_on_connect(GtkWidget *widget, gpointer data) gboolean ui_callback_on_connect (GtkWidget *widget, gpointer data)
{ {
/* We have to retrieve the ip address and port of remote host */ /* We have to retrieve the ip address and port of remote host */
const char *ip; const char *ip;
uint16_t port; uint16_t port;
int pipe_fd[2]; int pipe_fd[2];
port = atoi (gtk_entry_get_text (GTK_ENTRY(ui_main_data.port_entry))); port = atoi(gtk_entry_get_text(GTK_ENTRY(ui_main_data.port_entry)));
ip = gtk_entry_get_text (GTK_ENTRY(ui_main_data.ip_entry)); ip = gtk_entry_get_text(GTK_ENTRY(ui_main_data.ip_entry));
g_message("Connect event occurred to %s:%d", ip, port); g_message("Connect event occurred to %s:%d", ip, port);
if (strlen (ip) == 0) if (strlen(ip) == 0)
{ {
ui_notification_dialog (GTK_MESSAGE_WARNING, "Connect", "Empty host ip address"); ui_notification_dialog(GTK_MESSAGE_WARNING, "Connect", "Empty host ip address");
return FALSE; return FALSE;
} }
if (port == 0) if (port == 0)
{ {
ui_notification_dialog (GTK_MESSAGE_WARNING, "Connect", "Invalid host port value"); ui_notification_dialog(GTK_MESSAGE_WARNING, "Connect", "Invalid host port value");
return FALSE; return FALSE;
} }
ui_pipe_new (pipe_fd, ui_pipe_callback, NULL); ui_pipe_new(pipe_fd, ui_pipe_callback, NULL);
memcpy (ui_main_data.pipe_fd, pipe_fd, sizeof(int) * 2); memcpy(ui_main_data.pipe_fd, pipe_fd, sizeof(int) * 2);
/* Disable the connect button */ /* Disable the connect button */
ui_disable_connect_button (); ui_disable_connect_button();
ui_callback_signal_clear_list (widget, data); ui_callback_signal_clear_list(widget, data);
if (socket_connect_to_remote_host (ip, port, pipe_fd[1]) != 0) if (socket_connect_to_remote_host(ip, port, pipe_fd[1]) != 0)
{ {
ui_enable_connect_button (); ui_enable_connect_button();
return FALSE; return FALSE;
} }
ui_set_title ("%s:%d", ip, port); ui_set_title("%s:%d", ip, port);
return TRUE; return TRUE;
} }
gboolean ui_callback_on_disconnect(GtkWidget *widget, gpointer data) gboolean ui_callback_on_disconnect (GtkWidget *widget, gpointer data)
{ {
/* We have to retrieve the ip address and port of remote host */ /* We have to retrieve the ip address and port of remote host */
g_message("Disconnect event occurred"); g_message("Disconnect event occurred");
ui_pipe_write_message (ui_main_data.pipe_fd[0], UI_PIPE_DISCONNECT_EVT, NULL, 0); ui_pipe_write_message(ui_main_data.pipe_fd[0], UI_PIPE_DISCONNECT_EVT, NULL, 0);
ui_enable_connect_button (); ui_enable_connect_button();
return TRUE; return TRUE;
} }
gboolean ui_callback_signal_go_to_first(GtkWidget *widget, gpointer data) gboolean ui_callback_signal_go_to_first (GtkWidget *widget, gpointer data)
{ {
ui_tree_view_select_row (0); ui_tree_view_select_row(0);
ui_main_data.follow_last = FALSE; ui_main_data.follow_last = FALSE;
return TRUE; return TRUE;
} }
gboolean ui_callback_signal_go_to(GtkWidget *widget, gpointer data) gboolean ui_callback_signal_go_to (GtkWidget *widget, gpointer data)
{ {
gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.signals_go_to_entry); gtk_window_set_focus(GTK_WINDOW(ui_main_data.window), ui_main_data.signals_go_to_entry);
return TRUE; return TRUE;
} }
gboolean ui_callback_signal_go_to_entry(GtkWidget *widget, gpointer data) gboolean ui_callback_signal_go_to_entry (GtkWidget *widget, gpointer data)
{ {
// gtk_entry_buffer_set_text(GTK_ENTRY(ui_main_data.signals_go_to_entry), ""); // gtk_entry_buffer_set_text(GTK_ENTRY(ui_main_data.signals_go_to_entry), "");
gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.messages_list); gtk_window_set_focus(GTK_WINDOW(ui_main_data.window), ui_main_data.messages_list);
return TRUE; return TRUE;
} }
gboolean ui_callback_signal_go_to_last(GtkWidget *widget, gpointer data) gboolean ui_callback_signal_go_to_last (GtkWidget *widget, gpointer data)
{ {
ui_tree_view_select_row (ui_tree_view_get_filtered_number () - 1); ui_tree_view_select_row(ui_tree_view_get_filtered_number() - 1);
ui_main_data.follow_last = TRUE; ui_main_data.follow_last = TRUE;
return TRUE; return TRUE;
} }
gboolean ui_callback_display_message_header(GtkWidget *widget, gpointer data) gboolean ui_callback_display_message_header (GtkWidget *widget, gpointer data)
{ {
ui_main_data.display_message_header = !ui_main_data.display_message_header; ui_main_data.display_message_header = !ui_main_data.display_message_header;
// TODO refresh textview. // TODO refresh textview.
return TRUE; return TRUE;
} }
gboolean ui_callback_display_brace(GtkWidget *widget, gpointer data) gboolean ui_callback_display_brace (GtkWidget *widget, gpointer data)
{ {
ui_main_data.display_brace = !ui_main_data.display_brace; ui_main_data.display_brace = !ui_main_data.display_brace;
// TODO refresh textview. // TODO refresh textview.
return TRUE; return TRUE;
} }
gboolean ui_callback_signal_clear_list(GtkWidget *widget, gpointer data) gboolean ui_callback_signal_clear_list (GtkWidget *widget, gpointer data)
{ {
/* Disable buttons to move in the list of signals */ /* Disable buttons to move in the list of signals */
ui_set_sensitive_move_buttons (FALSE); ui_set_sensitive_move_buttons(FALSE);
ui_set_title (""); ui_set_title("");
/* Clear list of signals */ /* Clear list of signals */
ui_tree_view_destroy_list (ui_main_data.messages_list); ui_tree_view_destroy_list(ui_main_data.messages_list);
if (ui_main_data.text_view != NULL) if (ui_main_data.text_view != NULL)
{ {
ui_signal_dissect_clear_view (ui_main_data.text_view); ui_signal_dissect_clear_view(ui_main_data.text_view);
} }
return TRUE; return TRUE;
} }
static void ui_callback_on_menu_items_selected(GtkWidget *widget, gpointer data) static void ui_callback_on_menu_items_selected (GtkWidget *widget, gpointer data)
{ {
gboolean active = data != NULL; gboolean active = data != NULL;
if (GTK_IS_CHECK_MENU_ITEM(widget)) if (GTK_IS_CHECK_MENU_ITEM(widget))
{ {
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(widget), active); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), active);
} }
} }
gboolean ui_callback_on_menu_none(GtkWidget *widget, gpointer data) gboolean ui_callback_on_menu_none (GtkWidget *widget, gpointer data)
{ {
GtkWidget *menu = (GtkWidget *) data; GtkWidget *menu = (GtkWidget *) data;
g_debug("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; 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; refresh_message_list = TRUE;
if (filters_changed) if (filters_changed)
{ {
ui_tree_view_refilter (); ui_tree_view_refilter();
filters_changed = FALSE; filters_changed = FALSE;
} }
return TRUE; return TRUE;
} }
gboolean ui_callback_on_menu_all(GtkWidget *widget, gpointer data) gboolean ui_callback_on_menu_all (GtkWidget *widget, gpointer data)
{ {
GtkWidget *menu = (GtkWidget *) data; GtkWidget *menu = (GtkWidget *) data;
g_debug("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; 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; refresh_message_list = TRUE;
if (filters_changed) if (filters_changed)
{ {
ui_tree_view_refilter (); ui_tree_view_refilter();
filters_changed = FALSE; filters_changed = FALSE;
} }
return TRUE; return TRUE;
} }
gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer data) gboolean ui_callback_on_menu_item_selected (GtkWidget *widget, gpointer data)
{ {
ui_filter_item_t *filter_entry = data; ui_filter_item_t *filter_entry = data;
gboolean enabled; gboolean enabled;
enabled = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(widget)); enabled = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
if (filter_entry->enabled != enabled) if (filter_entry->enabled != enabled)
{ {
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
{ {
filters_changed = TRUE; 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());
return TRUE; return TRUE;
} }
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_t col = (col_type_t) 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)
{ {
case COL_MESSAGE: case COL_MESSAGE:
ui_show_filter_menu (&ui_main_data.menu_filter_messages, &ui_filters.messages); ui_show_filter_menu(&ui_main_data.menu_filter_messages, &ui_filters.messages);
break; break;
case COL_FROM_TASK: case COL_FROM_TASK:
ui_show_filter_menu (&ui_main_data.menu_filter_origin_tasks, &ui_filters.origin_tasks); ui_show_filter_menu(&ui_main_data.menu_filter_origin_tasks, &ui_filters.origin_tasks);
break; break;
case COL_TO_TASK: case COL_TO_TASK:
ui_show_filter_menu (&ui_main_data.menu_filter_destination_tasks, &ui_filters.destination_tasks); ui_show_filter_menu(&ui_main_data.menu_filter_destination_tasks, &ui_filters.destination_tasks);
break; break;
case COL_INSTANCE: case COL_INSTANCE:
ui_show_filter_menu (&ui_main_data.menu_filter_instances, &ui_filters.instances); ui_show_filter_menu(&ui_main_data.menu_filter_instances, &ui_filters.instances);
break; break;
default: default:
g_warning("Unknown column filter %d in call to ui_callback_on_tree_column_header_click", col); g_warning("Unknown column filter %d in call to ui_callback_on_tree_column_header_click", col);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
......
...@@ -20,6 +20,7 @@ typedef struct { ...@@ -20,6 +20,7 @@ typedef struct {
/* Buttons */ /* Buttons */
GtkToolItem *filters_enabled; GtkToolItem *filters_enabled;
GtkToolItem *open_filters_file; GtkToolItem *open_filters_file;
GtkToolItem *refresh_filters_file;
GtkToolItem *save_filters_file; GtkToolItem *save_filters_file;
GtkToolItem *open_replay_file; GtkToolItem *open_replay_file;
......
...@@ -22,15 +22,16 @@ int ui_menu_bar_create(GtkWidget *vbox) ...@@ -22,15 +22,16 @@ int ui_menu_bar_create(GtkWidget *vbox)
{ {
GtkAccelGroup *accel_group; GtkAccelGroup *accel_group;
GtkWidget *menu_bar; GtkWidget *menu_bar;
GtkWidget *filters_menu; GtkWidget *filters_menu;
GtkWidget *messages_menu;
GtkWidget *help_menu;
GtkWidget *filters; GtkWidget *filters;
GtkWidget *messages;
GtkWidget *help;
GtkWidget *open_filters; GtkWidget *open_filters;
GtkWidget *reload_filters;
GtkWidget *save_filters; GtkWidget *save_filters;
GtkWidget *enable_filters; GtkWidget *enable_filters;
GtkWidget *messages_menu;
GtkWidget *messages;
GtkWidget *open_messages; GtkWidget *open_messages;
GtkWidget *reload_messages; GtkWidget *reload_messages;
GtkWidget *save_messages; GtkWidget *save_messages;
...@@ -39,6 +40,9 @@ int ui_menu_bar_create(GtkWidget *vbox) ...@@ -39,6 +40,9 @@ int ui_menu_bar_create(GtkWidget *vbox)
GtkWidget *goto_last_messages; GtkWidget *goto_last_messages;
GtkWidget *display_message_header; GtkWidget *display_message_header;
GtkWidget *display_brace; GtkWidget *display_brace;
GtkWidget *help_menu;
GtkWidget *help;
GtkWidget *quit; GtkWidget *quit;
GtkWidget *about; GtkWidget *about;
...@@ -64,7 +68,15 @@ int ui_menu_bar_create(GtkWidget *vbox) ...@@ -64,7 +68,15 @@ int ui_menu_bar_create(GtkWidget *vbox)
gtk_widget_add_accelerator (open_filters, "activate", accel_group, GDK_KEY_p, GDK_CONTROL_MASK, gtk_widget_add_accelerator (open_filters, "activate", accel_group, GDK_KEY_p, GDK_CONTROL_MASK,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
gtk_menu_shell_append (GTK_MENU_SHELL(filters_menu), open_filters); gtk_menu_shell_append (GTK_MENU_SHELL(filters_menu), open_filters);
g_signal_connect(G_OBJECT(open_filters), "activate", G_CALLBACK(ui_callback_on_open_filters), NULL); g_signal_connect(G_OBJECT(open_filters), "activate", G_CALLBACK(ui_callback_on_open_filters), (gpointer) FALSE);
reload_filters = gtk_menu_item_new_with_mnemonic ("_Reload filters file");
gtk_widget_add_accelerator (reload_filters, "activate", accel_group, GDK_KEY_d, GDK_CONTROL_MASK,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (reload_filters, "activate", accel_group, GDK_KEY_F4, 0, GTK_ACCEL_VISIBLE);
gtk_menu_shell_append (GTK_MENU_SHELL(filters_menu), reload_filters);
g_signal_connect(G_OBJECT(reload_filters), "activate", G_CALLBACK(ui_callback_on_open_filters),
(gpointer) TRUE);
save_filters = gtk_menu_item_new_with_mnemonic ("_Save filters file"); save_filters = gtk_menu_item_new_with_mnemonic ("_Save filters file");
gtk_widget_add_accelerator (save_filters, "activate", accel_group, GDK_KEY_a, GDK_CONTROL_MASK, gtk_widget_add_accelerator (save_filters, "activate", accel_group, GDK_KEY_a, GDK_CONTROL_MASK,
...@@ -209,7 +221,16 @@ int ui_toolbar_create(GtkWidget *vbox) ...@@ -209,7 +221,16 @@ int ui_toolbar_create(GtkWidget *vbox)
gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.open_filters_file), "Open filters file"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.open_filters_file), "Open filters file");
g_signal_connect(G_OBJECT(ui_main_data.open_filters_file), "clicked", g_signal_connect(G_OBJECT(ui_main_data.open_filters_file), "clicked",
G_CALLBACK(ui_callback_on_open_filters), NULL); G_CALLBACK(ui_callback_on_open_filters), (gpointer) FALSE);
}
/* Button to refresh filters file */
{
ui_main_data.refresh_filters_file = gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH);
gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.refresh_filters_file), "Reload filters file");
g_signal_connect(G_OBJECT(ui_main_data.refresh_filters_file), "clicked",
G_CALLBACK(ui_callback_on_open_filters), (gpointer) TRUE);
} }
/* Button to save filters file */ /* Button to save filters file */
...@@ -221,7 +242,7 @@ int ui_toolbar_create(GtkWidget *vbox) ...@@ -221,7 +242,7 @@ int ui_toolbar_create(GtkWidget *vbox)
G_CALLBACK(ui_callback_on_save_filters), NULL); G_CALLBACK(ui_callback_on_save_filters), NULL);
} }
/* Button to open replay file */ /* Button to open messages file */
{ {
ui_main_data.open_replay_file = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN); ui_main_data.open_replay_file = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN);
gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.open_replay_file), "Open messages file"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.open_replay_file), "Open messages file");
...@@ -230,7 +251,7 @@ int ui_toolbar_create(GtkWidget *vbox) ...@@ -230,7 +251,7 @@ int ui_toolbar_create(GtkWidget *vbox)
G_CALLBACK(ui_callback_on_open_messages), (gpointer) FALSE); G_CALLBACK(ui_callback_on_open_messages), (gpointer) FALSE);
} }
/* Button to refresh replay file */ /* Button to refresh messages file */
{ {
ui_main_data.refresh_replay_file = gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH); ui_main_data.refresh_replay_file = gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH);
gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.refresh_replay_file), "Reload messages file"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.refresh_replay_file), "Reload messages file");
...@@ -239,7 +260,7 @@ int ui_toolbar_create(GtkWidget *vbox) ...@@ -239,7 +260,7 @@ int ui_toolbar_create(GtkWidget *vbox)
G_CALLBACK(ui_callback_on_open_messages), (gpointer) TRUE); G_CALLBACK(ui_callback_on_open_messages), (gpointer) TRUE);
} }
/* Button to save replay file */ /* Button to save messages file */
{ {
ui_main_data.save_replay_file = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE); ui_main_data.save_replay_file = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE);
gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.save_replay_file), "Save messages file"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.save_replay_file), "Save messages file");
...@@ -320,6 +341,7 @@ int ui_toolbar_create(GtkWidget *vbox) ...@@ -320,6 +341,7 @@ int ui_toolbar_create(GtkWidget *vbox)
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.filters_enabled), FALSE, FALSE, LABEL_SPACE); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.filters_enabled), FALSE, FALSE, LABEL_SPACE);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.open_filters_file), FALSE, FALSE, BUTTON_SPACE); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.open_filters_file), FALSE, FALSE, BUTTON_SPACE);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.refresh_filters_file), FALSE, FALSE, BUTTON_SPACE);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.save_filters_file), FALSE, FALSE, BUTTON_SPACE); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.save_filters_file), FALSE, FALSE, BUTTON_SPACE);
gtk_box_pack_start(GTK_BOX(hbox), gtk_separator_new(GTK_ORIENTATION_VERTICAL), FALSE, FALSE, SEPARATOR_SPACE); gtk_box_pack_start(GTK_BOX(hbox), gtk_separator_new(GTK_ORIENTATION_VERTICAL), FALSE, FALSE, SEPARATOR_SPACE);
......
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