After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 59377 - gtk_tree_selection_unselect_iter () actually doesn't unselect the specifiediterator.
gtk_tree_selection_unselect_iter () actually doesn't unselect the specifiedit...
Status: RESOLVED DUPLICATE of bug 50054
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
1.3.x
Other All
: Normal normal
: ---
Assigned To: Jonathan Blandford
Jonathan Blandford
Depends on:
Blocks:
 
 
Reported: 2001-08-22 16:34 UTC by Alexey A. Malyshev
Modified: 2011-02-04 16:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alexey A. Malyshev 2001-08-22 16:34:40 UTC
gtk_tree_selection_unselect_iter () actually doesn't unselect the specified
iterator. 

Test case:
#include <gtk/gtk.h>

int
main (int argc, char** argv)
{

GtkWidget *tree_view;
GtkTreeStore *tree_store;
GtkTreeSelection *selection;
GtkTreePath *path;
GtkTreeIter iter;
GtkTreeIter child_iter;
gboolean val;
gint indices[] = {5,7,3};
guint i;
guint j;
gboolean result;


gtk_init (&argc, &argv);


tree_store = gtk_tree_store_new (1,G_TYPE_INT);
path = gtk_tree_path_new_from_string ("5:7:3");
for (i = 0; i < 3; i++)
{
    for (j = 0; j <= indices[i]; j++)
    {
        if (i == 0)
        {
            gtk_tree_store_append (tree_store, &iter, NULL);
        } else {
            gtk_tree_store_append (tree_store, &child_iter, &iter);
        }
    }
    if (i != 0)
    {
        iter = child_iter;
    }
}

tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (tree_store));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));

gtk_tree_selection_set_mode (GTK_TREE_SELECTION
(selection),GTK_TREE_SELECTION_SINGLE);

result = gtk_tree_selection_get_selected (selection,NULL,NULL);
printf ("result = %d\n",result);

gtk_tree_selection_unselect_iter (selection,&iter);

printf ("\n gtk_tree_selection_unselect_iter() is called\n");

result = gtk_tree_selection_get_selected (selection,NULL,NULL);
printf ("result = %d\n",result);
}

Output of the compiled code:

result = 0
gtk_tree_selection_unselect_iter() is called
result = 1
Comment 1 Jonathan Blandford 2001-10-01 19:13:28 UTC
One problem with the current design of the tree is that you cannot
select rows that aren't currently on the screen.  In this case, you
are selecting a child before you have expanded to that point.  It
would be nice to be able to cache this information, but that's too big
a change to the tree right now.

*** This bug has been marked as a duplicate of 50054 ***