[rygel] media-export: Move file information query



commit 081631721ce206cdb704e7b6f2c01ac6de555e3a
Author: Jens Georg <mail jensge org>
Date:   Fri Jan 2 17:45:46 2015 +0100

    media-export: Move file information query
    
    The code would also try to query file information on removed files which
    would silently fail on the remove event and never propagate the change
    information to the parent folders.
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741953

 .../media-export/rygel-media-export-harvester.vala |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala 
b/src/plugins/media-export/rygel-media-export-harvester.vala
index 9cc1cc1..1c9038b 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -144,15 +144,17 @@ internal class Rygel.MediaExport.Harvester : GLib.Object {
                                   File?            other,
                                   FileMonitorEvent event) {
         try {
-            var info = file.query_info (FileAttribute.STANDARD_TYPE,
-                                        FileQueryInfoFlags.NONE,
-                                        this.cancellable);
             switch (event) {
-                case FileMonitorEvent.CREATED:
+                case FileMonitorEvent.CREATED: {
+                    var info = file.query_info (FileAttribute.STANDARD_TYPE,
+                                                FileQueryInfoFlags.NONE,
+                                                this.cancellable);
+
                     if (info.get_file_type () == FileType.DIRECTORY) {
                         this.on_changes_done (file);
                     }
                     break;
+                }
                 case FileMonitorEvent.CHANGES_DONE_HINT:
                     this.on_changes_done (file);
                     break;
@@ -162,7 +164,11 @@ internal class Rygel.MediaExport.Harvester : GLib.Object {
                 default:
                     break;
             }
-        } catch (Error error) { }
+        } catch (Error error) {
+            debug ("Failed to query information for %s: %s",
+                   file.get_uri (),
+                   error.message);
+        }
     }
 
     private void on_file_added (File file) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]