From ff2c56abf52de6cd25dcb450ebfa195ba33c8b1b Mon Sep 17 00:00:00 2001 From: winckel <winckel@eurecom.fr> Date: Thu, 14 Nov 2013 20:47:23 +0000 Subject: [PATCH] Recenter messages list view on slected message after filters button changes. git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4409 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- .../utils/itti_analyzer/libui/ui_callbacks.c | 24 ++++++++++++------- .../utils/itti_analyzer/libui/ui_callbacks.h | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/common/utils/itti_analyzer/libui/ui_callbacks.c b/common/utils/itti_analyzer/libui/ui_callbacks.c index c54766030d..4693ab570b 100644 --- a/common/utils/itti_analyzer/libui/ui_callbacks.c +++ b/common/utils/itti_analyzer/libui/ui_callbacks.c @@ -50,12 +50,12 @@ gboolean ui_callback_on_save_messages(GtkWidget *widget, gpointer data) return TRUE; } -gboolean ui_callback_on_filters_enabled(GtkWidget *widget, gpointer data) +gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data) { gboolean enabled; gboolean changed; - enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(widget)); + enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(button)); g_message("Filters enabled event occurred %d", enabled); @@ -63,19 +63,27 @@ gboolean ui_callback_on_filters_enabled(GtkWidget *widget, gpointer data) if (changed) { - /* Set the tooltip text */ + /* Set the tool tip text */ if (enabled) { - gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(widget), "Disable messages filtering"); - } - else + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), "Disable messages filtering"); + } else { - gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(widget), "Enable messages filtering"); + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), "Enable messages filtering"); } ui_tree_view_refilter(); + + if (ui_main_data.signalslist != NULL) + { + GtkTreePath *path_row; + + /* Select the message in requested row */ + gtk_tree_view_get_cursor(GTK_TREE_VIEW(ui_main_data.signalslist), &path_row, NULL); + /* Center the message in the middle of the list if possible */ + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(ui_main_data.signalslist), path_row, NULL, TRUE, 0.5, 0.0); + } } - // CHECK_FCT(ui_filters_open_file_chooser()); return TRUE; } diff --git a/common/utils/itti_analyzer/libui/ui_callbacks.h b/common/utils/itti_analyzer/libui/ui_callbacks.h index 2a087fc213..6f111c3861 100644 --- a/common/utils/itti_analyzer/libui/ui_callbacks.h +++ b/common/utils/itti_analyzer/libui/ui_callbacks.h @@ -9,7 +9,7 @@ gboolean ui_callback_on_open_messages(GtkWidget *widget, gboolean ui_callback_on_save_messages(GtkWidget *widget, gpointer data); -gboolean ui_callback_on_filters_enabled(GtkWidget *widget, +gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data); gboolean ui_callback_on_open_filters(GtkWidget *widget, -- GitLab