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 143270 - GtkTreeView selection may be wrong on first display
GtkTreeView selection may be wrong on first display
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
: 145579 150614 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-05-27 09:43 UTC by Jean Bréfort
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A Patch to correct the problem. (896 bytes, patch)
2004-06-25 11:15 UTC, Shlomi Fish
none Details | Review
An updated Patch based on mclasen's commentary (1.29 KB, patch)
2004-06-25 19:57 UTC, Shlomi Fish
none Details | Review

Description Jean Bréfort 2004-05-27 09:43:43 UTC
Select a row with gtk_selection_select_iter, then show the GtkTreeView. If it
has the focus when displayed, the fisrt row is selected whatever you selected
before.
To make things work correctly, you need call gtk_tree_view_set_cursor before
displaying the tree.
I could track the problem in gtk_tree_view_focus_to_cursor:

  if (cursor_path == NULL)
    {
      cursor_path = gtk_tree_path_new_first ();

I suggestit would be better to search if something is selected using
gtk_tree_selection_get_selected before defaulting to the firs row.
Comment 1 Michael Natterer 2004-06-25 10:06:19 UTC
Confirmed. Also affects GIMP in several places.
Comment 2 Shlomi Fish 2004-06-25 11:15:36 UTC
Created attachment 29001 [details] [review]
A Patch to correct the problem.

This is a patch to correct the problem, made against gtk+-2.4.3.
Comment 3 Matthias Clasen 2004-06-25 17:20:59 UTC
As mentioned on IRC, gtk_tree_selection_get_selected() is documented to not work
in MULTIPLE mode.
Comment 4 Shlomi Fish 2004-06-25 19:57:04 UTC
Created attachment 29012 [details] [review]
An updated Patch based on mclasen's commentary

Thanks to Matthias Clasen, a problem with the patch was corrected and
integrated into this new patch. He and other developers helped me on the IRC in
choosing the right API routines.
Comment 5 Matthias Clasen 2004-07-08 02:43:55 UTC
*** Bug 145579 has been marked as a duplicate of this bug. ***
Comment 6 Matthias Clasen 2004-09-14 19:38:08 UTC
2004-09-14  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtktreeview.c (gtk_tree_view_focus_to_cursor): Set the cursor
	to the first selected row instead of always to the first row if there
	is no cursor.  (#143270, Jean Bréfort)


Comment 7 Matthias Clasen 2004-09-14 19:38:40 UTC
*** Bug 150614 has been marked as a duplicate of this bug. ***