? 1
? shell/rb-playlist-manager-glue.h
Index: rhythmdb/rhythmdb.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb.c,v
retrieving revision 1.181
diff -r1.181 rhythmdb.c
95a96,97
> 	GHashTable *music_tags;
> 
232a235,242
> static void rhythmdb_music_tags_init (RhythmDB *db);
> GList *rhythmdb_music_tags_collate (gpointer key, gpointer value, GList *list);
> static void rhythmdb_music_tags_delete (RhythmDB *db, RBRefString *tag);
> static void rhythmdb_music_tags_remove_from_tag (RhythmDB *db, RBRefString *tag, RhythmDBEntry *entry);
> static void rhythmdb_music_tags_addto_tag (RhythmDB *db, RBRefString *tag, RhythmDBEntry *dbentry);
> GList *rhythmdb_music_tags_list_all_tags (RhythmDB *db);
> GList *rhythmdb_music_tags_list_tag_contents (RhythmDB *db, RBRefString *tag);
> 
4459a4470,4553
> }
> 
> static void rhythmdb_music_tags_init (RhythmDB *db)
> {
> 	GHashTable *tags;
> 
> 	tags = g_hash_table_new_full (NULL, NULL, (GDestroyNotify)rb_refstring_unref, (GDestroyNotify)g_hash_table_destroy);
> 	db->priv->music_tags = tags;
> }
> 
> 
> static void rhythmdb_music_tags_addto_tag (RhythmDB *db, RBRefString *tag, RhythmDBEntry *dbentry)
> {
> 	GHashTable *ourtagtable;
> 	gboolean is_found;
> 
> 	is_found = g_hash_table_lookup_extended (db->priv->music_tags, tag, NULL, (gpointer)&ourtagtable);
> 
> 	if (!is_found) 
> 	{
> 			/* create a new entry */
> 		ourtagtable = g_hash_table_new_full (NULL, NULL, 
> 				                  (GDestroyNotify)rhythmdb_entry_unref, 
> 				       		      (GDestroyNotify)g_hash_table_destroy);
> 		
> 		g_hash_table_insert (db->priv->music_tags, tag , ourtagtable);
> 	} 
> 	rhythmdb_entry_ref (db,dbentry);
> 	g_hash_table_insert (ourtagtable, tag, dbentry);
> 	rb_refstring_ref (tag);
> }
> 
> 
> static void 
> rhythmdb_music_tags_remove_from_tag (RhythmDB *db, RBRefString *tag, RhythmDBEntry *dbentry)
> {
> 	GHashTable *tagtable;
> 	gboolean is_found;
> 
> 	is_found = g_hash_table_lookup_extended (db->priv->music_tags, tag, NULL, (gpointer) &tagtable);
> 
> 	if (is_found)
> 	{
> 		g_hash_table_remove (tagtable, dbentry);
> 		rhythmdb_entry_unref (db,dbentry);
> 	}
> }
> 
> GList *
> rhythmdb_music_tags_collate (gpointer key, gpointer value, GList *list)
> {
> 		list = g_list_prepend (list, key);
> 		rb_refstring_ref (key);
> 
> 		return list;
> }
> 
> 
> GList *
> rhythmdb_music_tags_list_all_tags (RhythmDB *db)
> {
> 	GList *list;
> 
> 	g_hash_table_foreach (db->priv->music_tags, 
> 					             (GHFunc)rhythmdb_music_tags_collate, &list);
> 	return list;
> }
> 
> GList *
> rhythmdb_music_tags_list_tag_contents (RhythmDB *db, RBRefString *tag)
> {
> 	gboolean is_found;
> 	GHashTable *tagtable;
> 	GList *list;
> 
> 	is_found = g_hash_table_lookup_extended (db->priv->music_tags, tag, NULL, (gpointer ) &tagtable);
> 	if (is_found)
> 	{
> 		/* returns a GList of type RhythmDBEntry */
> 		g_hash_table_foreach (db->priv->music_tags, (GHFunc)rhythmdb_music_tags_collate, &list);
> 
> 		return list;
> 	}
> 	return NULL;
