Index: rb-daap-connection.c
===================================================================
--- rb-daap-connection.c	(revision 5544)
+++ rb-daap-connection.c	(working copy)
@@ -47,6 +47,7 @@
 #include "rb-util.h"
 
 #define RB_DAAP_USER_AGENT "iTunes/4.6 (Windows; N)"
+#define RB_DAAP_REFRESH_TIMEOUT 20000
 
 static void      rb_daap_connection_dispose      (GObject *obj);
 static void      rb_daap_connection_set_property (GObject *object,
@@ -93,6 +94,7 @@
 
 	gint request_id;
 	gint database_id;
+	gint refresh_timeout;
 
 	guint reading_playlist;
 	GSList *playlists;
@@ -781,7 +783,20 @@
 		return;
 	}
 
-	priv->revision_number = g_value_get_int (&(item->content));
+	gint new_revision = g_value_get_int (&(item->content));
+
+	if (new_revision > priv->revision_number) {
+		rb_debug("updating revision number from %d to %d", priv->revision_number, new_revision);
+		priv->revision_number = new_revision;
+
+		if (priv->state == DAAP_REFRESH)
+			priv->state = DAAP_GET_REVISION_NUMBER;
+	}
+	else {
+		rb_debug("same revision at %d, not doing anything", priv->revision_number);
+	}
+
+
 	rb_daap_connection_state_done (connection, TRUE);
 }
 
@@ -1454,6 +1469,10 @@
 			/* uhh.. */
 			rb_debug ("This should never happen.");
 			break;
+		case DAAP_REFRESH:
+			rb_debug ("Setting state back to done after refresh");
+			priv->state = DAAP_DONE;
+			break;
 
 		default:
 			/* in most states, we just move on to the next */
@@ -1630,6 +1649,18 @@
 		rb_daap_connection_finish (connection);
 
 		break;
+
+	case DAAP_REFRESH:
+		rb_debug("Checking for new database revision");
+		path = g_strdup_printf ("/update?session-id=%u&revision-number=1", priv->session_id);
+		if (! http_get (connection, path, TRUE, priv->daap_version, 0, FALSE,
+			       (RBDAAPResponseHandler) handle_update, FALSE)) {
+			rb_debug ("Could not get server database revision number");
+			rb_daap_connection_state_done (connection, FALSE);
+		}
+		g_free (path);
+		break;
+
 	}
 
 	return FALSE;
@@ -1696,6 +1727,21 @@
 	return connection->priv->playlists;
 }
 
+gboolean
+rb_daap_connection_refresh_cb (RBDAAPConnection *connection) {
+	if (connection->priv->state == DAAP_DONE) {
+		connection->priv->state = DAAP_REFRESH;
+		rb_daap_connection_do_something(connection);
+	}
+	return TRUE;
+}
+
+void
+rb_daap_connection_refresh_init (RBDAAPConnection *connection)
+{
+	connection->priv->refresh_timeout = g_timeout_add(RB_DAAP_REFRESH_TIMEOUT, (GSourceFunc) rb_daap_connection_refresh_cb, connection);
+}
+
 static void
 rb_daap_connection_dispose (GObject *object)
 {
@@ -1704,6 +1750,11 @@
 
 	rb_debug ("DAAP connection dispose");
 
+	if (priv->refresh_timeout != 0) {
+		g_source_remove (priv->refresh_timeout);
+		priv->refresh_timeout = 0;
+	}
+
 	if (priv->emit_progress_id != 0) {
 		g_source_remove (priv->emit_progress_id);
 		priv->emit_progress_id = 0;
Index: rb-daap-source.c
===================================================================
--- rb-daap-source.c	(revision 5544)
+++ rb-daap-source.c	(working copy)
@@ -431,6 +431,7 @@
 		source->priv->connection_status = _("Retrieving songs from music share");
 		break;
 	case DAAP_LOGOUT:
+	case DAAP_REFRESH:
 	case DAAP_DONE:
 		source->priv->connection_status = NULL;
 		break;
@@ -544,6 +545,7 @@
 
 	g_object_unref (shell);
 	g_boxed_free (RHYTHMDB_TYPE_ENTRY_TYPE, entry_type);
+	rb_daap_connection_refresh_init( RB_DAAP_CONNECTION (daap_source->priv->connection) );
 }
 
 static void
Index: rb-daap-connection.h
===================================================================
--- rb-daap-connection.h	(revision 5544)
+++ rb-daap-connection.h	(working copy)
@@ -54,7 +54,8 @@
 	DAAP_GET_PLAYLISTS,
 	DAAP_GET_PLAYLIST_ENTRIES,
 	DAAP_LOGOUT,
-	DAAP_DONE
+	DAAP_DONE,
+	DAAP_REFRESH
 } RBDAAPConnectionState;
 
 typedef struct {
@@ -107,6 +108,9 @@
 
 GSList *           rb_daap_connection_get_playlists   (RBDAAPConnection         *connection);
 
+gboolean           rb_daap_connection_refresh_cb (RBDAAPConnection *connection);
+void               rb_daap_connection_refresh_init (RBDAAPConnection *connection);
+
 G_END_DECLS
 
 #endif /* __RB_DAAP_CONNECTION_H */
