After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 466754 - creating new category requires restarting
creating new category requires restarting
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: general
2.10.x (obsolete)
Other All
: Normal normal
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2007-08-14 20:33 UTC by Michal Pěnka
Modified: 2008-08-31 15:32 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
patch (1.30 KB, patch)
2008-08-05 19:44 UTC, vignesh prabhu
needs-work Details | Review
much smaller patch (517 bytes, patch)
2008-08-07 22:18 UTC, vignesh prabhu
committed Details | Review

Description Michal Pěnka 2007-08-14 20:33:33 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
Comment 1 vignesh prabhu 2008-06-19 20:55:54 UTC
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.
Comment 2 Akhil Laddha 2008-06-24 06:41:34 UTC
also see bug 376357
Comment 3 vignesh prabhu 2008-08-05 19:44:53 UTC
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.
Comment 4 Matthew Barnes 2008-08-05 20:02:45 UTC
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
Comment 5 Matthew Barnes 2008-08-05 20:06:24 UTC
  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)
Comment 6 vignesh prabhu 2008-08-07 22:18:02 UTC
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
Comment 7 Srinivasa Ragavan 2008-08-11 05:01:58 UTC
Matt, I assume you will approve this.
Comment 8 vignesh prabhu 2008-08-22 09:26:31 UTC
hey guys, just wanted to ask whether my patch has been approved or not
Comment 9 Akhil Laddha 2008-08-22 10:17:46 UTC
vignesh, patch attached in comment#6 hasn't been reviewed yet.
Comment 10 Srinivasa Ragavan 2008-08-31 13:26:40 UTC
All the decl should be at the begining of the function. :-) Can you fix it ? Looks fine otherwise.
Comment 11 Matthew Barnes 2008-08-31 15:32:54 UTC
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.