| 682 } |
682 } |
| 683 |
683 |
| 684 GList * |
684 GList * |
| 685 gaim_savedstatuses_get_popular(unsigned int how_many) |
685 gaim_savedstatuses_get_popular(unsigned int how_many) |
| 686 { |
686 { |
| 687 GList *truncated = NULL; |
687 GList *popular = NULL; |
| 688 GList *cur; |
688 GList *cur; |
| 689 int i; |
689 int i; |
| |
690 GaimSavedStatus *current; |
| |
691 |
| |
692 /* We don't want the current status to be in the GList */ |
| |
693 current = gaim_savedstatus_get_current(); |
| 690 |
694 |
| 691 /* Copy 'how_many' elements to a new list */ |
695 /* Copy 'how_many' elements to a new list */ |
| 692 for (i = 0, cur = saved_statuses; (i < how_many) && (cur != NULL); i++) |
696 i = 0; |
| 693 { |
697 cur = saved_statuses; |
| 694 truncated = g_list_append(truncated, cur->data); |
698 while ((i < how_many) && (cur != NULL)) |
| |
699 { |
| |
700 if (cur->data != current) |
| |
701 { |
| |
702 popular = g_list_prepend(popular, cur->data); |
| |
703 i++; |
| |
704 } |
| 695 cur = cur->next; |
705 cur = cur->next; |
| 696 } |
706 } |
| 697 |
707 |
| 698 return truncated; |
708 popular = g_list_reverse(popular); |
| |
709 |
| |
710 return popular; |
| 699 } |
711 } |
| 700 |
712 |
| 701 GaimSavedStatus * |
713 GaimSavedStatus * |
| 702 gaim_savedstatus_get_startup() |
714 gaim_savedstatus_get_startup() |
| 703 { |
715 { |