summaryrefslogtreecommitdiff
path: root/ui/gtk/packet_panes.c
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2013-07-12 13:56:14 +0000
committerJeff Morriss <jeff.morriss.ws@gmail.com>2013-07-12 13:56:14 +0000
commit605e212c4432cc75ae29a646afd18e547cc33927 (patch)
tree5c92ac4fde01fa41488337eef752840da6e8aa36 /ui/gtk/packet_panes.c
parentc44977663a184ce8cebc82b58b00e2510a794d29 (diff)
downloadwireshark-605e212c4432cc75ae29a646afd18e547cc33927.tar.gz
As suggested by Jakub in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8908#c8 :
When auto-expanding previously-expanded children (r50516), only apply auto-scrolling to the tree the user just expanded (not any of its children which were auto-expanded). Also: only expand children of the just-expanded tree, not all instances of the just-expanded tree. This prevents expanding, for example, one SCTP chunk's tree from expanding all other chunks in the same frame. (Of course moving between frames will cause the chunks' trees to be expanded.) svn path=/trunk/; revision=50535
Diffstat (limited to 'ui/gtk/packet_panes.c')
-rw-r--r--ui/gtk/packet_panes.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/ui/gtk/packet_panes.c b/ui/gtk/packet_panes.c
index b14f2fd20c..9102344ef9 100644
--- a/ui/gtk/packet_panes.c
+++ b/ui/gtk/packet_panes.c
@@ -194,7 +194,7 @@ redraw_packet_bytes_all(void)
}
static void
-check_expand_children(GtkTreeView *tree_view, GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter)
+check_expand_children(GtkTreeView *tree_view, GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gboolean scroll_it)
{
/* code inspired by gtk_tree_model_foreach_helper */
@@ -209,12 +209,12 @@ check_expand_children(GtkTreeView *tree_view, GtkTreeModel *model, GtkTreePath *
if (tree_expanded(fi->tree_type)) {
gtk_tree_view_expand_row(tree_view, path, FALSE);
- if (prefs.gui_auto_scroll_on_expand)
+ if (scroll_it)
gtk_tree_view_scroll_to_cell(tree_view, path, NULL, TRUE, (prefs.gui_auto_scroll_percentage/100.0f), 0.0f);
/* try to expand children only when parent is expanded */
gtk_tree_path_down(path);
- check_expand_children(tree_view, model, path, &child);
+ check_expand_children(tree_view, model, path, &child, scroll_it);
gtk_tree_path_up(path);
} else
@@ -227,7 +227,7 @@ check_expand_children(GtkTreeView *tree_view, GtkTreeModel *model, GtkTreePath *
static void
expand_tree(GtkTreeView *tree_view, GtkTreeIter *iter,
- GtkTreePath *path _U_, gpointer user_data _U_)
+ GtkTreePath *path, gpointer user_data _U_)
{
field_info *finfo;
GtkTreeModel *model;
@@ -250,7 +250,9 @@ expand_tree(GtkTreeView *tree_view, GtkTreeIter *iter,
tree_expanded_set(finfo->tree_type, TRUE);
/* Expand any subtrees that the user had left open */
- check_expand_children(tree_view, model, path, iter);
+ /* But only do this for subtrees of the just-expanded tree */
+ gtk_tree_path_down(path);
+ check_expand_children(tree_view, model, path, iter, FALSE);
}
}
@@ -1414,7 +1416,8 @@ proto_tree_draw_resolve(proto_tree *protocol_tree, GtkWidget *tree_view, const e
/* modified version of gtk_tree_model_foreach */
path = gtk_tree_path_new_first();
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path))
- check_expand_children(GTK_TREE_VIEW(tree_view), GTK_TREE_MODEL(model), path, &iter);
+ check_expand_children(GTK_TREE_VIEW(tree_view), GTK_TREE_MODEL(model),
+ path, &iter, prefs.gui_auto_scroll_on_expand);
gtk_tree_path_free(path);
g_signal_handlers_unblock_by_func(tree_view, expand_tree, NULL);