]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktreeselection.c
spinbutton: don't override initial text in non-numeric-only spin buttons
[~andy/gtk] / gtk / gtktreeselection.c
index d655ad356775c803e39c4ade912b7152ac9039f3..10c9cd717a6908cf686251f22bd0ee58fb1e49d4 100644 (file)
@@ -12,9 +12,7 @@
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
@@ -25,6 +23,7 @@
 #include "gtkmarshalers.h"
 #include "gtkintl.h"
 #include "gtktypebuiltins.h"
+#include "a11y/gtktreeviewaccessibleprivate.h"
 
 
 /**
@@ -55,7 +54,7 @@
  *
  * One of the important things to remember when monitoring the selection of
  * a view is that the #GtkTreeSelection::changed signal is mostly a hint.
- * That is,it may only emit one signal when a range of rows is selected.
+ * That is, it may only emit one signal when a range of rows is selected.
  * Additionally, it may on occasion emit a #GtkTreeSelection::changed signal
  * when nothing has happened (mostly as a result of programmers calling
  * select_row on an already selected row).
@@ -554,8 +553,7 @@ gtk_tree_selection_get_selected (GtkTreeSelection  *selection,
  *
  * To free the return value, use:
  * |[
- * g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
  * ]|
  *
  * Return value: (element-type GtkTreePath) (transfer full): A #GList containing a #GtkTreePath for each selected row.
@@ -1630,14 +1628,23 @@ 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 (priv->tree_view, tree, node);
+      path = _gtk_tree_path_new_from_rbtree (tree, node);
       toggle = _gtk_tree_selection_row_is_selectable (selection, node, path);
       gtk_tree_path_free (path);
     }
 
   if (toggle)
     {
-      node->flags ^= GTK_RBNODE_IS_SELECTED;
+      if (!GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
+        {
+          GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_SELECTED);
+          _gtk_tree_view_accessible_add_state (priv->tree_view, tree, node, GTK_CELL_RENDERER_SELECTED);
+        }
+      else
+        {
+          GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_IS_SELECTED);
+          _gtk_tree_view_accessible_remove_state (priv->tree_view, tree, node, GTK_CELL_RENDERER_SELECTED);
+        }
 
       _gtk_tree_view_queue_draw_node (priv->tree_view, tree, node, NULL);