Index: rhythmdb/rhythmdb-private.h
===================================================================
--- rhythmdb/rhythmdb-private.h	(revision 5266)
+++ rhythmdb/rhythmdb-private.h	(working copy)
@@ -52,6 +52,7 @@
 			   102: wait
 			   103: pause */
 	gulong post_time;
+ 	gulong playback_pos; /* saved playback position */
 } RhythmDBPodcastFields;
 
 enum {
Index: rhythmdb/rhythmdb-tree.c
===================================================================
--- rhythmdb/rhythmdb-tree.c	(revision 5266)
+++ rhythmdb/rhythmdb-tree.c	(working copy)
@@ -1004,6 +1004,10 @@
 			if (podcast)
 				save_entry_ulong (ctx, elt_name, podcast->post_time, FALSE);
 			break;
+ 		case RHYTHMDB_PROP_PLAYBACK_POS:
+ 			if (podcast)
+ 				save_entry_ulong (ctx, elt_name, podcast->playback_pos, FALSE);
+  			break;			
 		case RHYTHMDB_PROP_KEYWORD:
 			keywords = rhythmdb_entry_keywords_get (RHYTHMDB (db), entry);
 
Index: rhythmdb/rhythmdb.c
===================================================================
--- rhythmdb/rhythmdb.c	(revision 5266)
+++ rhythmdb/rhythmdb.c	(working copy)
@@ -2902,6 +2902,10 @@
 			g_assert (podcast);
 			podcast->post_time = g_value_get_ulong (value);
 			break;
+ 		case RHYTHMDB_PROP_PLAYBACK_POS:
+			g_assert (podcast);
+ 			podcast->playback_pos = g_value_get_ulong (value);
+ 			break;	
 		case RHYTHMDB_NUM_PROPERTIES:
 			g_assert_not_reached ();
 			break;
@@ -3647,7 +3651,7 @@
 			ENUM_ENTRY (RHYTHMDB_PROP_COPYRIGHT, "Podcast copyright (gchararray) [copyright]"),
 			ENUM_ENTRY (RHYTHMDB_PROP_IMAGE, "Podcast image(gchararray) [image]"),
 			ENUM_ENTRY (RHYTHMDB_PROP_POST_TIME, "Podcast time of post (gulong) [post-time]"),
-
+ 			ENUM_ENTRY (RHYTHMDB_PROP_PLAYBACK_POS, "Saved playback position (gulong) [playback-position]"),
 			ENUM_ENTRY (RHYTHMDB_PROP_KEYWORD, "Keywords applied to track (gchararray) [keyword]"),
 			{ 0, 0, 0 }
 		};
@@ -4578,6 +4582,11 @@
 			return podcast->post_time;
 		else
 			return 0;
+ 	case RHYTHMDB_PROP_PLAYBACK_POS:
+ 		if (podcast)
+ 			return podcast->playback_pos;
+  		else
+  			return 0;
 	case RHYTHMDB_PROP_STATUS:
 		if (podcast)
 			return podcast->status;
Index: rhythmdb/rhythmdb.h
===================================================================
--- rhythmdb/rhythmdb.h	(revision 5266)
+++ rhythmdb/rhythmdb.h	(working copy)
@@ -196,6 +196,7 @@
 	RHYTHMDB_PROP_COPYRIGHT,
 	RHYTHMDB_PROP_IMAGE,
 	RHYTHMDB_PROP_POST_TIME,
+ 	RHYTHMDB_PROP_PLAYBACK_POS, 	
 
 	RHYTHMDB_PROP_MUSICBRAINZ_TRACKID,
 	RHYTHMDB_PROP_MUSICBRAINZ_ARTISTID,
Index: shell/rb-shell-player.c
===================================================================
--- shell/rb-shell-player.c	(revision 5266)
+++ shell/rb-shell-player.c	(working copy)
@@ -144,6 +144,7 @@
 							GConfEntry *entry, RBShellPlayer *player);
 static void gconf_network_buffer_size_changed (GConfClient *client, guint cnxn_id,
 					       GConfEntry *entry, RBShellPlayer *player);
+static void rb_shell_player_entry_changing (RBShellPlayer *player);
 static void rb_shell_player_playing_changed_cb (RBShellPlayer *player,
 						GParamSpec *arg1,
 						gpointer user_data);
@@ -975,6 +976,10 @@
 
 	g_return_if_fail (player->priv != NULL);
 
+	// FIXME implement via signals
+	// is it a good place to call it?
+ 	rb_shell_player_entry_changing (player);
+
 	if (player->priv->gconf_play_order_id != 0) {
 		eel_gconf_notification_remove (player->priv->gconf_play_order_id);
 		player->priv->gconf_play_order_id = 0;
@@ -1453,6 +1458,11 @@
 	if (rb_shell_player_open_location (player, entry, play_type, error) == FALSE) {
 		goto lose;
 	}
+ 	if (entry && rhythmdb_entry_get_entry_type (entry) == RHYTHMDB_ENTRY_TYPE_PODCAST_POST) {
+ 		gulong save_time = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_PLAYBACK_POS);
+ 		rb_debug ("restoring podcast playback position %lu", save_time);
+ 		rb_player_set_time (player->priv->mmplayer, save_time);
+ 	}
 
 	rb_shell_player_sync_replaygain (player, entry);
 
@@ -2635,6 +2645,8 @@
 rb_shell_player_set_playing_source (RBShellPlayer *player,
 				    RBSource *source)
 {
+	// FIXME when moved to the right place - implement using signal
+	rb_shell_player_entry_changing (player);
 	rb_shell_player_set_playing_source_internal (player, source, TRUE);
 }
 
@@ -2686,6 +2698,7 @@
 			emit_playing_from_queue_changed = TRUE;
 
 		if (player->priv->source == NULL) {
+
 			actually_set_playing_source (player, source, sync_entry_view);
 		} else {
 			emit_source_changed = FALSE;
@@ -3137,6 +3150,34 @@
 	GDK_THREADS_LEAVE ();
 }
 
+static void
+rb_shell_player_entry_changing (RBShellPlayer *player)
+{
+	/* Not sure about this */
+	RhythmDBEntry *old_entry;
+	rb_debug("will attempt to save podcast position");
+	old_entry = rb_shell_player_get_playing_entry (player);
+	
+	if (old_entry) {
+		if (rhythmdb_entry_get_entry_type (old_entry) == 
+		    RHYTHMDB_ENTRY_TYPE_PODCAST_POST) {
+			gulong cur_time = rb_player_get_time (player->priv->mmplayer);
+			gulong duration = rhythmdb_entry_get_ulong (old_entry, RHYTHMDB_PROP_DURATION);
+			GValue val = {0,};
+		
+			/* save the position, if not withing 5 seconds of either end */
+			if ((cur_time < 5) || (cur_time > duration - 5))
+				cur_time = 0;
+		
+			rb_debug ("saving podcast playback position %lu", cur_time);
+			g_value_init (&val, G_TYPE_ULONG);
+			g_value_set_ulong (&val, cur_time);
+			rhythmdb_entry_set (player->priv->db, old_entry, RHYTHMDB_PROP_PLAYBACK_POS, &val);
+			g_value_unset (&val);
+		}
+	}
+ }
+
 gboolean
 rb_shell_player_get_playing_path (RBShellPlayer *shell_player,
 				  const gchar **path,
Index: plugins/generic-player/rb-generic-player-source.c
===================================================================
--- plugins/generic-player/rb-generic-player-source.c	(revision 5266)
+++ plugins/generic-player/rb-generic-player-source.c	(working copy)
@@ -217,7 +217,6 @@
 set_playlist_formats (RBGenericPlayerSource *source, char **formats)
 {
 	RBGenericPlayerSourcePrivate *priv = GENERIC_PLAYER_SOURCE_GET_PRIVATE (source);
-	RhythmDBEntryType entry_type;
 	int fmt;
 
 	priv->playlist_format_unknown = TRUE;
Index: widgets/rb-header.c
===================================================================
--- widgets/rb-header.c	(revision 5266)
+++ widgets/rb-header.c	(working copy)
@@ -479,17 +479,13 @@
 	seconds = header->priv->elapsed_time;
 
 	if (header->priv->duration > 0) {
-		double progress = 0.0;
-
-		if (seconds > 0) {
-			progress = (double) seconds;
-		} else {
+		if (header->priv->adjustment->upper != header->priv->duration) {
 			header->priv->adjustment->upper = header->priv->duration;
 			g_signal_emit_by_name (G_OBJECT (header->priv->adjustment), "changed");
 		}
 
 		header->priv->slider_locked = TRUE;
-		gtk_adjustment_set_value (header->priv->adjustment, progress);
+		gtk_adjustment_set_value (header->priv->adjustment, (double) seconds);
 		header->priv->slider_locked = FALSE;
 		gtk_widget_set_sensitive (header->priv->scale, header->priv->seekable);
 	} else {
