changeset 1438:c5d937d5530b

g_hash_table_get_keys() is only in glib >= 2.14 This patch replaces g_hash_table_get_keys() with a foreach loop.
author Mikael Berthe <mikael@lilotux.net>
date Mon, 25 Feb 2008 21:39:07 +0100
parents 071c8170b7de
children fd09c95bc2b5
files mcabber/src/roster.c
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/roster.c	Mon Feb 25 20:27:56 2008 +0100
+++ b/mcabber/src/roster.c	Mon Feb 25 21:39:07 2008 +0100
@@ -1556,15 +1556,29 @@
   return g_hash_table_remove(unread_jids, jid);
 }
 
+// Helper function for unread_jid_get_list()
+static void add_to_unreadjids(gpointer key, gpointer value, gpointer udata)
+{
+  GList **listp = udata;
+  *listp = g_list_append(*listp, key);
+}
+
 //  unread_jid_get_list()
 // Return the JID list.
 // The content of the list should not be modified or freed.
 // The caller should call g_list_free() after use.
 GList *unread_jid_get_list(void)
 {
+  GList *list = NULL;
+
   if (!unread_jids)
     return NULL;
-  return g_hash_table_get_keys(unread_jids);
+
+  // g_hash_table_get_keys() is only in glib >= 2.14
+  //return g_hash_table_get_keys(unread_jids);
+
+  g_hash_table_foreach(unread_jids, add_to_unreadjids, &list);
+  return list;
 }
 
 /* vim: set expandtab cindent cinoptions=>2\:2(0:  For Vim users... */