[rhythmbox] rhythmdb: use specific entry types on mount/unmount events
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] rhythmdb: use specific entry types on mount/unmount events
- Date: Tue, 20 Jul 2010 02:40:32 +0000 (UTC)
commit c1d961db73ddd1c570b157e7ab51a221c74dccfa
Author: Jonathan Matthew <jonathan d14n org>
Date: Tue Jul 20 12:06:27 2010 +1000
rhythmdb: use specific entry types on mount/unmount events
rhythmdb/rhythmdb-monitor.c | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/rhythmdb/rhythmdb-monitor.c b/rhythmdb/rhythmdb-monitor.c
index b4749ad..380d7e4 100644
--- a/rhythmdb/rhythmdb-monitor.c
+++ b/rhythmdb/rhythmdb-monitor.c
@@ -428,11 +428,6 @@ entry_volume_mounted_or_unmounted (RhythmDBEntry *entry,
RBRefString *mount_point;
const char *location;
- if (entry->type != RHYTHMDB_ENTRY_TYPE_SONG &&
- entry->type != RHYTHMDB_ENTRY_TYPE_IMPORT_ERROR) {
- return;
- }
-
mount_point = rhythmdb_entry_get_refstring (entry, RHYTHMDB_PROP_MOUNTPOINT);
if (mount_point == NULL || !rb_refstring_equal (mount_point, ctxt->mount_point)) {
return;
@@ -495,9 +490,14 @@ rhythmdb_mount_added_cb (GVolumeMonitor *monitor,
ctxt.db = db;
ctxt.mounted = TRUE;
rb_debug ("volume %s mounted", rb_refstring_get (ctxt.mount_point));
- rhythmdb_entry_foreach (db,
- (GFunc)entry_volume_mounted_or_unmounted,
- &ctxt);
+ rhythmdb_entry_foreach_by_type (db,
+ RHYTHMDB_ENTRY_TYPE_SONG,
+ (GFunc) entry_volume_mounted_or_unmounted,
+ &ctxt);
+ rhythmdb_entry_foreach_by_type (db,
+ RHYTHMDB_ENTRY_TYPE_IMPORT_ERROR,
+ (GFunc) entry_volume_mounted_or_unmounted,
+ &ctxt);
rhythmdb_commit (db);
rb_refstring_unref (ctxt.mount_point);
}
@@ -521,9 +521,14 @@ rhythmdb_mount_removed_cb (GVolumeMonitor *monitor,
ctxt.db = db;
ctxt.mounted = FALSE;
rb_debug ("volume %s unmounted", rb_refstring_get (ctxt.mount_point));
- rhythmdb_entry_foreach (db,
- (GFunc)entry_volume_mounted_or_unmounted,
- &ctxt);
+ rhythmdb_entry_foreach_by_type (db,
+ RHYTHMDB_ENTRY_TYPE_SONG,
+ (GFunc) entry_volume_mounted_or_unmounted,
+ &ctxt);
+ rhythmdb_entry_foreach_by_type (db,
+ RHYTHMDB_ENTRY_TYPE_IMPORT_ERROR,
+ (GFunc) entry_volume_mounted_or_unmounted,
+ &ctxt);
rhythmdb_commit (db);
rb_refstring_unref (ctxt.mount_point);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]