1 --- gtk+-2.6.4/gtk/gtktreeselection.c 2004-11-20 01:18:38.000000000 +0200
2 +++ gtk+-2.6.4/gtk/gtktreeselection.c 2005-04-06 16:19:38.186733096 +0300
6 GtkTreeSelectionFunc tmp_func;
8 g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
10 if (selection->type == type)
13 + /* Hildon addition */
14 + if ((type == GTK_SELECTION_SINGLE) &&
15 + (selection->type == GTK_SELECTION_MULTIPLE ||
16 + selection->type == GTK_SELECTION_BROWSE))
18 + GtkTreePath *cursor_path;
20 + /* to successfully switch from multiple selection mode to single
21 + selection, we must ensure that anchor exists and is selected
22 + since otherwise gtk_tree_selection_select_path won't work anymore */
23 + if (gtk_tree_row_reference_valid (selection->tree_view->priv->cursor))
25 + cursor_path = gtk_tree_row_reference_get_path (selection->tree_view->priv->cursor); gtk_tree_selection_select_path (selection, cursor_path);
26 + gtk_tree_path_free (cursor_path);
30 if (type == GTK_SELECTION_NONE)
35 selection->type = type;
37 + /* Hildon addition */
38 + if (type == GTK_SELECTION_SINGLE)
43 + /* reset cursor to the selected row */
44 + gtk_tree_selection_get_selected (selection, NULL, &iter);
45 + path = gtk_tree_model_get_path (selection->tree_view->priv->model,
47 + gtk_tree_view_set_cursor (selection->tree_view, path, NULL, FALSE);
48 + gtk_tree_path_free (path);
53 @@ -1319,10 +1350,10 @@
58 -row_is_selectable (GtkTreeSelection *selection,
62 +_gtk_tree_selection_is_row_selectable (GtkTreeSelection *selection,
70 /* We only want to select the new node if we can unselect the old one,
71 * and we can select the new one. */
72 - dirty = row_is_selectable (selection, node, path);
73 + dirty = _gtk_tree_selection_is_row_selectable (selection, node, path);
75 /* if dirty is FALSE, we weren't able to select the new one, otherwise, we try to
76 * unselect the new one
77 @@ -1528,8 +1559,13 @@
78 if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED) != select)
80 path = _gtk_tree_view_find_path (selection->tree_view, tree, node);
81 - selected = row_is_selectable (selection, node, path);
82 + selected = _gtk_tree_selection_is_row_selectable (selection, node, path);
83 gtk_tree_path_free (path);
85 + /* if row is unselectable, allow unselection only */
86 + if (!selected && !select &&
87 + GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))