On 10/21/05, Christian Neumair <[EMAIL PROTECTED]> wrote: > > Am Donnerstag, den 20.10.2005, 19:06 +0800 schrieb searun: > > Hi , > > > > Now i want to use GtkTreeSortable to sort a list. The first entry in the > > gtk_tree_view is an information entry which needn't to be sorted, so i > don't > > want the GtkTreeIterCompareFunc function use the first entry. In my > programe > > i check GtkTreeIter, if it is the same as the first iter, the > > GtkTreeIterCompareFunc will return 0. > > BUT it can't work. After two day's debug, i can't find the reason. > > > > Any help is appreciated, even if you have another good method. > > Returning 0 is wrong here, because it denotes that both elements are > equal, and no sorting will take place for this element. Rather use:
Yes, when the information in the first entry at frist, so when sorting contain the information entry is useless, that's why i use "return 0;". > static int > my_cmp_func (GtkTreeModel *model, > GtkTreeIter *a, > GtkTreeIter *b, > MyType *first_element) > { > MyType *element_a, *element_b; > > gtk_tree_model_get (model, a, MY_ELEMENT_COLUMN, &element_a, NULL); > gtk_tree_model_get (model, b, MY_ELEMENT_COLUMN, &element_b, NULL); > > if (element_a == element_b) { > return 0; > } > > if (element_a == first_element) { > return -1; > } > > if (element_b == first_element) { > return 1; > } Now i use this method, but in the first time sort it can work good, but in the second time sort, it will be no order. I can't find why. /* other sorting */ > } > > -- > Christian Neumair <[EMAIL PROTECTED]> > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list