]> Pileus Git - ~andy/gtk/commitdiff
Switch over to use glib's new g_hash_table_get_keys() rather than our own
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 11 Apr 2007 17:48:20 +0000 (17:48 +0000)
committerChris Wilson <cpwilson@src.gnome.org>
Wed, 11 Apr 2007 17:48:20 +0000 (17:48 +0000)
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

ChangeLog
configure.in
gtk/gtkiconfactory.c
gtk/gtkiconfactory.h
gtk/gtkstock.c

index 5cfcbc3bdc33475c82326945ebc6dcfc594a5c9e..1993fc6fd38ce130a5dec1ea8f3c71c790114567 100644 (file)
--- 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
index 58446dc58789741dbb5ff93431c8cf97fb70c10b..128c1f49b9f38d45dbc5a78d2867b89bd74cb202 100644 (file)
@@ -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])
index 0cc2cb1132d6252341ddb34f733ebd786af9af06..f94119a7908f5c64ebe488428c2ec14ce63cfddf 100644 (file)
@@ -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);
     }
index 38fb51492e15416648570441d31f129a13230001..1bcbcb40dd013dd2ab953086e402abb72f14e124 100644 (file)
@@ -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
index 3d8cd1d4e5a9376d53d793ac25d77903505d04ea..63a7304c0ddd4ce9af0779d942fa19a3e7fa32f0 100644 (file)
@@ -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;