Gtk::TreeView -- avoid selection change signal



Hello!

There is a Gtk::TreeView which gets periodically updated using the
following procedure:

1. delete the contents of the associated Gtk::ListStore
2. fill the associated Gtk::ListStore with new rows


The signal_changed() of the selection of this Gtk::TreeView is
connected to a handling method (which displays a dialog with the
details of the selected item).

The problem is the following:
After the above described updating procedure the signal_changed() is
emitted, and the first row of the list gets automatically selected
(thus if a dialog is being displayed, and the user closes it, they
will immediately get another dialog detailing the very first entry).

The possible solutions I have already tried are the following:
- unselecting the selected item before showing the dialog (I have
tried two possibilities: TreeSelection::unselect_all() and
TreeSelection::unselect(iterator), where iterator points to the
previously selected item) -- this does not solve the problem however
- not deleting the contents of the TreeView --> in this way the change
signal is not emitted again, but this solution is not usable, as my
list will be growing continuously
- disconnecting the selection changed signal before clearing the list
and adding items, and reconnecting it afterwards -- this did not solve
the problem either

I think the most usable solution would be something near the first
one, so the question is, how to properly tell a TreeView that its
previously selected item is not selected any more?

Regards,

Andras


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