Index: iradio/rb-station-properties-dialog.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/iradio/rb-station-properties-dialog.c,v
retrieving revision 1.31
diff -u -u -r1.31 rb-station-properties-dialog.c
--- iradio/rb-station-properties-dialog.c	9 Dec 2005 16:41:08 -0000	1.31
+++ iradio/rb-station-properties-dialog.c	7 Feb 2006 07:30:28 -0000
@@ -317,7 +317,7 @@
 	char *tmp;
 
 	if (dialog->priv->current_entry) {
-		name = rb_refstring_get (dialog->priv->current_entry->title);
+		name = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_TITLE);
 		tmp = g_strdup_printf (_("%s Properties"), name);
 		gtk_window_set_title (GTK_WINDOW (dialog), tmp);
 		g_free (tmp);
@@ -329,22 +329,29 @@
 static void
 rb_station_properties_dialog_update_title_entry (RBStationPropertiesDialog *dialog)
 {
-	gtk_entry_set_text (GTK_ENTRY (dialog->priv->title),
-			    rb_refstring_get (dialog->priv->current_entry->title));
+	const char *title;
+
+	title = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_TITLE);
+	gtk_entry_set_text (GTK_ENTRY (dialog->priv->title),title);
 }
 
 static void
 rb_station_properties_dialog_update_genre (RBStationPropertiesDialog *dialog)
 {
-	gtk_entry_set_text (GTK_ENTRY (dialog->priv->genre),
-			    rb_refstring_get (dialog->priv->current_entry->genre));
+	const char *genre;
+
+	genre = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_GENRE);
+	gtk_entry_set_text (GTK_ENTRY (dialog->priv->genre), genre);
 }
 
 static void
 rb_station_properties_dialog_update_location (RBStationPropertiesDialog *dialog)
 {
+	const char *location;
 	char *unescaped;
-	unescaped = gnome_vfs_unescape_string_for_display (dialog->priv->current_entry->location);
+
+	location = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_LOCATION);
+	unescaped = gnome_vfs_unescape_string_for_display (location);
 	gtk_entry_set_text (GTK_ENTRY (dialog->priv->location), unescaped);
 	g_free (unescaped);
 }
@@ -384,7 +391,7 @@
 	long int count = 0;
 
 	if (dialog->priv->current_entry)
-		count = dialog->priv->current_entry->play_count;
+		count = rhythmdb_entry_get_ulong (dialog->priv->current_entry, RHYTHMDB_PROP_PLAY_COUNT);
 
 	text = g_strdup_printf ("%ld", count);
 	gtk_label_set_text (GTK_LABEL (dialog->priv->playcount), text);
@@ -398,7 +405,7 @@
 	char *text;
 
 	if (dialog->priv->current_entry)
-		val = dialog->priv->current_entry->bitrate;
+		val = rhythmdb_entry_get_ulong (dialog->priv->current_entry, RHYTHMDB_PROP_BITRATE);
 
 	if (val == 0)
 		text = g_strdup (_("Unknown"));
@@ -415,7 +422,7 @@
 	const char *last_played = _("Never");
 
 	if (dialog->priv->current_entry)
-		last_played = rb_refstring_get (dialog->priv->current_entry->last_played_str);
+		last_played = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_LAST_PLAYED_STR);
 	gtk_label_set (GTK_LABEL (dialog->priv->lastplayed), last_played);
 }
 
@@ -426,7 +433,7 @@
 	g_return_if_fail (RB_IS_STATION_PROPERTIES_DIALOG (dialog));
 
 	if (dialog->priv->current_entry)
-		rating = dialog->priv->current_entry->rating;
+		rating = rhythmdb_entry_get_double (dialog->priv->current_entry, RHYTHMDB_PROP_RATING);
 	
 	g_object_set (G_OBJECT (dialog->priv->rating), "rating", rating, NULL);
 }
@@ -434,11 +441,13 @@
 static void
 rb_station_properties_dialog_update_playback_error (RBStationPropertiesDialog *dialog)
 {
+	const char *error;
+	
 	g_return_if_fail (RB_IS_STATION_PROPERTIES_DIALOG (dialog));
 
-	if (dialog->priv->current_entry && dialog->priv->current_entry->playback_error) {
-		gtk_label_set_text (GTK_LABEL (dialog->priv->playback_error),
-				    dialog->priv->current_entry->playback_error);
+	error = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_PLAYBACK_ERROR);
+	if (dialog->priv->current_entry && error) {
+		gtk_label_set_text (GTK_LABEL (dialog->priv->playback_error), error);
 		gtk_widget_show (dialog->priv->playback_error_box);
 	} else {
 		gtk_label_set_text (GTK_LABEL (dialog->priv->playback_error), "");
@@ -449,14 +458,20 @@
 static void
 rb_station_properties_dialog_sync_entries (RBStationPropertiesDialog *dialog)
 {
-	const char *title = gtk_entry_get_text (GTK_ENTRY (dialog->priv->title));
-	const char *genre = gtk_entry_get_text (GTK_ENTRY (dialog->priv->genre));
-	const char *location = gtk_entry_get_text (GTK_ENTRY (dialog->priv->location));
+	const char *title;
+	const char *genre;
+	const char *location;
+	const char *string;
 	GValue val = {0,};
 	gboolean changed = FALSE;
 	RhythmDBEntry *entry = dialog->priv->current_entry;
 
-	if (strcmp (title, rb_refstring_get (entry->title))) {
+	title = gtk_entry_get_text (GTK_ENTRY (dialog->priv->title));
+	genre = gtk_entry_get_text (GTK_ENTRY (dialog->priv->genre));
+	location = gtk_entry_get_text (GTK_ENTRY (dialog->priv->location));
+
+	string = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE);
+	if (strcmp (title, string)) {
 		g_value_init (&val, G_TYPE_STRING);
 		g_value_set_string (&val, title);
 		rhythmdb_entry_set (dialog->priv->db, entry, 
@@ -466,7 +481,8 @@
 		changed = TRUE;
 	}
 
-	if (strcmp (genre, rb_refstring_get (entry->genre))) {
+	string = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE);
+	if (strcmp (genre, string)) {
 		g_value_init (&val, G_TYPE_STRING);
 		g_value_set_string (&val, genre);
 		rhythmdb_entry_set (dialog->priv->db, entry, 
@@ -475,7 +491,8 @@
 		changed = TRUE;
 	}
 
-	if (strcmp (location, entry->location)) {
+	string = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
+	if (strcmp (location, string)) {
 		g_value_init (&val, G_TYPE_STRING);
 		g_value_set_string (&val, location);
 		rhythmdb_entry_set (dialog->priv->db, entry,
Index: podcast/rb-feed-podcast-properties-dialog.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/podcast/rb-feed-podcast-properties-dialog.c,v
retrieving revision 1.9
diff -u -u -r1.9 rb-feed-podcast-properties-dialog.c
--- podcast/rb-feed-podcast-properties-dialog.c	5 Feb 2006 05:28:31 -0000	1.9
+++ podcast/rb-feed-podcast-properties-dialog.c	7 Feb 2006 07:30:28 -0000
@@ -206,7 +206,7 @@
 {
 	const char *name;
 	char *tmp;	
-	name = rb_refstring_get (dialog->priv->current_entry->title);
+	name = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_TITLE);
 	tmp = g_strdup_printf (_("%s Properties"), name);
 	gtk_window_set_title (GTK_WINDOW (dialog), tmp);
 	g_free (tmp);
@@ -215,22 +215,29 @@
 static void
 rb_feed_podcast_properties_dialog_update_title_label (RBFeedPodcastPropertiesDialog *dialog)
 {
-	gtk_label_set_text (GTK_LABEL (dialog->priv->title),
-			    rb_refstring_get (dialog->priv->current_entry->title));
+	const char *title;
+
+	title = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_TITLE);
+	gtk_label_set_text (GTK_LABEL (dialog->priv->title), title);
 }
 
 static void
 rb_feed_podcast_properties_dialog_update_author (RBFeedPodcastPropertiesDialog *dialog)
 {
-	gtk_label_set_text (GTK_LABEL (dialog->priv->author),
-			    rb_refstring_get (dialog->priv->current_entry->artist));
+	const char *artist;
+
+	artist = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_ARTIST);
+	gtk_label_set_text (GTK_LABEL (dialog->priv->author), artist);
 }
 
 static void
 rb_feed_podcast_properties_dialog_update_location (RBFeedPodcastPropertiesDialog *dialog)
 {
+	const char *location;
 	char *unescaped;
-	unescaped = gnome_vfs_unescape_string_for_display (dialog->priv->current_entry->location);
+
+	location = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_LOCATION);
+	unescaped = gnome_vfs_unescape_string_for_display (location);
 	gtk_label_set_text (GTK_LABEL (dialog->priv->location), unescaped);
 	g_free (unescaped);
 }
@@ -238,15 +245,19 @@
 static void
 rb_feed_podcast_properties_dialog_update_copyright (RBFeedPodcastPropertiesDialog *dialog)
 {
-	gtk_label_set_text (GTK_LABEL (dialog->priv->copyright),
-			    rb_refstring_get (dialog->priv->current_entry->podcast->copyright));
+	const char *copyright;
+
+	copyright = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_COPYRIGHT);
+	gtk_label_set_text (GTK_LABEL (dialog->priv->copyright), copyright);
 }
 
 static void
 rb_feed_podcast_properties_dialog_update_language (RBFeedPodcastPropertiesDialog *dialog)
 {
-	gtk_label_set_text (GTK_LABEL (dialog->priv->language),
-			    rb_refstring_get (dialog->priv->current_entry->podcast->lang));
+	const char *language;
+
+	language = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_LANG);
+	gtk_label_set_text (GTK_LABEL (dialog->priv->language), language);
 }
 
 static void
@@ -276,8 +287,10 @@
 static void
 rb_feed_podcast_properties_dialog_update_summary (RBFeedPodcastPropertiesDialog *dialog)
 {
-	gtk_label_set (GTK_LABEL (dialog->priv->summary),
-		       rb_refstring_get (dialog->priv->current_entry->podcast->summary));
+	const char *summary;
+
+	summary = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_SUMMARY);
+	gtk_label_set (GTK_LABEL (dialog->priv->summary), summary);
 }
 
 static char *
Index: podcast/rb-podcast-manager.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/podcast/rb-podcast-manager.c,v
retrieving revision 1.31
diff -u -u -r1.31 rb-podcast-manager.c
--- podcast/rb-podcast-manager.c	14 Jan 2006 08:05:23 -0000	1.31
+++ podcast/rb-podcast-manager.c	7 Feb 2006 07:30:29 -0000
@@ -435,10 +435,12 @@
 gboolean
 rb_podcast_manager_entry_downloaded (RhythmDBEntry *entry)
 {
-	g_assert (entry->type == RHYTHMDB_ENTRY_TYPE_PODCAST_POST);
-
 	gulong status;
 	const gchar *file_name;
+	gulong type;
+
+	type = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_TYPE);
+	g_assert (type == RHYTHMDB_ENTRY_TYPE_PODCAST_POST);
 
 	status = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_STATUS);
 	file_name = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_MOUNTPOINT);
@@ -961,7 +963,8 @@
 rb_podcast_manager_db_entry_added_cb (RBPodcastManager *pd, RhythmDBEntry *entry)
 {
 
-	if (entry->type != RHYTHMDB_ENTRY_TYPE_PODCAST_POST)
+	gulong type = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_TYPE);
+	if (type != RHYTHMDB_ENTRY_TYPE_PODCAST_POST)
 		return;
 	
         rb_podcast_manager_download_entry (pd, entry);
@@ -1214,7 +1217,13 @@
 			local_progress = (gint) 100 * info->total_bytes_copied / info->file_size;
 
 		if (local_progress != data->progress) {
-			data->entry->podcast->status = local_progress;
+			GValue val = {0,};
+
+			g_value_init (&val, G_TYPE_ULONG);
+			g_value_set_ulong (&val, local_progress);
+			rhythmdb_entry_set (data->pd->priv->db, data->entry, RHYTHMDB_PROP_STATUS, &val);
+			g_value_unset (&val);
+
 			GDK_THREADS_ENTER ();
 			
 			g_signal_emit (data->pd, rb_podcast_manager_signals[STATUS_CHANGED],
@@ -1223,7 +1232,6 @@
 			GDK_THREADS_LEAVE ();
 			data->progress = local_progress;
 		}
-		
 	}
 	
 	return GNOME_VFS_XFER_ERROR_ACTION_SKIP;
@@ -1261,7 +1269,9 @@
 rb_podcast_manager_db_entry_deleted_cb (RBPodcastManager *pd, RhythmDBEntry *entry)
 {
 
-	if ( (entry->type == RHYTHMDB_ENTRY_TYPE_PODCAST_POST) && (pd->priv->remove_files == TRUE) )
+	gulong type = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_TYPE);
+
+	if ((type == RHYTHMDB_ENTRY_TYPE_PODCAST_POST) && (pd->priv->remove_files == TRUE) )
 	{
 		const gchar *file_name;
 		const gchar *dir_name;
@@ -1292,7 +1302,7 @@
 			gnome_vfs_remove_directory (dir_name);
 		}
 	}
-	else if (entry->type == RHYTHMDB_ENTRY_TYPE_PODCAST_FEED)
+	else if (type == RHYTHMDB_ENTRY_TYPE_PODCAST_FEED)
 	{
 		GtkTreeModel* query_model = GTK_TREE_MODEL (rhythmdb_query_model_new_empty(pd->priv->db));	
 		GtkTreeIter iter;
Index: podcast/rb-podcast-properties-dialog.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/podcast/rb-podcast-properties-dialog.c,v
retrieving revision 1.7
diff -u -u -r1.7 rb-podcast-properties-dialog.c
--- podcast/rb-podcast-properties-dialog.c	12 Dec 2005 16:15:11 -0000	1.7
+++ podcast/rb-podcast-properties-dialog.c	7 Feb 2006 07:30:29 -0000
@@ -309,8 +309,9 @@
 rb_podcast_properties_dialog_update_title (RBPodcastPropertiesDialog *dialog)
 {
 	const char *name;
-	char *tmp;	
-	name = rb_refstring_get (dialog->priv->current_entry->title);
+	char *tmp;
+	
+	name = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_TITLE);
 	tmp = g_strdup_printf (_("%s Properties"), name);
 	gtk_window_set_title (GTK_WINDOW (dialog), tmp);
 	g_free (tmp);
@@ -319,15 +320,19 @@
 static void
 rb_podcast_properties_dialog_update_title_label (RBPodcastPropertiesDialog *dialog)
 {
-	gtk_label_set_text (GTK_LABEL (dialog->priv->title),
-			    rb_refstring_get (dialog->priv->current_entry->title));
+	const char *title;
+
+	title = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_TITLE);
+	gtk_label_set_text (GTK_LABEL (dialog->priv->title), title);
 }
 
 static void
 rb_podcast_properties_dialog_update_feed (RBPodcastPropertiesDialog *dialog)
 {
-	gtk_label_set_text (GTK_LABEL (dialog->priv->feed),
-			    rb_refstring_get (dialog->priv->current_entry->album));
+	const char *feed;
+
+	feed = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_ALBUM);
+	gtk_label_set_text (GTK_LABEL (dialog->priv->feed), feed);
 }
 
 static void
@@ -346,8 +351,11 @@
 static void
 rb_podcast_properties_dialog_update_location (RBPodcastPropertiesDialog *dialog)
 {
+	const char *location;
 	char *unescaped;
-	unescaped = gnome_vfs_unescape_string_for_display (dialog->priv->current_entry->location);
+
+	location = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_LOCATION);
+	unescaped = gnome_vfs_unescape_string_for_display (location);
 	gtk_label_set_text (GTK_LABEL (dialog->priv->location), unescaped);
 	g_free (unescaped);
 }
@@ -381,8 +389,11 @@
 static void
 rb_podcast_properties_dialog_update_play_count (RBPodcastPropertiesDialog *dialog)
 {
+	gulong count;
 	char *text;
-	text = g_strdup_printf ("%ld", dialog->priv->current_entry->play_count);
+
+	count = rhythmdb_entry_get_ulong (dialog->priv->current_entry, RHYTHMDB_PROP_PLAY_COUNT);
+	text = g_strdup_printf ("%ld", count);
 	gtk_label_set_text (GTK_LABEL (dialog->priv->playcount), text);
 	g_free (text);
 }
@@ -393,7 +404,7 @@
         char *tmp = NULL;
         gulong bitrate = 0;
 
-	bitrate = dialog->priv->current_entry->bitrate;
+	bitrate = rhythmdb_entry_get_ulong (dialog->priv->current_entry, RHYTHMDB_PROP_BITRATE);
         if (bitrate > 0)
                 tmp = g_strdup_printf (_("%lu kbps"), bitrate);
         else
@@ -406,25 +417,29 @@
 static void
 rb_podcast_properties_dialog_update_last_played (RBPodcastPropertiesDialog *dialog)
 {
-	gtk_label_set (GTK_LABEL (dialog->priv->lastplayed),
-		       rb_refstring_get (dialog->priv->current_entry->last_played_str));
+	const char *str;
+
+	str = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_LAST_PLAYED_STR);
+	gtk_label_set (GTK_LABEL (dialog->priv->lastplayed), str);
 }
 
 static void
 rb_podcast_properties_dialog_update_rating (RBPodcastPropertiesDialog *dialog)
 {
-	g_return_if_fail (RB_IS_PODCAST_PROPERTIES_DIALOG (dialog));
+	double rating;
 
-	g_object_set (G_OBJECT (dialog->priv->rating),
-		      "rating", dialog->priv->current_entry->rating, NULL);
+	rating = rhythmdb_entry_get_double (dialog->priv->current_entry, RHYTHMDB_PROP_RATING);
+	g_object_set (G_OBJECT (dialog->priv->rating), "rating", rating, NULL);
 }
 
 static void
 rb_podcast_properties_dialog_update_date (RBPodcastPropertiesDialog *dialog)
 {
+	gulong post_time;
 	char *time;
 	
-	time = rb_podcast_properties_dialog_parse_time (dialog->priv->current_entry->podcast->post_time);
+	post_time = rhythmdb_entry_get_ulong (dialog->priv->current_entry, RHYTHMDB_PROP_POST_TIME);
+	time = rb_podcast_properties_dialog_parse_time (post_time);
 
 	gtk_label_set (GTK_LABEL (dialog->priv->date),
 		       time);
@@ -434,8 +449,10 @@
 static void
 rb_podcast_properties_dialog_update_description (RBPodcastPropertiesDialog *dialog)
 {
-	gtk_label_set (GTK_LABEL (dialog->priv->description),
-		       rb_refstring_get (dialog->priv->current_entry->podcast->description));
+	const char *str;
+
+	str = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_DESCRIPTION);
+	gtk_label_set (GTK_LABEL (dialog->priv->description), str);
 }
 
 static char *
Index: rhythmdb/rhythmdb-private.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb-private.h,v
retrieving revision 1.1
diff -u -u -r1.1 rhythmdb-private.h
--- rhythmdb/rhythmdb-private.h	14 Jul 2004 04:27:16 -0000	1.1
+++ rhythmdb/rhythmdb-private.h	7 Feb 2006 07:30:29 -0000
@@ -30,6 +30,76 @@
 RhythmDBEntry * rhythmdb_entry_allocate		(RhythmDB *db, RhythmDBEntryType type);
 void		rhythmdb_entry_insert		(RhythmDB *db, RhythmDBEntry *entry);
 
+typedef struct {
+	/* podcast */
+	RBRefString *description;
+	RBRefString *subtitle;
+	RBRefString *summary;
+	RBRefString *lang;
+	RBRefString *copyright;
+	RBRefString *image;
+	gulong status;	/* 0-99: downloading
+			   100: Complete
+			   101: Error
+			   102: wait
+			   103: pause */
+	gulong post_time;
+} RhythmDBPodcastFields;
+
+
+struct RhythmDBEntry_ {
+	/* internal bits */
+#ifndef G_DISABLE_ASSERT
+	guint magic;
+#endif	
+	gboolean inserted;
+	gint refcount;
+	void *data;
+	gulong type;
+	
+	/* metadata */
+	RBRefString *title;
+	RBRefString *artist;
+	RBRefString *album;
+	RBRefString *genre;
+	gulong tracknum;
+	gulong discnum;
+	gulong duration;
+	gulong bitrate;
+	double track_gain;
+	double track_peak;
+	double album_gain;
+	double album_peak;
+	GDate *date;
+
+	/* filesystem */
+	char *location;
+	RBRefString *mountpoint;
+	guint64 file_size;
+	RBRefString *mimetype;
+	gulong mtime;
+	gulong first_seen;
+	gulong last_seen;
+
+	/* user data */
+	gdouble rating;
+	glong play_count;
+	gulong last_played;
+
+	/* cached data */
+	RBRefString *last_played_str;
+	RBRefString *first_seen_str;
+
+	/* playback error string */
+	char *playback_error;
+
+	/* visibility (to hide entries on unmounted volumes) */
+	gboolean hidden;
+
+	/*Podcast*/
+	RhythmDBPodcastFields *podcast;
+};
+
 G_END_DECLS
 
 #endif /* __RHYTHMDB_PRIVATE_H */
Index: rhythmdb/rhythmdb-property-model.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb-property-model.c,v
retrieving revision 1.31
diff -u -u -r1.31 rhythmdb-property-model.c
--- rhythmdb/rhythmdb-property-model.c	31 Jan 2006 15:57:35 -0000	1.31
+++ rhythmdb/rhythmdb-property-model.c	7 Feb 2006 07:30:30 -0000
@@ -471,7 +471,8 @@
 		if (new_hidden == old_hidden)
 			return;
 
-		rb_debug ("recieving hidden-change notification for %s", entry->location);
+		rb_debug ("recieving hidden-change notification for %s",
+			  rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION));
 
 		if (new_hidden)
 			rhythmdb_property_model_delete (propmodel, entry);
Index: rhythmdb/rhythmdb-query-model.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb-query-model.c,v
retrieving revision 1.99
diff -u -u -r1.99 rhythmdb-query-model.c
--- rhythmdb/rhythmdb-query-model.c	5 Feb 2006 09:16:50 -0000	1.99
+++ rhythmdb/rhythmdb-query-model.c	7 Feb 2006 07:30:31 -0000
@@ -755,7 +755,8 @@
 		g_value_init (&false_val, G_TYPE_BOOLEAN);
 		g_value_set_boolean (&false_val, FALSE);
 		
-		rb_debug ("emitting hidden-removal notification for %s", entry->location);
+		rb_debug ("emitting hidden-removal notification for %s",
+			  rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION));
 		g_signal_emit (G_OBJECT (model),
 			       rhythmdb_query_model_signals[ENTRY_PROP_CHANGED], 0,
 			       entry, RHYTHMDB_PROP_HIDDEN, &false_val, &true_val);
@@ -991,8 +992,8 @@
 	gtk_tree_model_row_deleted (GTK_TREE_MODEL (model), path);
 	gtk_tree_path_free (path);
 	
-	model->priv->total_duration -= entry->duration;
-	model->priv->total_size -= entry->file_size;
+	model->priv->total_duration -= rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DURATION);
+	model->priv->total_size -= rhythmdb_entry_get_uint64 (entry, RHYTHMDB_PROP_FILE_SIZE);
 
 	g_sequence_remove (ptr);
 	g_assert (g_hash_table_remove (model->priv->reverse_map, entry));
@@ -1042,8 +1043,8 @@
 		if (!entry)
 			break;
 
-		size = entry->file_size;
-		duration = entry->duration;
+		size = rhythmdb_entry_get_uint64 (entry, RHYTHMDB_PROP_FILE_SIZE);
+		duration = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DURATION);
 
 		if ((model->priv->max_count > 0 && (g_hash_table_size (model->priv->reverse_map) + 1) > model->priv->max_count) ||
 		    (model->priv->max_size > 0 && model->priv->total_size + size > model->priv->max_size) ||
@@ -1417,7 +1418,7 @@
 
 			entry = g_sequence_ptr_get_data (iter.user_data);
 
-			location = entry->location;
+			location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
 			g_string_append (data, location);
 
 			if (tem->next)
@@ -2089,6 +2090,8 @@
 {
 	const char *a_val;
 	const char *b_val;
+	ulong a_num;
+	ulong b_num;
 	gint ret;
 
 	/* Sort by album name */
@@ -2109,12 +2112,16 @@
 		return ret;
 
 	/* Then by disc number, */
-	if (a->discnum != b->discnum)
-		return (a->discnum < b->discnum ? -1 : 1);
+	a_num = rhythmdb_entry_get_ulong (a, RHYTHMDB_PROP_DISC_NUMBER);
+	b_num = rhythmdb_entry_get_ulong (b, RHYTHMDB_PROP_DISC_NUMBER);
+	if (a_num != b_num)
+		return (a_num < b_num ? -1 : 1);
 
 	/* by track number */
-	if (a->tracknum != b->tracknum)
-		return (a->tracknum < b->tracknum ? -1 : 1);
+	a_num = rhythmdb_entry_get_ulong (a, RHYTHMDB_PROP_TRACK_NUMBER);
+	b_num = rhythmdb_entry_get_ulong (b, RHYTHMDB_PROP_TRACK_NUMBER);
+	if (a_num != b_num)
+		return (a_num < b_num ? -1 : 1);
 
 	/*  by title */
 	a_val = rhythmdb_entry_get_string (a, RHYTHMDB_PROP_TITLE_SORT_KEY);
Index: rhythmdb/rhythmdb-tree.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb-tree.c,v
retrieving revision 1.90
diff -u -u -r1.90 rhythmdb-tree.c
--- rhythmdb/rhythmdb-tree.c	5 Feb 2006 09:42:15 -0000	1.90
+++ rhythmdb/rhythmdb-tree.c	7 Feb 2006 07:30:32 -0000
@@ -40,6 +40,7 @@
 #include <libxml/SAX.h>
 #include <libxml/parserInternals.h>
 
+#include "rhythmdb-private.h"
 #include "rhythmdb-tree.h"
 #include "rhythmdb-query-model.h"
 #include "rhythmdb-property-model.h"
@@ -474,6 +475,7 @@
 		case RHYTHMDB_PROP_PLAYBACK_ERROR:
 		case RHYTHMDB_PROP_FIRST_SEEN_STR:
 		case RHYTHMDB_PROP_SEARCH_MATCH:
+		case RHYTHMDB_PROP_YEAR:
 		case RHYTHMDB_NUM_PROPERTIES:
 			g_assert_not_reached ();
 			break;
@@ -837,6 +839,7 @@
 		case RHYTHMDB_PROP_PLAYBACK_ERROR:
 		case RHYTHMDB_PROP_FIRST_SEEN_STR:
 		case RHYTHMDB_PROP_SEARCH_MATCH:
+		case RHYTHMDB_PROP_YEAR:
 		case RHYTHMDB_NUM_PROPERTIES:
 			break;
 		}
Index: rhythmdb/rhythmdb.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb.c,v
retrieving revision 1.168
diff -u -u -r1.168 rhythmdb.c
--- rhythmdb/rhythmdb.c	5 Feb 2006 09:42:15 -0000	1.168
+++ rhythmdb/rhythmdb.c	7 Feb 2006 07:30:33 -0000
@@ -3504,6 +3504,7 @@
 			ENUM_ENTRY (RHYTHMDB_PROP_HIDDEN, "Hidden (gboolean) [hidden]"),
 			ENUM_ENTRY (RHYTHMDB_PROP_FIRST_SEEN_STR, "Time Added to Library (gchararray) [first-seen-str]"),
 			ENUM_ENTRY (RHYTHMDB_PROP_SEARCH_MATCH, "Search matching key (gchararray) [search-match]"),
+			ENUM_ENTRY (RHYTHMDB_PROP_YEAR, "Year of date (gulong) [year]"),
 
 			ENUM_ENTRY (RHYTHMDB_PROP_STATUS, "Status of file (gulong) [status]"),
 			ENUM_ENTRY (RHYTHMDB_PROP_DESCRIPTION, "Podcast description(gchararray) [description]"),
@@ -4088,3 +4089,188 @@
 	return TRUE;
 }
 
+char *
+rhythmdb_entry_dup_string (RhythmDBEntry *entry, RhythmDBPropType propid)
+{
+	const char *s;
+
+	s = rhythmdb_entry_get_string (entry, propid);
+	if (s)
+		return g_strdup (s);
+	else
+		return NULL;
+}
+
+const char *
+rhythmdb_entry_get_string (RhythmDBEntry *entry, RhythmDBPropType propid)
+{
+	switch (propid) {
+	case RHYTHMDB_PROP_TITLE:
+		return rb_refstring_get (entry->title);
+	case RHYTHMDB_PROP_ALBUM:
+		return rb_refstring_get (entry->album);
+	case RHYTHMDB_PROP_ARTIST:
+		return rb_refstring_get (entry->artist);
+	case RHYTHMDB_PROP_GENRE:
+		return rb_refstring_get (entry->genre);
+	case RHYTHMDB_PROP_MIMETYPE:
+		return rb_refstring_get (entry->mimetype);
+	case RHYTHMDB_PROP_TITLE_SORT_KEY:
+		return rb_refstring_get_sort_key (entry->title);
+	case RHYTHMDB_PROP_ALBUM_SORT_KEY:
+		return rb_refstring_get_sort_key (entry->album);
+	case RHYTHMDB_PROP_ARTIST_SORT_KEY:
+		return rb_refstring_get_sort_key (entry->artist);
+	case RHYTHMDB_PROP_GENRE_SORT_KEY:
+		return rb_refstring_get_sort_key (entry->genre);
+	case RHYTHMDB_PROP_TITLE_FOLDED:
+		return rb_refstring_get_folded (entry->title);
+	case RHYTHMDB_PROP_ALBUM_FOLDED:
+		return rb_refstring_get_folded (entry->album);
+	case RHYTHMDB_PROP_ARTIST_FOLDED:
+		return rb_refstring_get_folded (entry->artist);
+	case RHYTHMDB_PROP_GENRE_FOLDED:
+		return rb_refstring_get_folded (entry->genre);
+	case RHYTHMDB_PROP_LOCATION:
+		return entry->location;
+	case RHYTHMDB_PROP_MOUNTPOINT:
+		return rb_refstring_get (entry->mountpoint);
+	case RHYTHMDB_PROP_LAST_PLAYED_STR:
+		return rb_refstring_get (entry->last_played_str);
+	case RHYTHMDB_PROP_PLAYBACK_ERROR:
+		return entry->playback_error;
+	case RHYTHMDB_PROP_FIRST_SEEN_STR:
+		return rb_refstring_get (entry->first_seen_str);
+	case RHYTHMDB_PROP_SEARCH_MATCH:
+		return NULL;	/* synthetic property */
+	/* Podcast properties */
+	case RHYTHMDB_PROP_DESCRIPTION:
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->description);
+		else
+			return NULL;
+	case RHYTHMDB_PROP_SUBTITLE:
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->subtitle);
+		else
+			return NULL;
+	case RHYTHMDB_PROP_SUMMARY: 
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->summary);
+		else
+			return NULL;
+	case RHYTHMDB_PROP_LANG:
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->lang);
+		else
+			return NULL;
+	case RHYTHMDB_PROP_COPYRIGHT:
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->copyright);
+		else
+			return NULL;
+	case RHYTHMDB_PROP_IMAGE:
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->image);
+		else
+			return NULL;
+
+	default:
+		g_assert_not_reached ();
+		return NULL;
+	}
+}
+
+gboolean
+rhythmdb_entry_get_boolean (RhythmDBEntry *entry, RhythmDBPropType propid)
+{
+	switch (propid) {
+	case RHYTHMDB_PROP_HIDDEN:
+		return entry->hidden;
+	default:
+		g_assert_not_reached ();
+		return FALSE;
+	}
+}
+
+guint64
+rhythmdb_entry_get_uint64 (RhythmDBEntry *entry, RhythmDBPropType propid)
+{
+	switch (propid) {
+	case RHYTHMDB_PROP_FILE_SIZE:
+		return entry->file_size;
+	default:
+		g_assert_not_reached ();
+		return 0;
+	}
+}
+
+gulong
+rhythmdb_entry_get_ulong (RhythmDBEntry *entry, RhythmDBPropType propid)
+{
+	switch (propid) {
+	case RHYTHMDB_PROP_TYPE:
+		return entry->type;
+	case RHYTHMDB_PROP_TRACK_NUMBER:
+		return entry->tracknum;
+	case RHYTHMDB_PROP_DISC_NUMBER:
+		return entry->discnum;
+	case RHYTHMDB_PROP_DURATION:
+		return entry->duration;
+	case RHYTHMDB_PROP_MTIME:
+		return entry->mtime;
+	case RHYTHMDB_PROP_FIRST_SEEN:
+		return entry->first_seen;
+	case RHYTHMDB_PROP_LAST_SEEN:
+		return entry->last_seen;
+	case RHYTHMDB_PROP_LAST_PLAYED:
+		return entry->last_played;
+	case RHYTHMDB_PROP_PLAY_COUNT:
+		return entry->play_count;
+	case RHYTHMDB_PROP_BITRATE:
+		return entry->bitrate;		
+	case RHYTHMDB_PROP_DATE:
+		if (entry->date)
+			return g_date_get_julian (entry->date);
+		else
+			return 0;
+	case RHYTHMDB_PROP_YEAR:
+		if (entry->date)
+			return g_date_get_year (entry->date);
+		else
+			return 0;
+	case RHYTHMDB_PROP_POST_TIME:
+		if (entry->podcast)
+			return entry->podcast->post_time;
+		else
+			return 0;
+	case RHYTHMDB_PROP_STATUS:
+		if (entry->podcast)
+			return entry->podcast->status;		
+		else
+			return 0;
+	default:
+		g_assert_not_reached ();
+		return 0;
+	}
+}
+
+double
+rhythmdb_entry_get_double (RhythmDBEntry *entry, RhythmDBPropType propid)
+{
+	switch (propid) {
+	case RHYTHMDB_PROP_TRACK_GAIN:
+		return entry->track_gain;
+	case RHYTHMDB_PROP_TRACK_PEAK:
+		return entry->track_peak;
+	case RHYTHMDB_PROP_ALBUM_GAIN:
+		return entry->album_gain;
+	case RHYTHMDB_PROP_ALBUM_PEAK:
+		return entry->album_peak;
+	case RHYTHMDB_PROP_RATING:
+		return entry->rating;
+	default:
+		g_assert_not_reached ();
+		return 0.0;
+	}
+}
Index: rhythmdb/rhythmdb.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb.h,v
retrieving revision 1.66
diff -u -u -r1.66 rhythmdb.h
--- rhythmdb/rhythmdb.h	5 Feb 2006 09:16:50 -0000	1.66
+++ rhythmdb/rhythmdb.h	7 Feb 2006 07:30:34 -0000
@@ -108,7 +108,10 @@
 	RHYTHMDB_PROP_HIDDEN,
 	RHYTHMDB_PROP_PLAYBACK_ERROR,
 	RHYTHMDB_PROP_FIRST_SEEN_STR,
+
+	/* synthetic properties */
 	RHYTHMDB_PROP_SEARCH_MATCH,
+	RHYTHMDB_PROP_YEAR,
 
 	/* Podcast properties */
 	RHYTHMDB_PROP_STATUS,
@@ -144,259 +147,22 @@
 } RhythmDBQueryData;
 
 typedef struct {
-	/* podcast */
-	RBRefString *description;
-	RBRefString *subtitle;
-	RBRefString *summary;
-	RBRefString *lang;
-	RBRefString *copyright;
-	RBRefString *image;
-	gulong status;	/* 0-99: downloading
-			   100: Complete
-			   101: Error
-			   102: wait
-			   103: pause */
-	gulong post_time;
-} RhythmDBPodcastFields;
-
-
-typedef struct {
-	/* internal bits */
-#ifndef G_DISABLE_ASSERT
-	guint magic;
-#endif	
-	gboolean inserted;
-	gint refcount;
-	void *data;
-	gulong type;
-	
-	/* metadata */
-	RBRefString *title;
-	RBRefString *artist;
-	RBRefString *album;
-	RBRefString *genre;
-	gulong tracknum;
-	gulong discnum;
-	gulong duration;
-	gulong bitrate;
-	double track_gain;
-	double track_peak;
-	double album_gain;
-	double album_peak;
-	GDate *date;
-
-	/* filesystem */
-	char *location;
-	RBRefString *mountpoint;
-	guint64 file_size;
-	RBRefString *mimetype;
-	gulong mtime;
-	gulong first_seen;
-	gulong last_seen;
-
-	/* user data */
-	gdouble rating;
-	glong play_count;
-	gulong last_played;
-
-	/* cached data */
-	RBRefString *last_played_str;
-	RBRefString *first_seen_str;
-
-	/* playback error string */
-	char *playback_error;
-
-	/* visibility (to hide entries on unmounted volumes) */
-	gboolean hidden;
-
-	/*Podcast*/
-	RhythmDBPodcastFields *podcast;
-} RhythmDBEntry;
-
-typedef struct {
 	RhythmDBPropType prop;
 	GValue old;
 	GValue new;
 } RhythmDBEntryChange;
 
-void rhythmdb_entry_get (RhythmDBEntry *entry, RhythmDBPropType propid, GValue *val);
-G_INLINE_FUNC const char *rhythmdb_entry_get_string	(RhythmDBEntry *entry, RhythmDBPropType propid);
-G_INLINE_FUNC gboolean rhythmdb_entry_get_boolean	(RhythmDBEntry *entry, RhythmDBPropType propid);
-G_INLINE_FUNC guint64 rhythmdb_entry_get_uint64		(RhythmDBEntry *entry, RhythmDBPropType propid);
-G_INLINE_FUNC gulong rhythmdb_entry_get_ulong		(RhythmDBEntry *entry, RhythmDBPropType propid);
-G_INLINE_FUNC double rhythmdb_entry_get_double		(RhythmDBEntry *entry, RhythmDBPropType propid);
-
-#if defined (G_CAN_INLINE) || defined (__RHYTHMDB_C__)
-
-G_INLINE_FUNC const char *
-rhythmdb_entry_get_string (RhythmDBEntry *entry, RhythmDBPropType propid)
-{
-	switch (propid) {
-	case RHYTHMDB_PROP_TITLE:
-		return rb_refstring_get (entry->title);
-	case RHYTHMDB_PROP_ALBUM:
-		return rb_refstring_get (entry->album);
-	case RHYTHMDB_PROP_ARTIST:
-		return rb_refstring_get (entry->artist);
-	case RHYTHMDB_PROP_GENRE:
-		return rb_refstring_get (entry->genre);
-	case RHYTHMDB_PROP_MIMETYPE:
-		return rb_refstring_get (entry->mimetype);
-	case RHYTHMDB_PROP_TITLE_SORT_KEY:
-		return rb_refstring_get_sort_key (entry->title);
-	case RHYTHMDB_PROP_ALBUM_SORT_KEY:
-		return rb_refstring_get_sort_key (entry->album);
-	case RHYTHMDB_PROP_ARTIST_SORT_KEY:
-		return rb_refstring_get_sort_key (entry->artist);
-	case RHYTHMDB_PROP_GENRE_SORT_KEY:
-		return rb_refstring_get_sort_key (entry->genre);
-	case RHYTHMDB_PROP_TITLE_FOLDED:
-		return rb_refstring_get_folded (entry->title);
-	case RHYTHMDB_PROP_ALBUM_FOLDED:
-		return rb_refstring_get_folded (entry->album);
-	case RHYTHMDB_PROP_ARTIST_FOLDED:
-		return rb_refstring_get_folded (entry->artist);
-	case RHYTHMDB_PROP_GENRE_FOLDED:
-		return rb_refstring_get_folded (entry->genre);
-	case RHYTHMDB_PROP_LOCATION:
-		return entry->location;
-	case RHYTHMDB_PROP_MOUNTPOINT:
-		return rb_refstring_get (entry->mountpoint);
-	case RHYTHMDB_PROP_LAST_PLAYED_STR:
-		return rb_refstring_get (entry->last_played_str);
-	case RHYTHMDB_PROP_PLAYBACK_ERROR:
-		return entry->playback_error;
-	case RHYTHMDB_PROP_FIRST_SEEN_STR:
-		return rb_refstring_get (entry->first_seen_str);
-	case RHYTHMDB_PROP_SEARCH_MATCH:
-		return NULL;	/* synthetic property */
-	/* Podcast properties */
-	case RHYTHMDB_PROP_DESCRIPTION:
-		if (entry->podcast)
-			return rb_refstring_get (entry->podcast->description);
-		else
-			return NULL;
-	case RHYTHMDB_PROP_SUBTITLE:
-		if (entry->podcast)
-			return rb_refstring_get (entry->podcast->subtitle);
-		else
-			return NULL;
-	case RHYTHMDB_PROP_SUMMARY: 
-		if (entry->podcast)
-			return rb_refstring_get (entry->podcast->summary);
-		else
-			return NULL;
-	case RHYTHMDB_PROP_LANG:
-		if (entry->podcast)
-			return rb_refstring_get (entry->podcast->lang);
-		else
-			return NULL;
-	case RHYTHMDB_PROP_COPYRIGHT:
-		if (entry->podcast)
-			return rb_refstring_get (entry->podcast->copyright);
-		else
-			return NULL;
-	case RHYTHMDB_PROP_IMAGE:
-		if (entry->podcast)
-			return rb_refstring_get (entry->podcast->image);
-		else
-			return NULL;
-
-	default:
-		g_assert_not_reached ();
-		return NULL;
-	}
-}
-
-G_INLINE_FUNC gboolean
-rhythmdb_entry_get_boolean (RhythmDBEntry *entry, RhythmDBPropType propid)
-{
-	switch (propid) {
-	case RHYTHMDB_PROP_HIDDEN:
-		return entry->hidden;
-	default:
-		g_assert_not_reached ();
-		return FALSE;
-	}
-}
+struct RhythmDBEntry_;
+typedef struct RhythmDBEntry_ RhythmDBEntry;
 
-G_INLINE_FUNC guint64
-rhythmdb_entry_get_uint64 (RhythmDBEntry *entry, RhythmDBPropType propid)
-{
-	switch (propid) {
-	case RHYTHMDB_PROP_FILE_SIZE:
-		return entry->file_size;
-	default:
-		g_assert_not_reached ();
-		return 0;
-	}
-}
-
-G_INLINE_FUNC gulong
-rhythmdb_entry_get_ulong (RhythmDBEntry *entry, RhythmDBPropType propid)
-{
-	switch (propid) {
-	case RHYTHMDB_PROP_TYPE:
-		return entry->type;
-	case RHYTHMDB_PROP_TRACK_NUMBER:
-		return entry->tracknum;
-	case RHYTHMDB_PROP_DISC_NUMBER:
-		return entry->discnum;
-	case RHYTHMDB_PROP_DURATION:
-		return entry->duration;
-	case RHYTHMDB_PROP_MTIME:
-		return entry->mtime;
-	case RHYTHMDB_PROP_FIRST_SEEN:
-		return entry->first_seen;
-	case RHYTHMDB_PROP_LAST_SEEN:
-		return entry->last_seen;
-	case RHYTHMDB_PROP_LAST_PLAYED:
-		return entry->last_played;
-	case RHYTHMDB_PROP_PLAY_COUNT:
-		return entry->play_count;
-	case RHYTHMDB_PROP_BITRATE:
-		return entry->bitrate;		
-	case RHYTHMDB_PROP_DATE:
-		if (entry->date)
-			return g_date_get_julian (entry->date);
-		else
-			return 0;
-	case RHYTHMDB_PROP_POST_TIME:
-		if (entry->podcast)
-			return entry->podcast->post_time;
-		else
-			return 0;
-	case RHYTHMDB_PROP_STATUS:
-		if (entry->podcast)
-			return entry->podcast->status;		
-		else
-			return 0;
-	default:
-		g_assert_not_reached ();
-		return 0;
-	}
-}
+void rhythmdb_entry_get (RhythmDBEntry *entry, RhythmDBPropType propid, GValue *val);
+const char *rhythmdb_entry_get_string	(RhythmDBEntry *entry, RhythmDBPropType propid);
+char *rhythmdb_entry_dup_string	(RhythmDBEntry *entry, RhythmDBPropType propid);
+gboolean rhythmdb_entry_get_boolean	(RhythmDBEntry *entry, RhythmDBPropType propid);
+guint64 rhythmdb_entry_get_uint64		(RhythmDBEntry *entry, RhythmDBPropType propid);
+gulong rhythmdb_entry_get_ulong		(RhythmDBEntry *entry, RhythmDBPropType propid);
+double rhythmdb_entry_get_double		(RhythmDBEntry *entry, RhythmDBPropType propid);
 
-G_INLINE_FUNC double
-rhythmdb_entry_get_double (RhythmDBEntry *entry, RhythmDBPropType propid)
-{
-	switch (propid) {
-	case RHYTHMDB_PROP_TRACK_GAIN:
-		return entry->track_gain;
-	case RHYTHMDB_PROP_TRACK_PEAK:
-		return entry->track_peak;
-	case RHYTHMDB_PROP_ALBUM_GAIN:
-		return entry->album_gain;
-	case RHYTHMDB_PROP_ALBUM_PEAK:
-		return entry->album_peak;
-	case RHYTHMDB_PROP_RATING:
-		return entry->rating;
-	default:
-		g_assert_not_reached ();
-		return 0.0;
-	}
-}
-#endif
 
 typedef enum
 {
Index: shell/rb-audioscrobbler.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-audioscrobbler.c,v
retrieving revision 1.10
diff -u -u -r1.10 rb-audioscrobbler.c
--- shell/rb-audioscrobbler.c	15 Jan 2006 01:25:08 -0000	1.10
+++ shell/rb-audioscrobbler.c	7 Feb 2006 07:30:34 -0000
@@ -962,25 +962,28 @@
 				   RhythmDBEntry *entry,
 				   RBAudioscrobbler *audioscrobbler)
 {
+	gulong type;
 	gchar *old_artist;
 	gchar *old_album;
 	gchar *old_title;
 
 	if (entry == NULL)
 		return;
-	if (entry->type == RHYTHMDB_ENTRY_TYPE_IRADIO_STATION ||
-	    entry->type == RHYTHMDB_ENTRY_TYPE_PODCAST_POST ||
-	    entry->type == RHYTHMDB_ENTRY_TYPE_PODCAST_FEED)
+
+	type = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_TYPE);
+	if (type == RHYTHMDB_ENTRY_TYPE_IRADIO_STATION ||
+	    type == RHYTHMDB_ENTRY_TYPE_PODCAST_POST ||
+	    type == RHYTHMDB_ENTRY_TYPE_PODCAST_FEED)
 		return;
 
 	old_artist = audioscrobbler->priv->artist;
 	old_album = audioscrobbler->priv->album;
 	old_title = audioscrobbler->priv->title;
 
-	audioscrobbler->priv->artist = g_strdup (rb_refstring_get (entry->artist));
-	audioscrobbler->priv->album = g_strdup (rb_refstring_get (entry->album));
-	audioscrobbler->priv->title = g_strdup (rb_refstring_get (entry->title));
-	audioscrobbler->priv->duration = (int) entry->duration;
+	audioscrobbler->priv->title = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_TITLE);
+	audioscrobbler->priv->artist = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_ARTIST);
+	audioscrobbler->priv->album = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_ALBUM);
+	audioscrobbler->priv->duration = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DURATION);
 	guint time;
 	rb_shell_player_get_playing_time (audioscrobbler->priv->shell_player, &time, NULL);
 	audioscrobbler->priv->elapsed = (int) time;
Index: shell/rb-play-order-random-by-age-and-rating.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-play-order-random-by-age-and-rating.c,v
retrieving revision 1.7
diff -u -u -r1.7 rb-play-order-random-by-age-and-rating.c
--- shell/rb-play-order-random-by-age-and-rating.c	28 Jan 2006 22:00:40 -0000	1.7
+++ shell/rb-play-order-random-by-age-and-rating.c	7 Feb 2006 07:30:35 -0000
@@ -64,23 +64,24 @@
 rb_random_by_age_and_rating_get_entry_weight (RBRandomPlayOrder *rorder, RhythmDB *db, RhythmDBEntry *entry)
 {
 	time_t now;
-	glong last_play;
-	glong seconds_since_last_play;
+	gulong last_play;
+	gulong seconds_since_last_play;
 	gdouble rating;
 
 	/* This finds the log of the number of seconds since the last play.
 	 * It handles never played automatically, since now-0 is a valid
 	 * argument to log(). */
 	time (&now);
-	last_play = entry->last_played;
+	last_play = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_LAST_PLAYED);
 	seconds_since_last_play = now - last_play;
 	/* The lowest weight should be 0. */
 	if (seconds_since_last_play < 1)
 		seconds_since_last_play = 1;
 
-	if (entry->rating > 0.01)
-		rating = entry->rating;
-	else
+	rating = rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_RATING);
+
+	/* treat unrated as 2.5 for the purposes of probabilities */
+	if (rating < 0.01)
 		rating = 2.5;
 
 	return log (seconds_since_last_play) * (rating + 1.0);
Index: shell/rb-play-order-random-by-age.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-play-order-random-by-age.c,v
retrieving revision 1.6
diff -u -u -r1.6 rb-play-order-random-by-age.c
--- shell/rb-play-order-random-by-age.c	10 Dec 2005 03:52:22 -0000	1.6
+++ shell/rb-play-order-random-by-age.c	7 Feb 2006 07:30:35 -0000
@@ -62,15 +62,15 @@
 rb_random_by_age_get_entry_weight (RBRandomPlayOrder *rorder, RhythmDB *db, RhythmDBEntry *entry)
 {
 	time_t now;
-	glong last_play;
-	glong seconds_since_last_play;
+	gulong last_play;
+	gulong seconds_since_last_play;
 
 	/* This returns the log of the number of seconds since the last play.
 	 * It handles never played automatically, since now-0 is a valid
 	 * argument to log(). */
 	
 	time (&now);
-	last_play = entry->last_played;
+	last_play = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_LAST_PLAYED);
 	seconds_since_last_play = now - last_play;
 	/* The lowest weight should be 0. */
 	if (seconds_since_last_play < 1)
Index: shell/rb-play-order-random-by-rating.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-play-order-random-by-rating.c,v
retrieving revision 1.5
diff -u -u -r1.5 rb-play-order-random-by-rating.c
--- shell/rb-play-order-random-by-rating.c	28 Jan 2006 11:14:21 -0000	1.5
+++ shell/rb-play-order-random-by-rating.c	7 Feb 2006 07:30:35 -0000
@@ -63,9 +63,8 @@
 {
 	double rating;
 
-	if (entry->rating > 0.01)
-		rating = entry->rating;
-	else
+	rating = rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_RATING);
+	if (rating < 0.01)
 		rating = 2.5;
 
 	return rating;
Index: shell/rb-playlist-manager.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-playlist-manager.c,v
retrieving revision 1.87
diff -u -u -r1.87 rb-playlist-manager.c
--- shell/rb-playlist-manager.c	6 Feb 2006 10:38:44 -0000	1.87
+++ shell/rb-playlist-manager.c	7 Feb 2006 07:30:35 -0000
@@ -922,8 +922,8 @@
 					continue;
 				}
 
-				e_artist = rb_refstring_get (entry->artist);
-				e_album  = rb_refstring_get (entry->album);
+				e_artist = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST);
+				e_album = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM);
 
 				/* get value of first non-NULL artist */
 				if (e_artist != NULL && artist == NULL) {
Index: shell/rb-shell-player.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell-player.c,v
retrieving revision 1.209
diff -u -u -r1.209 rb-shell-player.c
--- shell/rb-shell-player.c	6 Feb 2006 10:54:45 -0000	1.209
+++ shell/rb-shell-player.c	7 Feb 2006 07:30:37 -0000
@@ -971,10 +971,16 @@
 static gboolean
 rb_shell_player_open_entry (RBShellPlayer *player, RhythmDBEntry *entry, GError **error)
 {
-	if (entry->type == RHYTHMDB_ENTRY_TYPE_PODCAST_POST)
-		return rb_shell_player_open_location (player, rb_refstring_get (entry->mountpoint), error);
+	gulong type;
+	const char *location;
+
+	type = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_TYPE);
+	if (type == RHYTHMDB_ENTRY_TYPE_PODCAST_POST)
+		location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_MOUNTPOINT);
 	else
-		return rb_shell_player_open_location (player, entry->location, error);
+		location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
+
+	return rb_shell_player_open_location (player, location, error);
 }
 
 static gboolean
@@ -1036,6 +1042,8 @@
 				   GError **error)
 {
 	GError *tmp_error = NULL;
+	const char *location;
+	GValue val = {0,};
 	
 	g_return_val_if_fail (player->priv->current_playing_source != NULL, TRUE);
 	g_return_val_if_fail (entry != NULL, TRUE);
@@ -1055,15 +1063,18 @@
 
 	rb_debug ("Success!");
 	/* clear error on successful playback */
-	g_free (entry->playback_error);
-	entry->playback_error = NULL;
+	g_value_init (&val, G_TYPE_STRING);
+	g_value_set_string (&val, NULL);
+	rhythmdb_entry_set (player->priv->db, entry, RHYTHMDB_PROP_PLAYBACK_ERROR, &val);
+	g_value_unset (&val);
 
+	location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
 	g_signal_emit (G_OBJECT (player),
 		       rb_shell_player_signals[PLAYING_SONG_CHANGED], 0,
 		       entry);
 	g_signal_emit (G_OBJECT (player),
 		       rb_shell_player_signals[PLAYING_URI_CHANGED], 0,
-		       entry->location);
+		       location);
 
 	rb_shell_player_sync_with_source (player);
 	rb_shell_player_sync_buttons (player);
@@ -1612,10 +1623,10 @@
 	double entry_album_peak = 0;
 	
 	if (entry != NULL) {
-             	entry_track_gain = entry->track_gain;
-             	entry_track_peak = entry->track_peak;
-             	entry_album_gain = entry->album_gain;
-             	entry_album_peak = entry->album_peak;
+             	entry_track_gain = rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_TRACK_GAIN);
+             	entry_track_peak = rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_TRACK_PEAK);
+             	entry_album_gain = rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_ALBUM_GAIN);
+             	entry_album_peak = rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_ALBUM_PEAK);
 	}
 
 	rb_player_set_replaygain (player->priv->mmplayer, entry_track_gain, 
@@ -1872,8 +1883,8 @@
 	rb_debug ("playing source: %p, active entry: %p", player->priv->current_playing_source, entry);
 
 	if (entry != NULL) {
-		entry_title = rb_refstring_get (entry->title);
-		artist = rb_refstring_get (entry->artist);
+		entry_title = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE);
+		artist = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST);
 	}
 
 	if (player->priv->have_url)
@@ -2151,7 +2162,7 @@
 		return -1;
 	}
 	
-	return current_entry->duration;
+	return rhythmdb_entry_get_ulong (current_entry, RHYTHMDB_PROP_DURATION);
 }
 
 static void
@@ -2309,6 +2320,8 @@
         RhythmDBPropType entry_field = 0;
         gboolean changed = FALSE;
         gboolean set_field = FALSE;
+	gulong type;
+	
         rb_debug ("info: %d", field);
 
         /* Sanity check, this signal may come in after we stopped the
@@ -2327,7 +2340,8 @@
                 goto out_unlock;
         }
 
-	if (entry->type != RHYTHMDB_ENTRY_TYPE_IRADIO_STATION) {
+	type = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_TYPE);
+	if (type != RHYTHMDB_ENTRY_TYPE_IRADIO_STATION) {
 		rb_debug ("Got info_available but entry isn't an iradio station");
 		goto out_unlock;
 	}
@@ -2363,7 +2377,7 @@
 		}
 
 		/* check if the db entry already has a genre; if so, don't change it */
-		existing = rb_refstring_get (entry->genre);
+		existing = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE);
 		if ((existing == NULL) || 
 		    (strcmp (existing, "") == 0) ||
 		    (strcmp (existing, _("Unknown")) == 0)) {
@@ -2379,6 +2393,8 @@
 	{
 		const char *name = g_value_get_string (value);
 		const char *existing;
+		const char *location;
+
 		if (!g_utf8_validate (name, -1, NULL)) {
 			g_warning ("Invalid UTF-8 from internet radio: %s", name);
 			goto out_unlock;
@@ -2390,10 +2406,11 @@
 		 * if the station title really is the same as the URI, then surely
 		 * the station title in the stream metadata will say that too..
 		 */
-		existing = rb_refstring_get (entry->title);
+		existing = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE);
+		location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
 		if ((existing == NULL) || 
 		    (strcmp (existing, "") == 0) || 
-		    (strcmp (existing, entry->location) == 0)) {
+		    (strcmp (existing, location) == 0)) {
 			entry_field = RHYTHMDB_PROP_TITLE;
 			rb_debug ("setting title of iradio station to %s", name);
 			set_field = TRUE;
Index: sources/rb-playlist-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-playlist-source.c,v
retrieving revision 1.105
diff -u -u -r1.105 rb-playlist-source.c
--- sources/rb-playlist-source.c	6 Feb 2006 10:38:44 -0000	1.105
+++ sources/rb-playlist-source.c	7 Feb 2006 07:30:37 -0000
@@ -481,8 +481,8 @@
 
 	gtk_tree_model_get (model, iter, 0, &entry, -1);
 
-	*uri = g_strdup (entry->location);
-	*title = g_strdup (rb_refstring_get (entry->title));
+	*uri = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_LOCATION);
+	*title = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_TITLE);
 	*custom_title = FALSE;
 }
 #endif /* TOTEM_PL_PARSER_CHECK_VERSION */
@@ -518,10 +518,10 @@
 
 	gtk_tree_model_get (model, iter, 0, &entry, -1);
 
-	*uri = g_strdup (entry->location);
-	*artist = g_strdup (rb_refstring_get (entry->artist));
-	*title = g_strdup (rb_refstring_get (entry->title));
-	*duration = entry->duration;
+	*uri = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_LOCATION);
+	*title = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_TITLE);
+	*artist = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_ARTIST);
+	*duration = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DURATION);
 
 	return TRUE;
 }
@@ -714,10 +714,14 @@
 				GtkTreePath *path,
 				RBPlaylistSource *source)
 {
-	RhythmDBEntry *entry = 
-		rhythmdb_query_model_tree_path_to_entry (RHYTHMDB_QUERY_MODEL (model),
+	RhythmDBEntry *entry;
+	const char *location;
+
+	entry = rhythmdb_query_model_tree_path_to_entry (RHYTHMDB_QUERY_MODEL (model),
 							 path);
-	g_hash_table_remove (source->priv->entries, entry->location);
+	location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
+	
+	g_hash_table_remove (source->priv->entries, location);
 }
 
 static void
@@ -727,7 +731,8 @@
 {
 	const char *location;
 
-	location = entry->location;
+	location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
+
 	if (g_hash_table_lookup (source->priv->entries, location)) {
 		rhythmdb_query_model_add_entry (source->priv->model, entry, -1);
 		source->priv->dirty = TRUE;
Index: sources/rb-podcast-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-podcast-source.c,v
retrieving revision 1.48
diff -u -u -r1.48 rb-podcast-source.c
--- sources/rb-podcast-source.c	5 Feb 2006 05:28:31 -0000	1.48
+++ sources/rb-podcast-source.c	7 Feb 2006 07:30:38 -0000
@@ -1456,10 +1456,12 @@
 		break;
 	default:
 		{
-			char *s = g_strdup_printf ("%u %%", (guint)entry->podcast->status);
+			char *s;
+
+			value = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_STATUS);
+			s = g_strdup_printf ("%u %%", value);
 			
 			g_object_set (G_OBJECT (renderer), "text", s, NULL);
-			value = entry->podcast->status;
 			g_free (s);
 		}
 	}
Index: sources/rb-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-source.c,v
retrieving revision 1.53
diff -u -u -r1.53 rb-source.c
--- sources/rb-source.c	3 Feb 2006 09:31:09 -0000	1.53
+++ sources/rb-source.c	7 Feb 2006 07:30:38 -0000
@@ -426,7 +426,7 @@
 
 	g_value_init (&value, G_TYPE_ULONG);
 
-	current_count = entry->play_count;
+	current_count = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_PLAY_COUNT);
 
 	g_value_set_ulong (&value, current_count + 1);
 
Index: sources/rb-sourcelist-model.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-sourcelist-model.c,v
retrieving revision 1.17
diff -u -u -r1.17 rb-sourcelist-model.c
--- sources/rb-sourcelist-model.c	9 Dec 2005 12:18:17 -0000	1.17
+++ sources/rb-sourcelist-model.c	7 Feb 2006 07:30:40 -0000
@@ -524,7 +524,7 @@
 			}
 
 			entry = rhythmdb_query_model_iter_to_entry (query_model, &iter);
-			g_string_append (data, entry->location);
+			g_string_append (data, rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION));
 
 		} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (query_model), &iter));
 		g_object_unref (G_OBJECT (query_model));
Index: sources/rb-static-playlist-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-static-playlist-source.c,v
retrieving revision 1.7
diff -u -u -r1.7 rb-static-playlist-source.c
--- sources/rb-static-playlist-source.c	18 Jan 2006 04:29:12 -0000	1.7
+++ sources/rb-static-playlist-source.c	7 Feb 2006 07:30:40 -0000
@@ -353,10 +353,12 @@
 		xmlNodePtr child_node = xmlNewChild (node, NULL, RB_PLAYLIST_LOCATION, NULL);
 		RhythmDBEntry *entry;
 		xmlChar *encoded;
+		const char *location;
 
 		gtk_tree_model_get (GTK_TREE_MODEL (priv->base_model), &iter, 0, &entry, -1);
 
-		encoded = xmlEncodeEntitiesReentrant (NULL, BAD_CAST entry->location);
+		location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
+		encoded = xmlEncodeEntitiesReentrant (NULL, BAD_CAST location);
 
 		xmlNodeSetContent (child_node, encoded);
 		g_free (encoded);
@@ -496,14 +498,20 @@
 				     RhythmDBEntry *entry,
 				     gint index)
 {
-	rb_static_playlist_source_add_location_internal (source, entry->location, index);
+	const char *location;
+
+	location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
+	rb_static_playlist_source_add_location_internal (source, location, index);
 }
 
 void
 rb_static_playlist_source_remove_entry (RBStaticPlaylistSource *source,
 					RhythmDBEntry *entry)
 {
-	rb_static_playlist_source_remove_location (source, entry->location);
+	const char *location;
+
+	location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
+	rb_static_playlist_source_remove_location (source, location);
 }
 
 void
Index: widgets/rb-entry-view.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/widgets/rb-entry-view.c,v
retrieving revision 1.126
diff -u -u -r1.126 rb-entry-view.c
--- widgets/rb-entry-view.c	6 Feb 2006 20:33:00 -0000	1.126
+++ widgets/rb-entry-view.c	7 Feb 2006 07:30:41 -0000
@@ -194,11 +194,13 @@
 {
 	RhythmDBEntry *entry;
 	gchar *folded;
+	const gchar *entry_folded;
 	gboolean res;
 
 	gtk_tree_model_get (model, iter, 0, &entry, -1);
 	folded = rb_search_fold (key);
-	res = (strstr (rb_refstring_get_folded (entry->title), folded) == NULL);
+	entry_folded = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE_FOLDED);
+	res = (strstr (entry_folded, folded) == NULL);
 	g_free (folded);
 	return res;
 }
@@ -594,7 +596,7 @@
 			pixbuf = NULL;
 			break;
 		}
-	} else if (entry->playback_error) {
+	} else if (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_PLAYBACK_ERROR)) {
 		pixbuf = view->priv->error_pixbuf;
 	} else {
 		pixbuf = NULL;
@@ -612,7 +614,9 @@
 
 	entry = rhythmdb_query_model_iter_to_entry (view->priv->model, iter);
 
-	g_object_set (G_OBJECT (renderer), "rating", entry->rating, NULL);
+	g_object_set (G_OBJECT (renderer),
+		      "rating", rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_RATING),
+		      NULL);
 }
 
 static void
@@ -1294,6 +1298,7 @@
 {
 	GtkTreePath *path;
 	RhythmDBEntry *entry;
+	const gchar *error;
 
 	g_return_if_fail (path_string != NULL);
 
@@ -1302,9 +1307,9 @@
 
 	gtk_tree_path_free (path);
 
-	if (entry->playback_error) {
-		rb_error_dialog (NULL, _("Playback Error"),
-				 "%s", entry->playback_error);
+	error = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_PLAYBACK_ERROR);
+	if (error) {
+		rb_error_dialog (NULL, _("Playback Error"), "%s", error);
 	}
 }
 
Index: widgets/rb-header.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/widgets/rb-header.c,v
retrieving revision 1.21
diff -u -u -r1.21 rb-header.c
--- widgets/rb-header.c	5 Dec 2005 17:31:50 -0000	1.21
+++ widgets/rb-header.c	7 Feb 2006 07:30:41 -0000
@@ -403,7 +403,7 @@
 rb_header_get_duration (RBHeader *player)
 {
 	if (player->priv->entry) {
-		return player->priv->entry->duration;
+		return rhythmdb_entry_get_ulong (player->priv->entry, RHYTHMDB_PROP_DURATION);
 	}
 	return -1;
 }
Index: widgets/rb-song-info.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/widgets/rb-song-info.c,v
retrieving revision 1.49
diff -u -u -r1.49 rb-song-info.c
--- widgets/rb-song-info.c	1 Feb 2006 19:32:18 -0000	1.49
+++ widgets/rb-song-info.c	7 Feb 2006 07:30:41 -0000
@@ -640,7 +640,7 @@
 		entry_artist = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST);
 		entry_album = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM);
 		entry_genre = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE);
-		entry_year = (entry->date) ? g_date_get_year (entry->date) : 0;
+		entry_year = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_YEAR);
 		entry_disc_number = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DISC_NUMBER);
 
 		/* grab first valid values */
@@ -688,32 +688,33 @@
 static void 
 rb_song_info_populate_dialog (RBSongInfo *song_info)
 {
-	const char *text = NULL;
+	const char *text;
 	char *tmp;
+	ulong num;
 	
 	g_assert (song_info->priv->current_entry);
 
 	/* update the buttons sensitivity */
 	rb_song_info_update_buttons (song_info);
 
-	text = rb_refstring_get (song_info->priv->current_entry->title);
+	text = rhythmdb_entry_get_string (song_info->priv->current_entry, RHYTHMDB_PROP_TITLE);
 	gtk_entry_set_text (GTK_ENTRY (song_info->priv->title), text);
 	
 	tmp = g_strdup_printf (_("%s Properties"), text);
 	gtk_window_set_title (GTK_WINDOW (song_info), tmp);
 	g_free (tmp);
 
-	text = rb_refstring_get (song_info->priv->current_entry->artist);
+	text = rhythmdb_entry_get_string (song_info->priv->current_entry, RHYTHMDB_PROP_ARTIST);
 	gtk_entry_set_text (GTK_ENTRY (song_info->priv->artist), text);
-	text = rb_refstring_get (song_info->priv->current_entry->album);
+	text = rhythmdb_entry_get_string (song_info->priv->current_entry, RHYTHMDB_PROP_ALBUM);
 	gtk_entry_set_text (GTK_ENTRY (song_info->priv->album), text);
-	text = rb_refstring_get (song_info->priv->current_entry->genre);
+	text = rhythmdb_entry_get_string (song_info->priv->current_entry, RHYTHMDB_PROP_GENRE);
 	gtk_entry_set_text (GTK_ENTRY (song_info->priv->genre), text);
 
-	rb_song_info_populate_num_field (GTK_ENTRY (song_info->priv->track_cur),
-					 song_info->priv->current_entry->tracknum);
-	rb_song_info_populate_num_field (GTK_ENTRY (song_info->priv->disc_cur),
-					 song_info->priv->current_entry->discnum);
+	num = rhythmdb_entry_get_ulong (song_info->priv->current_entry, RHYTHMDB_PROP_TRACK_NUMBER);
+	rb_song_info_populate_num_field (GTK_ENTRY (song_info->priv->track_cur), num);
+	num = rhythmdb_entry_get_ulong (song_info->priv->current_entry, RHYTHMDB_PROP_DISC_NUMBER);
+	rb_song_info_populate_num_field (GTK_ENTRY (song_info->priv->disc_cur), num);
 
 	rb_song_info_update_duration (song_info);
 	rb_song_info_update_location (song_info);
@@ -733,8 +734,7 @@
 	if (!song_info->priv->current_entry)
 		return;
 
-	if (song_info->priv->current_entry->playback_error)
-		message = g_strdup (song_info->priv->current_entry->playback_error);
+	message = rhythmdb_entry_dup_string (song_info->priv->current_entry, RHYTHMDB_PROP_PLAYBACK_ERROR);
 
 	if (message) {
 		gtk_label_set_text (GTK_LABEL (song_info->priv->playback_error_label),
@@ -754,7 +754,7 @@
 {
 	char *tmp = NULL;
 	gulong bitrate = 0;
-	bitrate = song_info->priv->current_entry->bitrate;
+	bitrate = rhythmdb_entry_get_ulong (song_info->priv->current_entry, RHYTHMDB_PROP_BITRATE);
 
 	if (bitrate > 0)
 		tmp = g_strdup_printf (_("%lu kbps"), bitrate);
@@ -771,7 +771,7 @@
 	char *text = NULL;
 	long duration = 0;
 	int minutes, seconds;
-	duration = song_info->priv->current_entry->duration;
+	duration = rhythmdb_entry_get_ulong (song_info->priv->current_entry, RHYTHMDB_PROP_DURATION);
 	minutes = duration / 60;
 	seconds = duration % 60;
 	text = g_strdup_printf ("%d:%02d", minutes, seconds);
@@ -786,7 +786,7 @@
 
 	g_return_if_fail (song_info != NULL);
 
-	text = song_info->priv->current_entry->location;
+	text = rhythmdb_entry_get_string (song_info->priv->current_entry, RHYTHMDB_PROP_LOCATION);
 
 	if (text != NULL) {
 		char *tmp, *tmp_utf8;
@@ -912,8 +912,11 @@
 static void
 rb_song_info_update_play_count (RBSongInfo *song_info)
 {
+	gulong num;
 	char *text;
-	text = g_strdup_printf ("%ld", song_info->priv->current_entry->play_count);
+
+	num = rhythmdb_entry_get_ulong (song_info->priv->current_entry, RHYTHMDB_PROP_PLAY_COUNT);
+	text = g_strdup_printf ("%ld", num);
 	gtk_label_set_text (GTK_LABEL (song_info->priv->play_count), text);
 	g_free (text);
 }
@@ -922,7 +925,7 @@
 rb_song_info_update_last_played (RBSongInfo *song_info)
 {
 	const char *str;
-	str = rb_refstring_get (song_info->priv->current_entry->last_played_str);
+	str = rhythmdb_entry_get_string (song_info->priv->current_entry, RHYTHMDB_PROP_LAST_PLAYED_STR);
 	if (!strcmp ("", str))
 		str = _("Never");
 	gtk_label_set_text (GTK_LABEL (song_info->priv->last_played), str);
@@ -931,21 +934,24 @@
 static void
 rb_song_info_update_rating (RBSongInfo *song_info)
 {
+	double rating;
+
 	g_return_if_fail (RB_IS_SONG_INFO (song_info));
 
+	rating = rhythmdb_entry_get_double (song_info->priv->current_entry, RHYTHMDB_PROP_RATING);
 	g_object_set (G_OBJECT (song_info->priv->rating),
-		      "rating", song_info->priv->current_entry->rating,
+		      "rating", rating,
 		      NULL);
-
 }
 
 static void
 rb_song_info_update_year (RBSongInfo *song_info)
 {
+	ulong year;
 	char *text;
 
-	if (song_info->priv->current_entry->date) {
-		gulong year = g_date_get_year (song_info->priv->current_entry->date);
+	year = rhythmdb_entry_get_ulong (song_info->priv->current_entry, RHYTHMDB_PROP_YEAR);
+	if (year > 0) {
 		text = g_strdup_printf ("%lu", year);
 	} else {
 		text = g_strdup (_("Unknown"));
@@ -975,8 +981,12 @@
 		g_value_init (&val, G_TYPE_STRING);
 		g_value_set_string (&val, album);
 		for (tem = dialog->priv->selected_entries; tem; tem = tem->next) {
+			const char *entry_album;
+			
 			entry = (RhythmDBEntry *)tem->data;
-			if (strcmp (album, rb_refstring_get (entry->album)) == 0)
+			entry_album = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM);
+			
+			if (strcmp (album, entry_album) == 0)
 				continue;
 			rhythmdb_entry_set (dialog->priv->db, entry,
 					    RHYTHMDB_PROP_ALBUM, &val);
@@ -989,8 +999,12 @@
 		g_value_init (&val, G_TYPE_STRING);
 		g_value_set_string (&val, artist);
 		for (tem = dialog->priv->selected_entries; tem; tem = tem->next) {
+			const char *entry_artist;
+			
 			entry = (RhythmDBEntry *)tem->data;
-			if (strcmp (artist, rb_refstring_get (entry->artist)) == 0)
+			entry_artist = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST);
+			
+			if (strcmp (artist, entry_artist) == 0)
 				continue;
 			rhythmdb_entry_set (dialog->priv->db, entry,
 					    RHYTHMDB_PROP_ARTIST, &val);
@@ -1003,8 +1017,12 @@
 		g_value_init (&val, G_TYPE_STRING);
 		g_value_set_string (&val, genre);
 		for (tem = dialog->priv->selected_entries; tem; tem = tem->next) {
+			const char *entry_genre;
+
 			entry = (RhythmDBEntry *)tem->data;
-			if (strcmp (genre, rb_refstring_get (entry->genre)) == 0)
+			entry_genre = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE);
+			
+			if (strcmp (genre, entry_genre) == 0)
 				continue;
 			rhythmdb_entry_set (dialog->priv->db, entry,
 					    RHYTHMDB_PROP_GENRE, &val);
@@ -1049,8 +1067,12 @@
 		g_value_set_ulong (&val, discn);
 
 		for (tem = dialog->priv->selected_entries; tem; tem = tem->next) {
+			ulong entry_disc_num;
+			
 			entry = (RhythmDBEntry *)tem->data;
-			if (discn != entry->discnum) {
+			entry_disc_num = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DISC_NUMBER);
+
+			if (discn != entry_disc_num) {
 				rhythmdb_entry_set (dialog->priv->db, entry,
 						    RHYTHMDB_PROP_DISC_NUMBER, &val);
 				changed = TRUE;
@@ -1067,27 +1089,38 @@
 static void
 rb_song_info_sync_entry_single (RBSongInfo *dialog)
 {
-	const char *title = gtk_entry_get_text (GTK_ENTRY (dialog->priv->title));
-	const char *genre = gtk_entry_get_text (GTK_ENTRY (dialog->priv->genre));
-	const char *artist = gtk_entry_get_text (GTK_ENTRY (dialog->priv->artist));
-	const char *album = gtk_entry_get_text (GTK_ENTRY (dialog->priv->album));	
-	const char *tracknum_str = gtk_entry_get_text (GTK_ENTRY (dialog->priv->track_cur));
-	const char *discnum_str = gtk_entry_get_text (GTK_ENTRY (dialog->priv->disc_cur));
-	const char *year_str = gtk_entry_get_text (GTK_ENTRY (dialog->priv->year));
+	const char *title;
+	const char *genre;
+	const char *artist;
+	const char *album;	
+	const char *tracknum_str;
+	const char *discnum_str;
+	const char *year_str;
+	const char *entry_string;
 	char *endptr;
 	GType type;
-	gint tracknum;
-	gint discnum;
-	gint year;
+	gulong tracknum;
+	gulong discnum;
+	gulong year;
+	gulong entry_val;
 	GValue val = {0,};
 	gboolean changed = FALSE;
 	RhythmDBEntry *entry = dialog->priv->current_entry;
 
+	title = gtk_entry_get_text (GTK_ENTRY (dialog->priv->title));
+	genre = gtk_entry_get_text (GTK_ENTRY (dialog->priv->genre));
+	artist = gtk_entry_get_text (GTK_ENTRY (dialog->priv->artist));
+	album = gtk_entry_get_text (GTK_ENTRY (dialog->priv->album));	
+	tracknum_str = gtk_entry_get_text (GTK_ENTRY (dialog->priv->track_cur));
+	discnum_str = gtk_entry_get_text (GTK_ENTRY (dialog->priv->disc_cur));
+	year_str = gtk_entry_get_text (GTK_ENTRY (dialog->priv->year));
+
 	g_signal_emit (G_OBJECT (dialog), rb_song_info_signals[PRE_METADATA_CHANGE], 0,
 		       entry);
 
 	tracknum = g_ascii_strtoull (tracknum_str, &endptr, 10);
-	if ((endptr != tracknum_str) && (tracknum != entry->tracknum)) {
+	entry_val = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_TRACK_NUMBER);
+	if ((endptr != tracknum_str) && (tracknum != entry_val)) {
 		type = rhythmdb_get_property_type (dialog->priv->db,
 						   RHYTHMDB_PROP_TRACK_NUMBER);
 		g_value_init (&val, type);
@@ -1098,7 +1131,8 @@
 	}
 	
 	discnum = g_ascii_strtoull (discnum_str, &endptr, 10);
-	if ((endptr != discnum_str) && (discnum != entry->discnum)) {
+	entry_val = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DISC_NUMBER);
+	if ((endptr != discnum_str) && (discnum != entry_val)) {
 		type = rhythmdb_get_property_type (dialog->priv->db,
 						   RHYTHMDB_PROP_DISC_NUMBER);
 		g_value_init (&val, type);
@@ -1109,13 +1143,17 @@
 	}
 	
 	year = g_ascii_strtoull (year_str, &endptr, 10);
+	entry_val = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_YEAR);
 	if ((endptr != year_str) && 
-	    (entry->date == NULL || year != g_date_get_year (entry->date))) {
+	    (year > 0 || year != entry_val)) {
 		GDate *date = NULL;
 	
 		if (year > 0) {
-			if (entry->date) {
-				date = g_date_new_julian (g_date_get_julian (entry->date));
+			if (entry_val > 0) {
+				gulong julian;
+
+				julian = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DATE);
+				date = g_date_new_julian (julian);
 				g_date_set_year (date, year);
 			} else {
 				date = g_date_new_dmy (1, G_DATE_JANUARY, year);
@@ -1135,7 +1173,8 @@
 	}
 
 
-	if (strcmp (title, rb_refstring_get (entry->title))) {
+	entry_string = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE);
+	if (strcmp (title, entry_string)) {
 		type = rhythmdb_get_property_type (dialog->priv->db,
 						   RHYTHMDB_PROP_TITLE);
 		g_value_init (&val, type);
@@ -1146,8 +1185,8 @@
 		changed = TRUE;
 	}
 
-
-	if (strcmp (album, rb_refstring_get (entry->album))) {
+	entry_string = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM);
+	if (strcmp (album, entry_string)) {
 		type = rhythmdb_get_property_type (dialog->priv->db,
 						   RHYTHMDB_PROP_ALBUM);
 		g_value_init (&val, type);
@@ -1158,7 +1197,8 @@
 		changed = TRUE;
 	}
 
-	if (strcmp (artist, rb_refstring_get (entry->artist))) {
+	entry_string = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST);
+	if (strcmp (artist, entry_string)) {
 		type = rhythmdb_get_property_type (dialog->priv->db,
 						   RHYTHMDB_PROP_ARTIST);
 		g_value_init (&val, type);
@@ -1169,8 +1209,8 @@
 		changed = TRUE;
 	}
 
-
-	if (strcmp (genre, rb_refstring_get (entry->genre))) {
+	entry_string = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE);
+	if (strcmp (genre, entry_string)) {
 		type = rhythmdb_get_property_type (dialog->priv->db,
 						   RHYTHMDB_PROP_GENRE);
 		g_value_init (&val, type);
