[gedit-plugins] sessionsaver: use the uri instead of the GFile



commit c4497c20aa9683f388c3325d657edfeee0110065
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu May 26 17:29:18 2011 +0200

    sessionsaver: use the uri instead of the GFile

 plugins/sessionsaver/store.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/plugins/sessionsaver/store.py b/plugins/sessionsaver/store.py
index 1938015..969ec8d 100644
--- a/plugins/sessionsaver/store.py
+++ b/plugins/sessionsaver/store.py
@@ -111,8 +111,8 @@ class XMLSessionStore(SessionStore):
                      .replace('"', '&quot;')
 
     def _dump_session(self, session):
-        files = ''.join(['  <file path="%s"/>\n' % self._escape(filename)
-                            for filename in session.files])
+        files = ''.join(['  <file path="%s"/>\n' % self._escape(location.get_uri())
+                            for location in session.files])
         session_name = self._escape(session.name)
         return '<session name="%s">\n%s</session>\n' % (session_name, files)
 
@@ -140,7 +140,10 @@ class XMLSessionStore(SessionStore):
         parser.EndElementHandler = self._expat_end_handler
 
         self._current_session = None
-        parser.ParseFile(open(self.filename, 'rb'))
+        try:
+            parser.ParseFile(open(self.filename, 'rb'))
+        except:
+            return
         del self._current_session
 
     def _expat_start_handler(self, tag, attr):



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