[banshee] [gio] Dispose FileInfos in DemuxVfs



commit deeef12763c587f340e3dd66ffcad9374b1346bb
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Wed Mar 17 14:10:11 2010 -0700

    [gio] Dispose FileInfos in DemuxVfs

 .../Banshee.Gio/Banshee.IO.Gio/DemuxVfs.cs         |   26 +++++--------------
 .../Hyena/Hyena.Data.Sqlite/HyenaSqliteCommand.cs  |    2 +-
 2 files changed, 8 insertions(+), 20 deletions(-)
---
diff --git a/src/Backends/Banshee.Gio/Banshee.IO.Gio/DemuxVfs.cs b/src/Backends/Banshee.Gio/Banshee.IO.Gio/DemuxVfs.cs
index beebca5..4a347b1 100644
--- a/src/Backends/Banshee.Gio/Banshee.IO.Gio/DemuxVfs.cs
+++ b/src/Backends/Banshee.Gio/Banshee.IO.Gio/DemuxVfs.cs
@@ -33,25 +33,18 @@ using Banshee.Base;
 
 namespace Banshee.IO.Gio
 {
-    public class DemuxVfs : IDemuxVfs, IDisposable
+    public class DemuxVfs : IDemuxVfs
     {
         private GLib.File file;
-        private GLib.FileInfo file_info;
 
         public DemuxVfs (string path)
         {
             file = path.StartsWith ("/") ? FileFactory.NewForPath (path) : FileFactory.NewForUri (path);
-
             if (file.Exists) {
-                file_info = file.QueryInfo ("etag::value,access::can-read,access::can-write", FileQueryInfoFlags.None, null);
-            }
-        }
-
-        public void Dispose ()
-        {
-            if (file_info != null) {
-                file_info.Dispose ();
-                file_info = null;
+                using (var info = file.QueryInfo ("etag::value,access::can-read,access::can-write", FileQueryInfoFlags.None, null)) {
+                    IsReadable = info.GetAttributeBoolean ("access::can-read");
+                    IsWritable = info.GetAttributeBoolean ("access::can-write");
+                }
             }
         }
 
@@ -76,12 +69,7 @@ namespace Banshee.IO.Gio
             }
         }
 
-        public bool IsReadable {
-            get { return file_info == null ? true : file_info.GetAttributeBoolean ("access::can-read"); }
-        }
-
-        public bool IsWritable {
-            get { return file_info == null ? true : file_info.GetAttributeBoolean ("access::can-write"); }
-        }
+        public bool IsReadable { get; private set; }
+        public bool IsWritable { get; private set; }
     }
 }
diff --git a/src/Libraries/Hyena/Hyena.Data.Sqlite/HyenaSqliteCommand.cs b/src/Libraries/Hyena/Hyena.Data.Sqlite/HyenaSqliteCommand.cs
index 9b0a386..a550d0a 100644
--- a/src/Libraries/Hyena/Hyena.Data.Sqlite/HyenaSqliteCommand.cs
+++ b/src/Libraries/Hyena/Hyena.Data.Sqlite/HyenaSqliteCommand.cs
@@ -120,7 +120,7 @@ namespace Hyena.Data.Sqlite
                         Log.DebugFormat ("Executed in {0}ms {1}", execution_ms, sql_command.CommandText);
                     }
                 } catch (Exception e) {
-                    Log.Exception (sql_command.CommandText, e);
+                    Log.DebugFormat ("Exception executing command: {0}", sql_command.CommandText);
                     execution_exception = e;
                 }
             }



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