Patch [Re: GTK SELECTION BROWSE question]



On Wed, 1 Mar 2000, Nicolas GEORGE wrote:

> Jamie Guinan, dans le message (.gtk.general:1994), a écrit :
> >   $./testgtk
> >   Click "list" button.
> >     Set "Selection Mode" to "Browse"
> >     Click "Clear List"       (list is emptied)
> >     Click "Insert Row"       (first item is selected)
> >     Click "Insert Row"       (first item still selected)
> >     Click "Insert Row"       (first item still selected)
> >     Click "Remove Selection" (first item removed, but no item selected!)
> >     Click "Remove Selection" (nothing happens, because there is no
> >                               item selected...)
> 
> This is exactly the same with 1.2.3, but, if you do:
> Set "Selection Mode" to "Browse"
> Click "Clear List"	(list is emptied)
> Click "Insert Row"	(first item is selected)
> Click "Insert Row"	(first item still selected)
> Click "Insert Row"	(first item still selected)
> _Click on first item_	(first item stays selected)
> Click "Remove Selection"
> 
> This time, it works correctly. So I think it's a bug in
> gtk_list_remove_items (and not in the doc, phew!).

Yes, 1.3 works the same way.  I think the behavior hasn't
changed across versions.  But I still claim its broken
because it *requires* the user to click on a list item
in order for the "one item always selected" notion to be
true.  Nothing wrong with the docs, I just want to code
to obey them.

Again, I have a one-liner to correct this behavior in
gtklist.c:gtk_list_insert_items(),

  if (list->children && !list->selection &&
      (list->selection_mode == GTK_SELECTION_BROWSE))
    {
      widget = list->children->data;
      gtk_list_select_child (list, widget);
>>>   list->last_focus_child = widget; <<<<<<<<<
    }

I don't think this breaks anything, unless there is some
subtle dependency on last_focus_child being set or not-set
somewhere (I couldn't find any myself).

-Jamie



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]