MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17143.26260.182393.468416 at karryall.dnsalias.org> Date: Mon, 8 Aug 2005 16:05:08 +0200 From: Olivier Andrieu To: Yann LE FABLEC Cc: LablGTK Mailing List Subject: Re: How to temporarily disable GTree sorting ? In-Reply-To: <42F74918.4090503 at ath.cena.fr> References: <42F74918.4090503 at ath.cena.fr> Yann LE FABLEC [Monday 8 August 2005] : > > Dear all, > > I am trying to use GTree.view/model in order to display informations as > a list. > Everything works fine except when I use sorting : > 1. First, I create a model + a view, insert my elements in the model > 2. Using set_sort_func & set_sort_column_id I tell the view to allow > the user to sort data in the GTree.view. > 3. Then later I want to display new data in my model/view : I first > detach the model from the view, clear the model and insert my new > elements. > > The problem is that this third step is extremely slow as, as stated > in the Tree View tutorial, the elements are sorted after each > insertion. In this tutorial, one can read that to get rid of that > slowdown problem, one has to "make sure that sorting is disabled while > you are doing your mass insertions". > (See : > http://compiler.kaist.ac.kr/~shoh/ocaml/lablgtk2/treeview-tutorial/ch03s03.html#sec-treestore-adding-many-rows). > > I can't find the way to achieve this. I have searched through this > mailing-list, on Internet, in the GTK+-2.0 C API reference but I was not > able to find how to temporarily disable the tree sorting while I insert > new elements in it. > > Does someone know how to do this ??? Help would be greatly appreciated, Try using #set_sort_column_id (on the list store) with a column id of -2. There are two special values of column ids : GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID = -1, GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID = -2 These should probably appear somewhere in GTree, I'll add them. -- Olivier