[rygel] media-export: hook up file monitor
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] media-export: hook up file monitor
- Date: Wed, 9 Sep 2009 20:38:37 +0000 (UTC)
commit f4331d7489d3fcc7d1e7e4d5488fbb5f11ec7755
Author: Jens Georg <mail jensge org>
Date: Sat Jun 27 03:04:01 2009 +0200
media-export: hook up file monitor
.../media-export/rygel-media-export-harvester.vala | 8 +++++-
.../rygel-media-export-root-container.vala | 24 ++++++++++++++++++-
2 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala b/src/plugins/media-export/rygel-media-export-harvester.vala
index 2dcb3be..ee59285 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -59,10 +59,12 @@ public class Rygel.MediaExportHarvester : GLib.Object {
private Queue<File> files;
private File origin;
private MediaContainer parent;
+ private MediaExportRecursiveFileMonitor monitor;
public MediaExportHarvester (MediaContainer parent,
MediaDB media_db,
- MetadataExtractor extractor) {
+ MetadataExtractor extractor,
+ MediaExportRecursiveFileMonitor monitor) {
this.parent = parent;
this.extractor = extractor;
this.media_db = media_db;
@@ -71,6 +73,8 @@ public class Rygel.MediaExportHarvester : GLib.Object {
this.files = new Queue<File> ();
this.containers = new Queue<DummyContainer> ();
this.origin = null;
+ this.monitor = monitor;
+
Idle.add (this.on_idle);
}
@@ -101,6 +105,7 @@ public class Rygel.MediaExportHarvester : GLib.Object {
var dir = ((DummyContainer)this.containers.peek_head ()).file;
var file = dir.get_child (info.get_name ());
if (info.get_file_type () == FileType.DIRECTORY) {
+ monitor.monitor (file);
this.containers.push_tail (
new DummyContainer (file,
this.containers.peek_head ()));
@@ -189,6 +194,7 @@ public class Rygel.MediaExportHarvester : GLib.Object {
null);
if (info.get_file_type () == FileType.DIRECTORY) {
this.origin = file;
+ monitor.monitor (file);
this.containers.push_tail (
new DummyContainer (file,
this.parent));
diff --git a/src/plugins/media-export/rygel-media-export-root-container.vala b/src/plugins/media-export/rygel-media-export-root-container.vala
index eafc14b..f902f00 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -69,6 +69,8 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
this.harvester = new ArrayList<MediaExportHarvester> ();
this.monitor = new MediaExportRecursiveFileMonitor (null);
+ this.monitor.changed.connect (this.on_file_changed);
+
var uris = get_uris ();
foreach (var uri in uris) {
@@ -77,13 +79,31 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
var id = Checksum.compute_for_string (ChecksumType.MD5,
file.get_uri ());
if (!this.media_db.exists (id)) {
+ debug ("Found new directory %s",
+ file.get_uri ());
var harvest = new MediaExportHarvester (this,
- media_db,
- extractor);
+ this.media_db,
+ this.extractor,
+ this.monitor);
this.harvester.add (harvest);
harvest.harvest (file);
}
}
}
}
+
+ private void on_file_changed (File file,
+ File? other,
+ FileMonitorEvent event) {
+ switch (event) {
+ case FileMonitorEvent.CREATED:
+ break;
+ case FileMonitorEvent.CHANGES_DONE_HINT:
+ break;
+ case FileMonitorEvent.DELETED:
+ break;
+ default:
+ break;
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]