diff src/compat.c @ 1574:ee2b66a09a03

compilation fixes for older glib and gtk
author nadvornik
date Tue, 28 Apr 2009 06:54:59 +0000
parents 8b89e3ff286b
children 956aab097ea7
line wrap: on
line diff
--- a/src/compat.c	Mon Apr 27 23:07:59 2009 +0000
+++ b/src/compat.c	Tue Apr 28 06:54:59 2009 +0000
@@ -35,4 +35,24 @@
 		}
 #endif
 }
+
+#if !GLIB_CHECK_VERSION(2, 14, 0)
+static void hash_table_add(gpointer key, gpointer value, gpointer user_data)
+{
+	GList **list = user_data;
+	*list = g_list_prepend(*list, key);
+}
+#endif
+
+GList* hash_table_get_keys(GHashTable *hash_table)
+{
+#if GLIB_CHECK_VERSION(2, 14, 0)
+	return g_hash_table_get_keys(hash_table);
+#else
+	GList *list = NULL;
+	g_hash_table_foreach(hash_table, hash_table_add, &list);
+	return list;
+#endif
+}
+
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */