[rhythmbox] [ipod] rework iPod database saving
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] [ipod] rework iPod database saving
- Date: Sat, 2 Oct 2010 11:47:19 +0000 (UTC)
commit c7d5a04c92a474fb1b28961420cabdd510dc84ad
Author: Christophe Fergeau <teuf gnome org>
Date: Tue Mar 23 17:32:35 2010 +0100
[ipod] rework iPod database saving
When it has been modified, the saving of the iPod database is made
asynchronously after 15 seconds with no change. When lots of tracks are
copied to an iPod, this saving is triggered every 15 seconds during the
transfer which can slow the transfer down (especially on iPhone-like
devices). It makes more sense to only save the database once all transfers
are done, and not to wait 15 seconds for the final save, but 2 seconds.
With a 15 seconds delay, people don't wait long enough before unplugging
their device (especially on iOS devices)
plugins/ipod/rb-ipod-db.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/plugins/ipod/rb-ipod-db.c b/plugins/ipod/rb-ipod-db.c
index 367dc56..fe44ce5 100644
--- a/plugins/ipod/rb-ipod-db.c
+++ b/plugins/ipod/rb-ipod-db.c
@@ -859,13 +859,15 @@ rb_ipod_db_save_async (RbIpodDb *ipod_db)
RbIpodDbPrivate *priv = IPOD_DB_GET_PRIVATE (ipod_db);
if (priv->save_timeout_id == 0) {
- rb_debug ("Scheduling iPod database save in 15 seconds");
- priv->save_timeout_id = g_timeout_add_seconds (15,
- (GSourceFunc)save_timeout_cb,
- ipod_db);
+ RbIpodDbPrivate *priv = IPOD_DB_GET_PRIVATE (ipod_db);
+ rb_debug ("Scheduling iPod database save in 2 seconds");
} else {
- rb_debug ("Database save already scheduled");
+ g_source_remove (priv->save_timeout_id);
+ rb_debug ("Database save already scheduled, pushing back save in 2 seconds from now");
}
+ priv->save_timeout_id = g_timeout_add_seconds (2,
+ (GSourceFunc)save_timeout_cb,
+ ipod_db);
}
GList *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]