Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/roster.c @ 2293:038b864b44c6
Use g_hash_table_get_keys() because glib >=2.14 should be available everywhere
author | franky |
---|---|
date | Tue, 01 Nov 2016 21:42:40 +0100 |
parents | f181418db215 |
children | def5f64c253d |
comparison
equal
deleted
inserted
replaced
2292:f181418db215 | 2293:038b864b44c6 |
---|---|
1760 if (!unread_jids) | 1760 if (!unread_jids) |
1761 return FALSE; | 1761 return FALSE; |
1762 return g_hash_table_remove(unread_jids, jid); | 1762 return g_hash_table_remove(unread_jids, jid); |
1763 } | 1763 } |
1764 | 1764 |
1765 // Helper function for unread_jid_get_list() | |
1766 static void add_to_unreadjids(gpointer key, gpointer value, gpointer udata) | |
1767 { | |
1768 GList **listp = udata; | |
1769 *listp = g_list_append(*listp, key); | |
1770 } | |
1771 | |
1772 // unread_jid_get_list() | 1765 // unread_jid_get_list() |
1773 // Return the JID list. | 1766 // Return the JID list. |
1774 // The content of the list should not be modified or freed. | 1767 // The content of the list should not be modified or freed. |
1775 // The caller should call g_list_free() after use. | 1768 // The caller should call g_list_free() after use. |
1776 GList *unread_jid_get_list(void) | 1769 GList *unread_jid_get_list(void) |
1777 { | 1770 { |
1778 GList *list = NULL; | |
1779 | |
1780 if (!unread_jids) | 1771 if (!unread_jids) |
1781 return NULL; | 1772 return NULL; |
1782 | 1773 |
1783 // g_hash_table_get_keys() is only in glib >= 2.14 | 1774 return g_hash_table_get_keys(unread_jids); |
1784 //return g_hash_table_get_keys(unread_jids); | |
1785 | |
1786 g_hash_table_foreach(unread_jids, add_to_unreadjids, &list); | |
1787 return list; | |
1788 } | 1775 } |
1789 | 1776 |
1790 /* vim: set et cindent cinoptions=>2\:2(0 ts=2 sw=2: For Vim users... */ | 1777 /* vim: set et cindent cinoptions=>2\:2(0 ts=2 sw=2: For Vim users... */ |