[conduit] Fix #575000



commit 1fb009f3a92f1876325cd8a01fe6293b80937a1f
Author: John Stowers <john stowers gmail com>
Date:   Wed Jul 1 09:47:36 2009 +1200

    Fix #575000

 NEWS                                            |    2 +-
 conduit/gtkui/Database.py                       |    6 +++++-
 conduit/modules/FileModule/FileConfiguration.py |    7 ++-----
 conduit/modules/FileModule/FileModule.py        |   14 --------------
 4 files changed, 8 insertions(+), 21 deletions(-)
---
diff --git a/NEWS b/NEWS
index d11b7f7..7606808 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 NEW in 0.3.17:
 ==============
-
+ * Fixed 575000, why am I asked to "name" folders in the "files" data provider?
 
 NEW in 0.3.16:
 ==============
diff --git a/conduit/gtkui/Database.py b/conduit/gtkui/Database.py
index ce7c8f9..c32d9fb 100644
--- a/conduit/gtkui/Database.py
+++ b/conduit/gtkui/Database.py
@@ -112,7 +112,11 @@ class GenericDBListStore(gtk.GenericTreeModel):
         Parameters:
             offset -- the rows offset from 0.
         """
-        (oid,) = self.db.select_one("SELECT oid FROM %s LIMIT 1 OFFSET %d" % (self.table, offset))
+        try:
+            (oid,) = self.db.select_one("SELECT oid FROM %s LIMIT 1 OFFSET %d" % (self.table, offset))
+        except TypeError:
+            #Stops a crash at exit when the db is closed before the UI
+            oid = None
         return oid
     
     @DB.lru_cache(0)
diff --git a/conduit/modules/FileModule/FileConfiguration.py b/conduit/modules/FileModule/FileConfiguration.py
index 15c0fb9..3407afa 100644
--- a/conduit/modules/FileModule/FileConfiguration.py
+++ b/conduit/modules/FileModule/FileConfiguration.py
@@ -208,9 +208,10 @@ class _FileSourceConfigurator(Vfs.FolderScannerThreadManager, Configurator.BaseC
         Adds the folder to the db. Starts a thread to scan it in the background
         """
         if folderURI not in self.scanThreads:
+            name = Vfs.uri_get_filename(folderURI)
             oid = self.db.insert(
                         table="config",
-                        values=(folderURI,FileDataProvider.TYPE_FOLDER,0,False,"")
+                        values=(folderURI,FileDataProvider.TYPE_FOLDER,0,False,name)
                         )
             self.make_thread(
                     folderURI,
@@ -261,8 +262,6 @@ class _FileSourceConfigurator(Vfs.FolderScannerThreadManager, Configurator.BaseC
         response = dialog.run()
         if response == gtk.RESPONSE_OK:
             fileURI = dialog.get_uri()
-            #FIXME: Returns a quoted uri string. Inconsistant with other gnomevfs methods
-            #fileURI = Vfs.uri_unescape(fileURI)
             self._add_file(fileURI)
         elif response == gtk.RESPONSE_CANCEL:
             pass
@@ -283,8 +282,6 @@ class _FileSourceConfigurator(Vfs.FolderScannerThreadManager, Configurator.BaseC
         response = dialog.run()
         if response == gtk.RESPONSE_OK:
             folderURI = dialog.get_uri()
-            #FIXME: Returns a quoted uri string. Inconsistant with other gnomevfs methods
-            #folderURI = Vfs.uri_unescape(folderURI)
             self._add_folder(folderURI)
         elif response == gtk.RESPONSE_CANCEL:
             pass
diff --git a/conduit/modules/FileModule/FileModule.py b/conduit/modules/FileModule/FileModule.py
index d98beae..e22ffe7 100644
--- a/conduit/modules/FileModule/FileModule.py
+++ b/conduit/modules/FileModule/FileModule.py
@@ -71,20 +71,6 @@ class FileSource(FileDataProvider.FileSource):
     def get_folders(self):
         self._get_files_folders(get_folders = True)        
 
-    '''
-    def get_configuration_(self):
-        files = []
-        folders = []
-        for uri,ftype,group in self.db.select("SELECT URI,TYPE,GROUP_NAME FROM config"):
-            if ftype == FileDataProvider.TYPE_FILE:
-                files.append(uri)
-            else:
-                folders.append("%s---FIXME---%s" % (uri,group))
-
-        return {"files" : files,
-                "folders" : folders}
-    '''
-
     def get_UID(self):
         return Utils.get_user_string()
 



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