+2007-12-14 Matthias Clasen <mclasen@redhat.com>
+
+ * gcontenttype.c:
+ * gdesktopappinfo.c: Use hash table iterators.
+
2007-12-14 Alexander Larsson <alexl@redhat.com>
* Makefile.am:
return mimetype;
}
-static gboolean
-foreach_mimetype (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- GList **l = user_data;
-
- *l = g_list_prepend (*l, (char *)key);
- return TRUE;
-}
-
static void
enumerate_mimetypes_subdir (const char *dir,
const char *prefix,
{
const char * const* dirs;
GHashTable *mimetypes;
+ GHashTableIter iter;
+ gpointer key;
int i;
GList *l;
enumerate_mimetypes_dir (dirs[i], mimetypes);
l = NULL;
- g_hash_table_foreach_steal (mimetypes, foreach_mimetype, &l);
+ g_hash_table_iter_init (&iter, mimetypes);
+ while (g_hash_table_iter_next (&iter, &key, NULL))
+ l = g_list_prepend (l, key);
+
g_hash_table_destroy (mimetypes);
return l;
}
}
-static void
-collect_apps (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- GList **infos = user_data;
-
- if (value)
- *infos = g_list_prepend (*infos, value);
-}
-
/**
* g_app_info_get_all:
{
const char * const *dirs;
GHashTable *apps;
+ GHashTableIter iter;
+ gpointer key;
int i;
GList *infos;
infos = NULL;
- g_hash_table_foreach (apps,
- collect_apps,
- &infos);
+ g_hash_table_iter_init (&iter, apps);
+ while (g_hash_table_iter_next (&iter, &key, NULL))
+ infos = g_list_prepend (infos, key);
g_hash_table_destroy (apps);