I was originally using pygtk2 when I came across this behavior. I'm now digging through/instrumenting the GtkTreeSelection code to try and figure out why it initially has a node selected internally, but not completely enough that unselect_all will clear it. It is kinda slow going because the code is pretty complicated and cross-linked between the various things at the implementation level (as it would be). I'm hoping to be able to isolate the problem so that I can come up with an initial patch so, as Havoc pointed out, the developers who are facing loads and loads of bugs don't have to track this one down as well. Hopefully, I'll have better luck tomorrow than this afternoon. :) On Sat, 2003-01-25 at 16:57, Mark Jones wrote: > I just wanted to say that I have seen this same behavior in gtkmm. So I > guess it is the underlying gtk object at "fault". If "fault" > appropriate. > > I had not reported it yet though as I had put that program aside for > something of higher priority and did not have time to examine whether I > was doing something incorrect or not. I am seeing it in a drum machine > program I started writing, where I have a list of all the samples > available, and when you click on one you can hear a preview. Well when > you click on one for the first time, it also plays the one at the top of > the list (position 0) as well as the one you have clicked on. > > I'm curious to know the solution to this too. Because doing something > tricky in code (like a static variable that tells your signal handler > whether it has been called before or not to avoid doing anything the > first time through) seems like a work around. > > On Sat, 2003-01-25 at 12:01, gtk-list-request gnome org wrote: > > > Message: 3 > > Subject: Bug in tree selection behavior? > > From: "Andrew S. Townley" <atownley eircom net> > > To: gtk-list gnome org > > Organization: > > Date: 25 Jan 2003 14:47:32 +0000 > > > > > > --=-W71rs5jsRUEybKJ0Ca+a > > Content-Type: text/plain > > Content-Transfer-Encoding: quoted-printable > > > > Hi. I've just built the following from CVS/HEAD: esound, gnome-xml, > > libxslt, gtk-doc, glib, gob, linc, atk, gnome-common, pango, libIDL, > > ORBit2, intltool, bonobo-activation and gtk+ so that I can see if the > > behavior has been changed. It hasn't changed from the version that > > comes stock with RedHat 8, so I'm wondering if anyone else things the > > following is a bug. > > > > PROBLEM: selection changed signal handler called twice during initial > > tree selection. > > > > I added the following to testtreeview.c to see what the current behavior > > was: > > > > diff -r1.33 testtreeview.c > > 4c4 > > <=20 > > --- > > > #include <stdio.h> > > 599a600,614 > > > static void > > > sel_foreach (GtkTreeModel *model, GtkTreePath *path,=20 > > > GtkTreeIter *iter, gpointer data) > > > { > > > gchar* s =3D gtk_tree_model_get_string_from_iter(model, iter); > > > printf ("iter =3D '%s'\n", s); > > > g_free (s); > > > } > > >=20 > > > static void > > > selection_changed (GtkTreeSelection *treeselection, gpointer data) > > > { > > > gtk_tree_selection_selected_foreach(treeselection, > > > sel_foreach, NULL); > > > } > > 621a637 > > > GtkTreeSelection *sel; > > 760c776,781 > > < =20 > > --- > > > =20 > > > sel =3D gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); > > > g_signal_connect (sel,=20 > > > "changed",=20 > > > G_CALLBACK (selection_changed), > > > tv); > > > > Basically, it just prints the selection path each time the "changed" > > signal is fired. However, when running this program and selecting row 6 > > followed by row 4, I get the following output: > > > > linna$ ./testtreeview > > Running automated tests... > > Passed. > > iter =3D '0' > > iter =3D '6' > > iter =3D '4' > > > > Since there are no rows visibly selected in the tree view, I would > > expect the changed signal to be fired exactly twice, but it is *always* > > fired for row 0 with the first selection in the tree. This makes it > > very difficult to write handlers for selection events when you actually > > want some sort of processing to occur with the data in a specific row. > > > > If other people think this is a bug, I'll enter it in bugzilla. > > > > Thanks in advance for any comments/information, > > > > _______________________________________________ > gtk-list mailing list > gtk-list gnome org > http://mail.gnome.org/mailman/listinfo/gtk-list -- Andrew S. Townley <atownley eircom net>
Attachment:
signature.asc
Description: This is a digitally signed message part