[rygel] media-export: Suppress useless warning



commit 83850b30b849de599d6b980908b45db5118c7d3a
Author: Jens Georg <mail jensge org>
Date:   Sat Apr 30 17:58:49 2016 +0200

    media-export: Suppress useless warning
    
    If the backend does not support monitoring, just issue a debug and not a
    warning that we were not able to get the file information.
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685800

 .../rygel-media-export-recursive-file-monitor.vala |   26 +++++++++++--------
 1 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-recursive-file-monitor.vala 
b/src/plugins/media-export/rygel-media-export-recursive-file-monitor.vala
index 48772be..3fce5ae 100644
--- a/src/plugins/media-export/rygel-media-export-recursive-file-monitor.vala
+++ b/src/plugins/media-export/rygel-media-export-recursive-file-monitor.vala
@@ -84,23 +84,27 @@ public class Rygel.MediaExport.RecursiveFileMonitor : Object {
                                          FileQueryInfoFlags.NONE,
                                          Priority.DEFAULT,
                                          null);
-            if (info.get_file_type () == FileType.DIRECTORY) {
-                var file_monitor = file.monitor_directory
-                                        (FileMonitorFlags.NONE,
-                                         this.cancellable);
-                this.monitors.set (file, file_monitor);
-                file_monitor.changed.connect (this.on_monitor_changed);
+            if (info.get_file_type () != FileType.DIRECTORY) {
+                return;
             }
+
+            var file_monitor = file.monitor_directory (FileMonitorFlags.NONE,
+                                                       this.cancellable);
+            this.monitors.set (file, file_monitor);
+            file_monitor.changed.connect (this.on_monitor_changed);
         } catch (Error err) {
-            if (!(err is IOError.NOT_FOUND)) {
+            if (err is IOError.NOT_FOUND) {
+                debug ("File %s disappeared while trying to get information",
+                       file.get_uri ());
+            } else if (err is IOError.NOT_SUPPORTED) {
+                debug ("File monitoring is not supported for %s",
+                       file.get_uri ());
+            } else {
                 // Avoid warning when file is removed in the meantime, e.g. in
                 // upload case.
-                warning (_("Failed to get file information for %s: %s"),
+                warning (_("Failed to setup up file monitor for %s: %s"),
                          file.get_uri (),
                          err.message);
-            } else {
-                debug ("File %s disappeared while trying to get information",
-                       file.get_uri ());
             }
         }
     }


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