aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-07-05 08:46:53 +0200
committerMax Kellermann <max@duempel.org>2009-07-05 08:46:53 +0200
commitd4914fc9ef4fda21f833e88a59d50d54fafd6379 (patch)
treee9a7f3bab19ac13227e9e44e75e91fd27a15ef95
parent46c19b82494c9954fd6dafb955a1a5851e20d44d (diff)
downloadmpd-d4914fc9ef4fda21f833e88a59d50d54fafd6379.tar.gz
mpd-d4914fc9ef4fda21f833e88a59d50d54fafd6379.tar.xz
mpd-d4914fc9ef4fda21f833e88a59d50d54fafd6379.zip
idle: added "update" event
Some clients have visual feedback for "database update is running". Using the "database" idle event is unreliable, because it is only emitted when the database was actually modified. This patch adds the "update" event, which is emitted when the update is started, and again when the update is finished, disregarding whether it has been modified.
-rw-r--r--NEWS1
-rw-r--r--doc/protocol.xml11
-rw-r--r--src/idle.c1
-rw-r--r--src/idle.h3
-rw-r--r--src/update.c5
5 files changed, 20 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index a8828d345..168c3dc48 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
ver 0.16 (20??/??/??)
* protocol:
- send song modification time to client
+ - added "update" idle event
* decoders:
- ffmpeg: support multiple tags
* mixers:
diff --git a/doc/protocol.xml b/doc/protocol.xml
index 7ef1dc379..6b2ff587f 100644
--- a/doc/protocol.xml
+++ b/doc/protocol.xml
@@ -134,7 +134,16 @@
<listitem>
<para>
<returnvalue>database</returnvalue>: the song database
- has been updated
+ has been modified
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <returnvalue>update</returnvalue>: a database update
+ has started or finished. If the database was
+ modified during the update, the
+ <returnvalue>database</returnvalue> event is also
+ emitted.
</para>
</listitem>
<listitem>
diff --git a/src/idle.c b/src/idle.c
index 11b57376d..c0bb7a908 100644
--- a/src/idle.c
+++ b/src/idle.c
@@ -40,6 +40,7 @@ static const char *const idle_names[] = {
"output",
"options",
"sticker",
+ "update",
NULL
};
diff --git a/src/idle.h b/src/idle.h
index a69acabb0..c8ed57f74 100644
--- a/src/idle.h
+++ b/src/idle.h
@@ -50,6 +50,9 @@ enum {
/** a sticker has been modified. */
IDLE_STICKER = 0x80,
+
+ /** a database update has started or finished. */
+ IDLE_UPDATE = 0x100,
};
/**
diff --git a/src/update.c b/src/update.c
index 1088f5338..d3e3b7650 100644
--- a/src/update.c
+++ b/src/update.c
@@ -822,6 +822,9 @@ directory_update_init(char *path)
return next_task_id > update_task_id_max ? 1 : next_task_id;
}
spawn_update_task(path);
+
+ idle_add(IDLE_UPDATE);
+
return update_task_id;
}
@@ -861,6 +864,8 @@ static void update_finished_event(void)
g_thread_join(update_thr);
+ idle_add(IDLE_UPDATE);
+
if (modified) {
/* send "idle" events */
playlistVersionChange(&g_playlist);