Commit 2e6ba401 authored by Kristian Rietveld's avatar Kristian Rietveld Committed by Kristian Rietveld

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.
parent 208f26cb
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
......
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
......
......@@ -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,
......
......@@ -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;
......
......@@ -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)
{
......
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