Blob Blame History Raw
Index: src/filechooser.py
===================================================================
--- src/filechooser.py	(revision 307)
+++ src/filechooser.py	(revision 309)
@@ -191,13 +191,16 @@
             self.filechooser.set_filter(filters[
                 prefs['last filter in main filechooser']])
         except:
-            pass
+            self.filechooser.set_filter(filters[0])
 
     def files_chosen(self, paths):
         if paths:
-            current_filter_index = self.filechooser.list_filters().index(
-                self.filechooser.get_filter())
-            prefs['last filter in main filechooser'] = current_filter_index
+            try: # For some reason this fails sometimes (GTK+ bug?)
+                filter_index = self.filechooser.list_filters().index(
+                    self.filechooser.get_filter())
+                prefs['last filter in main filechooser'] = filter_index
+            except:
+                pass
             _close_main_filechooser_dialog()
             self._window.file_handler.open_file(paths[0])
         else:
@@ -235,8 +238,8 @@
         try:
             self.filechooser.set_filter(filters[
                 prefs['last filter in library filechooser']])
-        except:
-            pass
+        except Exception:
+            self.filechooser.set_filter(filters[1])
     
     def _set_collection_name(self, *args):
         """Set the text in the ComboBoxEntry to the name of the current
@@ -255,9 +258,12 @@
             else:
                 prefs['auto add books into collections'] = False
                 collection_name = None
-            current_filter_index = self.filechooser.list_filters().index(
-                self.filechooser.get_filter())
-            prefs['last filter in library filechooser'] = current_filter_index
+            try: # For some reason this fails sometimes (GTK+ bug?)
+                filter_index = self.filechooser.list_filters().index(
+                    self.filechooser.get_filter())
+                prefs['last filter in library filechooser'] = filter_index
+            except Exception:
+                pass
             close_library_filechooser_dialog()
             self._library.add_books(paths, collection_name)
         else: