we should only "don't move the cursor, but just select the current node"

2007-10-09  Kristian Rietveld  <kris@imendio.com>

	* gtk/gtktreeview.c (gtk_tree_view_move_cursor_up_down): we should
	only "don't move the cursor, but just select the current node" if the
	cursor node is actually selectable.  (Fixes #483730, reported by
	Geoff Bache).


svn path=/trunk/; revision=18898
This commit is contained in:
Kristian Rietveld 2007-10-09 17:08:18 +00:00 committed by Kristian Rietveld
parent aec8b14fc8
commit 449db79467
2 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2007-10-09 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreeview.c (gtk_tree_view_move_cursor_up_down): we should
only "don't move the cursor, but just select the current node" if the
cursor node is actually selectable. (Fixes #483730, reported by
Geoff Bache).
2007-10-08 Richard Hult <richard@imendio.com> 2007-10-08 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkwindow-quartz.c: (gdk_window_focus): Implement, * gdk/quartz/gdkwindow-quartz.c: (gdk_window_focus): Implement,

View File

@ -9655,6 +9655,7 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
GtkRBNode *new_cursor_node = NULL; GtkRBNode *new_cursor_node = NULL;
GtkTreePath *cursor_path = NULL; GtkTreePath *cursor_path = NULL;
gboolean grab_focus = TRUE; gboolean grab_focus = TRUE;
gboolean selectable;
if (! GTK_WIDGET_HAS_FOCUS (tree_view)) if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return; return;
@ -9667,17 +9668,20 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor); cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
_gtk_tree_view_find_node (tree_view, cursor_path, _gtk_tree_view_find_node (tree_view, cursor_path,
&cursor_tree, &cursor_node); &cursor_tree, &cursor_node);
gtk_tree_path_free (cursor_path);
if (cursor_tree == NULL) if (cursor_tree == NULL)
/* FIXME: we lost the cursor; should we get the first? */ /* FIXME: we lost the cursor; should we get the first? */
return; return;
selection_count = gtk_tree_selection_count_selected_rows (tree_view->priv->selection); selection_count = gtk_tree_selection_count_selected_rows (tree_view->priv->selection);
selectable = _gtk_tree_selection_row_is_selectable (tree_view->priv->selection,
cursor_node,
cursor_path);
if (selection_count == 0 if (selection_count == 0
&& tree_view->priv->selection->type != GTK_SELECTION_NONE && tree_view->priv->selection->type != GTK_SELECTION_NONE
&& !tree_view->priv->ctrl_pressed) && !tree_view->priv->ctrl_pressed
&& selectable)
{ {
/* Don't move the cursor, but just select the current node */ /* Don't move the cursor, but just select the current node */
new_cursor_tree = cursor_tree; new_cursor_tree = cursor_tree;
@ -9693,6 +9697,8 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
&new_cursor_tree, &new_cursor_node); &new_cursor_tree, &new_cursor_node);
} }
gtk_tree_path_free (cursor_path);
if (new_cursor_node) if (new_cursor_node)
{ {
cursor_path = _gtk_tree_view_find_path (tree_view, cursor_path = _gtk_tree_view_find_path (tree_view,