From: <the...@us...> - 2006-04-21 03:06:30
|
Revision: 16075 Author: thekingant Date: 2006-04-20 20:06:19 -0700 (Thu, 20 Apr 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16075&view=rev Log Message: ----------- Don't show the current status in the list of popular statuses in the gtkstatusbox and in the system tray Modified Paths: -------------- trunk/src/savedstatuses.c trunk/src/savedstatuses.h Modified: trunk/src/savedstatuses.c =================================================================== --- trunk/src/savedstatuses.c 2006-04-21 02:48:58 UTC (rev 16074) +++ trunk/src/savedstatuses.c 2006-04-21 03:06:19 UTC (rev 16075) @@ -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 * Modified: trunk/src/savedstatuses.h =================================================================== --- trunk/src/savedstatuses.h 2006-04-21 02:48:58 UTC (rev 16074) +++ trunk/src/savedstatuses.h 2006-04-21 03:06:19 UTC (rev 16075) @@ -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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |