summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-04-11 17:48:20 +0000
committerChris Wilson <cpwilson@src.gnome.org>2007-04-11 17:48:20 +0000
commit1176c064ca7816c0e82c6784945395e658176306 (patch)
tree56cd9abb0ddfd03af5a0445024114cb4c6b2c1a3
parent366bf59cc487cb340cc908a7a6c0a87730aeffcb (diff)
downloadgtk+-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
-rw-r--r--ChangeLog11
-rw-r--r--configure.in2
-rw-r--r--gtk/gtkiconfactory.c26
-rw-r--r--gtk/gtkiconfactory.h2
-rw-r--r--gtk/gtkstock.c44
5 files changed, 29 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index 5cfcbc3bdc..1993fc6fd3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+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
+
2007-04-11 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gdk/quartz/gdkeventloop-quartz.c: Protect the polling thread
diff --git a/configure.in b/configure.in
index 58446dc587..128c1f49b9 100644
--- a/configure.in
+++ b/configure.in
@@ -31,7 +31,7 @@ m4_define([gtk_api_version], [2.0])
m4_define([gtk_binary_version], [2.10.0])
# required versions of other packages
-m4_define([glib_required_version], [2.13.0])
+m4_define([glib_required_version], [2.13.1])
m4_define([pango_required_version], [1.15.3])
m4_define([atk_required_version], [1.9.0])
m4_define([cairo_required_version], [1.2.0])
diff --git a/gtk/gtkiconfactory.c b/gtk/gtkiconfactory.c
index 0cc2cb1132..f94119a790 100644
--- a/gtk/gtkiconfactory.c
+++ b/gtk/gtkiconfactory.c
@@ -2658,24 +2658,6 @@ _gtk_icon_set_invalidate_caches (void)
++cache_serial;
}
-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_icon_factory_list_ids:
*
@@ -2685,11 +2667,11 @@ g_hash_table_get_keys (GHashTable *table)
*
* Return value: List of ids in icon factories
**/
-GSList*
+GList*
_gtk_icon_factory_list_ids (void)
{
GSList *tmp_list;
- GSList *ids;
+ GList *ids;
ids = NULL;
@@ -2698,13 +2680,13 @@ _gtk_icon_factory_list_ids (void)
tmp_list = all_icon_factories;
while (tmp_list != NULL)
{
- GSList *these_ids;
+ GList *these_ids;
GtkIconFactory *factory = GTK_ICON_FACTORY (tmp_list->data);
these_ids = g_hash_table_get_keys (factory->icons);
- ids = g_slist_concat (ids, these_ids);
+ ids = g_list_concat (ids, these_ids);
tmp_list = g_slist_next (tmp_list);
}
diff --git a/gtk/gtkiconfactory.h b/gtk/gtkiconfactory.h
index 38fb51492e..1bcbcb40dd 100644
--- a/gtk/gtkiconfactory.h
+++ b/gtk/gtkiconfactory.h
@@ -177,7 +177,7 @@ GtkIconSize gtk_icon_source_get_size (const GtkIconSource *
/* ignore this */
void _gtk_icon_set_invalidate_caches (void);
-GSList* _gtk_icon_factory_list_ids (void);
+GList* _gtk_icon_factory_list_ids (void);
void _gtk_icon_factory_ensure_default_icons (void);
G_END_DECLS
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;