| 112 static void blist_show(PurpleBuddyList *list); |
112 static void blist_show(PurpleBuddyList *list); |
| 113 static void update_buddy_display(PurpleBuddy *buddy, FinchBlist *ggblist); |
113 static void update_buddy_display(PurpleBuddy *buddy, FinchBlist *ggblist); |
| 114 static void account_signed_on_cb(void); |
114 static void account_signed_on_cb(void); |
| 115 |
115 |
| 116 /* Sort functions */ |
116 /* Sort functions */ |
| |
117 static int blist_node_compare_position(PurpleBlistNode *n1, PurpleBlistNode *n2); |
| 117 static int blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2); |
118 static int blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2); |
| 118 static int blist_node_compare_status(PurpleBlistNode *n1, PurpleBlistNode *n2); |
119 static int blist_node_compare_status(PurpleBlistNode *n1, PurpleBlistNode *n2); |
| 119 static int blist_node_compare_log(PurpleBlistNode *n1, PurpleBlistNode *n2); |
120 static int blist_node_compare_log(PurpleBlistNode *n1, PurpleBlistNode *n2); |
| 120 |
121 |
| 121 static gboolean |
122 static gboolean |
| 1776 g_signal_handlers_unblock_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC, |
1777 g_signal_handlers_unblock_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC, |
| 1777 0, 0, NULL, status_text_changed, NULL); |
1778 0, 0, NULL, status_text_changed, NULL); |
| 1778 } |
1779 } |
| 1779 |
1780 |
| 1780 static int |
1781 static int |
| |
1782 blist_node_compare_position(PurpleBlistNode *n1, PurpleBlistNode *n2) |
| |
1783 { |
| |
1784 while ((n1 = n1->prev) != NULL) |
| |
1785 if (n1 == n2) |
| |
1786 return 1; |
| |
1787 return -1; |
| |
1788 } |
| |
1789 |
| |
1790 static int |
| 1781 blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2) |
1791 blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2) |
| 1782 { |
1792 { |
| 1783 const char *s1, *s2; |
1793 const char *s1, *s2; |
| 1784 char *us1, *us2; |
1794 char *us1, *us2; |
| 1785 int ret; |
1795 int ret; |
| 1786 |
1796 |
| 1787 g_return_val_if_fail(n1->type == n2->type, -1); |
1797 g_return_val_if_fail(n1->type == n2->type, -1); |
| 1788 |
1798 |
| 1789 switch (n1->type) |
1799 switch (n1->type) |
| 1790 { |
1800 { |
| 1791 case PURPLE_BLIST_GROUP_NODE: |
|
| 1792 s1 = ((PurpleGroup*)n1)->name; |
|
| 1793 s2 = ((PurpleGroup*)n2)->name; |
|
| 1794 break; |
|
| 1795 case PURPLE_BLIST_CHAT_NODE: |
1801 case PURPLE_BLIST_CHAT_NODE: |
| 1796 s1 = purple_chat_get_name((PurpleChat*)n1); |
1802 s1 = purple_chat_get_name((PurpleChat*)n1); |
| 1797 s2 = purple_chat_get_name((PurpleChat*)n2); |
1803 s2 = purple_chat_get_name((PurpleChat*)n2); |
| 1798 break; |
1804 break; |
| 1799 case PURPLE_BLIST_BUDDY_NODE: |
1805 case PURPLE_BLIST_BUDDY_NODE: |
| 1803 case PURPLE_BLIST_CONTACT_NODE: |
1809 case PURPLE_BLIST_CONTACT_NODE: |
| 1804 s1 = purple_contact_get_alias((PurpleContact*)n1); |
1810 s1 = purple_contact_get_alias((PurpleContact*)n1); |
| 1805 s2 = purple_contact_get_alias((PurpleContact*)n2); |
1811 s2 = purple_contact_get_alias((PurpleContact*)n2); |
| 1806 break; |
1812 break; |
| 1807 default: |
1813 default: |
| 1808 return -1; |
1814 return blist_node_compare_position(n1, n2); |
| 1809 } |
1815 } |
| 1810 |
1816 |
| 1811 us1 = g_utf8_strup(s1, -1); |
1817 us1 = g_utf8_strup(s1, -1); |
| 1812 us2 = g_utf8_strup(s2, -1); |
1818 us2 = g_utf8_strup(s2, -1); |
| 1813 ret = g_utf8_collate(us1, us2); |
1819 ret = g_utf8_collate(us1, us2); |