summaryrefslogtreecommitdiff
path: root/gtk/gtktreeselection.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@imendio.com>2006-03-01 12:18:57 +0000
committerKristian Rietveld <kristian@src.gnome.org>2006-03-01 12:18:57 +0000
commit2e6ba401cc22f25cf97245ef3bd8ec832617770a (patch)
tree0a4f781d6bb86778152f7993b4e6bb03e646ac57 /gtk/gtktreeselection.c
parent208f26cbf91f39b3f96ead93fb3d75150c89e056 (diff)
downloadgtk+-2e6ba401cc22f25cf97245ef3bd8ec832617770a.tar.gz
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.
Diffstat (limited to 'gtk/gtktreeselection.c')
-rw-r--r--gtk/gtktreeselection.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c
index 90a0dac174..1ced62de68 100644
--- a/gtk/gtktreeselection.c
+++ b/gtk/gtktreeselection.c
@@ -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;