diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-04-11 17:48:20 +0000 |
---|---|---|
committer | Chris Wilson <cpwilson@src.gnome.org> | 2007-04-11 17:48:20 +0000 |
commit | 1176c064ca7816c0e82c6784945395e658176306 (patch) | |
tree | 56cd9abb0ddfd03af5a0445024114cb4c6b2c1a3 /gtk/gtkstock.c | |
parent | 366bf59cc487cb340cc908a7a6c0a87730aeffcb (diff) | |
download | gtk+-1176c064ca7816c0e82c6784945395e658176306.tar.gz |
Switch over to use glib's new g_hash_table_get_keys() rather than our own
2007-04-11 Chris Wilson <chris@chris-wilson.co.uk>
* gtk/gtkiconfactory.c (_gtk_icon_factory_list_ids):
* gtk/gtkstock.c (gtk_stock_list_ids):
Switch over to use glib's new g_hash_table_get_keys() rather
than our own static implementation.
* gtk/gtkiconfactory.h: Update to return a GList.
* configure.in: Bump required version to 2.13.1
svn path=/trunk/; revision=17597
Diffstat (limited to 'gtk/gtkstock.c')
-rw-r--r-- | gtk/gtkstock.c | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/gtk/gtkstock.c b/gtk/gtkstock.c index 3d8cd1d4e5..63a7304c0d 100644 --- a/gtk/gtkstock.c +++ b/gtk/gtkstock.c @@ -183,24 +183,6 @@ gtk_stock_lookup (const gchar *stock_id, return found != NULL; } -static void -listify_foreach (gpointer key, gpointer value, gpointer data) -{ - GSList **list = data; - - *list = g_slist_prepend (*list, key); -} - -static GSList * -g_hash_table_get_keys (GHashTable *table) -{ - GSList *list = NULL; - - g_hash_table_foreach (table, listify_foreach, &list); - - return list; -} - /** * gtk_stock_list_ids: * @@ -213,42 +195,40 @@ g_hash_table_get_keys (GHashTable *table) GSList* gtk_stock_list_ids (void) { - GSList *ids; - GSList *icon_ids; + GList *ids; + GList *icon_ids; GSList *retval; - GSList *tmp_list; const gchar *last_id; init_stock_hash (); ids = g_hash_table_get_keys (stock_hash); icon_ids = _gtk_icon_factory_list_ids (); - ids = g_slist_concat (ids, icon_ids); + ids = g_list_concat (ids, icon_ids); - ids = g_slist_sort (ids, (GCompareFunc)strcmp); + ids = g_list_sort (ids, (GCompareFunc)strcmp); last_id = NULL; retval = NULL; - tmp_list = ids; - while (tmp_list != NULL) + while (ids != NULL) { - GSList *next; + GList *next; - next = g_slist_next (tmp_list); + next = g_list_next (ids); - if (last_id && strcmp (tmp_list->data, last_id) == 0) + if (last_id && strcmp (ids->data, last_id) == 0) { /* duplicate, ignore */ } else { - retval = g_slist_prepend (retval, g_strdup (tmp_list->data)); - last_id = tmp_list->data; + retval = g_slist_prepend (retval, g_strdup (ids->data)); + last_id = ids->data; } - g_slist_free_1 (tmp_list); + g_list_free_1 (ids); - tmp_list = next; + ids = next; } return retval; |