# HG changeset patch # User Mark Doliner # Date 1145588779 0 # Node ID 5948086807cdb946bba2d1d7ef2ad25c9ccc6e64 # Parent e5c3bfc208a9bb11217ab7fa2057795fb277a811 [gaim-migrate @ 16075] Don't show the current status in the list of popular statuses in the gtkstatusbox and in the system tray committer: Tailor Script diff -r e5c3bfc208a9 -r 5948086807cd src/savedstatuses.c --- a/src/savedstatuses.c Fri Apr 21 02:48:58 2006 +0000 +++ b/src/savedstatuses.c Fri Apr 21 03:06:19 2006 +0000 @@ -684,18 +684,30 @@ GList * gaim_savedstatuses_get_popular(unsigned int how_many) { - GList *truncated = NULL; + GList *popular = NULL; GList *cur; int i; + GaimSavedStatus *current; + + /* We don't want the current status to be in the GList */ + current = gaim_savedstatus_get_current(); /* Copy 'how_many' elements to a new list */ - for (i = 0, cur = saved_statuses; (i < how_many) && (cur != NULL); i++) + i = 0; + cur = saved_statuses; + while ((i < how_many) && (cur != NULL)) { - truncated = g_list_append(truncated, cur->data); + if (cur->data != current) + { + popular = g_list_prepend(popular, cur->data); + i++; + } cur = cur->next; } - return truncated; + popular = g_list_reverse(popular); + + return popular; } GaimSavedStatus * diff -r e5c3bfc208a9 -r 5948086807cd src/savedstatuses.h --- a/src/savedstatuses.h Fri Apr 21 02:48:58 2006 +0000 +++ b/src/savedstatuses.h Fri Apr 21 03:06:19 2006 +0000 @@ -154,7 +154,9 @@ /** * Returns the n most popular saved statuses. "Popularity" is * determined by when the last time a saved_status was used and - * how many times it has been used. + * how many times it has been used. If the current status would + * normally show up in this list, then it is omited and instead + * the "how_many+1" saved status will appear in the list. * * @param how_many The maximum number of saved statuses * to return, or '0' to get all saved