rename to _gtk_tree_selection_row_is_selectable and export internally,

2006-03-01  Kristian Rietveld  <kris@imendio.com>

	* gtk/gtktreeselection.c (row_is_selectable): rename to
	_gtk_tree_selection_row_is_selectable and export internally,
	(gtk_tree_selection_real_select_node): changed so it is always
	possible to unselect insensitive nodes, changed the logic a bit to
	be more clear.

	* gtk/gtktreeprivate.h: add _gtk_tree_selection_row_is_selectable.

	* gtk/gtktreeview.c (gtk_tree_view_row_changed): Unselect a row if
	it became insensitive.
This commit is contained in:
Kristian Rietveld 2006-03-01 12:18:57 +00:00 committed by Kristian Rietveld
parent 208f26cbf9
commit 2e6ba401cc
5 changed files with 45 additions and 8 deletions

View File

@ -1,3 +1,16 @@
2006-03-01 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreeselection.c (row_is_selectable): rename to
_gtk_tree_selection_row_is_selectable and export internally,
(gtk_tree_selection_real_select_node): changed so it is always
possible to unselect insensitive nodes, changed the logic a bit to
be more clear.
* gtk/gtktreeprivate.h: add _gtk_tree_selection_row_is_selectable.
* gtk/gtktreeview.c (gtk_tree_view_row_changed): Unselect a row if
it became insensitive.
2006-02-27 Federico Mena Quintero <federico@novell.com>
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Check that

View File

@ -1,3 +1,16 @@
2006-03-01 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreeselection.c (row_is_selectable): rename to
_gtk_tree_selection_row_is_selectable and export internally,
(gtk_tree_selection_real_select_node): changed so it is always
possible to unselect insensitive nodes, changed the logic a bit to
be more clear.
* gtk/gtktreeprivate.h: add _gtk_tree_selection_row_is_selectable.
* gtk/gtktreeview.c (gtk_tree_view_row_changed): Unselect a row if
it became insensitive.
2006-02-27 Federico Mena Quintero <federico@novell.com>
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Check that

View File

@ -366,6 +366,9 @@ GtkTreeSelection* _gtk_tree_selection_new (void);
GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view);
void _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection,
GtkTreeView *tree_view);
gboolean _gtk_tree_selection_row_is_selectable (GtkTreeSelection *selection,
GtkRBNode *node,
GtkTreePath *path);
void _gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column,
GdkWindow *window,

View File

@ -1294,10 +1294,10 @@ tree_column_is_sensitive (GtkTreeViewColumn *column,
return sensitive;
}
static gboolean
row_is_selectable (GtkTreeSelection *selection,
GtkRBNode *node,
GtkTreePath *path)
gboolean
_gtk_tree_selection_row_is_selectable (GtkTreeSelection *selection,
GtkRBNode *node,
GtkTreePath *path)
{
GList *list;
GtkTreeIter iter;
@ -1386,7 +1386,7 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
{
/* We only want to select the new node if we can unselect the old one,
* and we can select the new one. */
dirty = row_is_selectable (selection, node, path);
dirty = _gtk_tree_selection_row_is_selectable (selection, node, path);
/* if dirty is FALSE, we weren't able to select the new one, otherwise, we try to
* unselect the new one
@ -1502,7 +1502,7 @@ gtk_tree_selection_real_select_node (GtkTreeSelection *selection,
GtkRBNode *node,
gboolean select)
{
gboolean selected = FALSE;
gboolean toggle = FALSE;
GtkTreePath *path = NULL;
select = !! select;
@ -1510,11 +1510,14 @@ gtk_tree_selection_real_select_node (GtkTreeSelection *selection,
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED) != select)
{
path = _gtk_tree_view_find_path (selection->tree_view, tree, node);
selected = row_is_selectable (selection, node, path);
if (!select)
toggle = TRUE;
else
toggle = _gtk_tree_selection_row_is_selectable (selection, node, path);
gtk_tree_path_free (path);
}
if (selected == TRUE)
if (toggle)
{
node->flags ^= GTK_RBNODE_IS_SELECTED;

View File

@ -7238,6 +7238,11 @@ gtk_tree_view_row_changed (GtkTreeModel *model,
if (tree == NULL)
goto done;
/* Check if the node became insensitive, and if so, unselect it */
if (!_gtk_tree_selection_row_is_selectable (tree_view->priv->selection,
node, path))
gtk_tree_selection_unselect_path (tree_view->priv->selection, path);
if (tree_view->priv->fixed_height_mode
&& tree_view->priv->fixed_height >= 0)
{