GNOME Bugzilla – Bug 466754
creating new category requires restarting
Last modified: 2008-08-31 15:32:54 UTC
When creating new cathegory in the contacts part of evolution, it doesn't appear in the main window in the show selecting menu in the top. Restart is required :( Distribution: Ubuntu 7.04 (feisty) Gnome Release: 2.18.1 2007-04-10 (Ubuntu) BugBuddy Version: 2.18.1
well i checked it out and i found that actually the newly added category is shown but at the end of the list instead of organizing it in alphabetical order. So I suppose that should be changed and that is the real bug.
also see bug 376357
Created attachment 115929 [details] [review] patch i have re-ordered the list of categories so that the after addition of new category, it is displayed at its right alphabetical order.
You're on the right track, but a couple problems with the patch: 1) The strings are UTF-8, so you can't use strcmp(). See g_utf8_collate() [1]. 2) I suspect there's an easier approach. GtkListStores are sortable, so try installing a sort function so that items are sorted automatically as they're added to the store. That way you don't have to fuss with manual reordering. See gtk_tree_sortable_set_sort_func() [2], or one of the other functions on that page for ideas. [1] http://library.gnome.org/devel/glib/unstable/glib-Unicode-Manipulation.html#g-utf8-collate [2] http://library.gnome.org/devel/gtk/unstable/GtkTreeSortable.html#gtk-tree-sortable-set-sort-func
3) Your patch will break as soon as there are 101 categories. Don't use arbitrary limits like that in software: stick to the "Zero-One-Infinity" rule. (http://www.catb.org/jargon/html/Z/Zero-One-Infinity-Rule.html)
Created attachment 116104 [details] [review] much smaller patch i just added the sort function so that any new category added will directly be added in ascending order
Matt, I assume you will approve this.
hey guys, just wanted to ask whether my patch has been approved or not
vignesh, patch attached in comment#6 hasn't been reviewed yet.
All the decl should be at the begining of the function. :-) Can you fix it ? Looks fine otherwise.
Tested and committed with coding style cleanups (revision 9452). Had to dig through GTK+ code to confirm that G_TYPE_STRING columns are sorted with g_utf8_collate() rather than strcmp(). They are, so we're good.