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
This commit is contained in:
		 Chris Wilson
					Chris Wilson
				
			
				
					committed by
					
						 Chris Wilson
						Chris Wilson
					
				
			
			
				
	
			
			
			 Chris Wilson
						Chris Wilson
					
				
			
						parent
						
							366bf59cc4
						
					
				
				
					commit
					1176c064ca
				
			
							
								
								
									
										11
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								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 | ||||
|  | ||||
| @ -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]) | ||||
|  | ||||
| @ -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); | ||||
|     } | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user