[Gtk-sharp-list] Preventing Dups In a ListStore

Adam Tauno Williams adam at morrison-ind.com
Fri Jan 4 16:54:06 EST 2008


I have a ListStore - 
panelStore = new Gtk.ListStore (typeof (Whitemice.ZOGI.Entity));
 - used to hole a collection of participants.  In the UI the user can
search for additional participants in a dialog which then puts the
selected participants into the list;  all good.  But what is the
simplest / most efficient way to prevent dups in a ListStore?  I don't
want to have the same entity added twice, if it is already there I'd
prefer to just ignore the operation.

Like -

if (!(panelStore.Contains(entity))) panelStore.AppendValues(entity);

 - but, of course, there is no Contains [or equivalent] method in a
ListStore.  And the ListStore doesn't seem to care about storing
multiple references to an object.

Do I need to iterate the contents every time I add an object in order to
prevent dups?  Or is there some kind of short-cut that I'm missing?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20080104/0b1f42b0/attachment.bin 


More information about the Gtk-sharp-list mailing list