[gedit-plugins] sessionsaver: fix some method calls



commit 98b3bce0ecf9deefa1edeff779dd8170192e9577
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Jun 10 23:06:30 2011 +0200

    sessionsaver: fix some method calls

 plugins/sessionsaver/__init__.py |    5 ++++-
 plugins/sessionsaver/dialogs.py  |    6 +++---
 plugins/sessionsaver/store.py    |    2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/plugins/sessionsaver/__init__.py b/plugins/sessionsaver/__init__.py
index 26bbc65..b8f2aa1 100644
--- a/plugins/sessionsaver/__init__.py
+++ b/plugins/sessionsaver/__init__.py
@@ -120,6 +120,9 @@ class SessionSaverPlugin(GObject.Object, Gedit.WindowActivatable):
         manager.ensure_update()
 
     def _remove_session_menu(self):
+        if not self._menu_ui_id:
+            return
+
         manager = self.window.get_ui_manager()
         manager.remove_ui(self._menu_ui_id)
 
@@ -154,7 +157,7 @@ class SessionSaverPlugin(GObject.Object, Gedit.WindowActivatable):
         Gedit.commands_load_locations(window, session.files, None, 0, 0)
 
     def on_save_session_action(self, action, window):
-        SaveSessionDialog(window, self, self.sessions, self).run()
+        SaveSessionDialog(window, self, self.sessions).run()
 
     def on_manage_sessions_action(self, action, window):
         SessionManagerDialog(self, self.sessions).run()
diff --git a/plugins/sessionsaver/dialogs.py b/plugins/sessionsaver/dialogs.py
index 2824668..66dd507 100644
--- a/plugins/sessionsaver/dialogs.py
+++ b/plugins/sessionsaver/dialogs.py
@@ -88,13 +88,13 @@ class Dialog(object):
         self.__del__()
 
 class SaveSessionDialog(Dialog):
-    def __init__(self, window, plugin, sessions, sessionsaver):
+    def __init__(self, window, plugin, sessions):
         super(SaveSessionDialog, self).__init__('save-session-dialog',
                                                 plugin.plugin_info.get_data_dir(),
                                                 window)
         self.plugin = plugin
         self.sessions = sessions
-        self.sessionsaver = sessionsaver
+        self.sessionsaver = plugin
 
         model = SessionModel(sessions)
 
@@ -158,7 +158,7 @@ class SessionManagerDialog(Dialog):
     def on_delete_button_clicked(self, button):
         session = self.get_current_session()
         self.sessions.remove(session)
-        self.plugin.update_session_menu()
+        self.plugin._update_session_menu()
 
     def on_close_button_clicked(self, button):
         self.sessions.save()
diff --git a/plugins/sessionsaver/store.py b/plugins/sessionsaver/store.py
index 969ec8d..e0b5c39 100644
--- a/plugins/sessionsaver/store.py
+++ b/plugins/sessionsaver/store.py
@@ -113,7 +113,7 @@ class XMLSessionStore(SessionStore):
     def _dump_session(self, session):
         files = ''.join(['  <file path="%s"/>\n' % self._escape(location.get_uri())
                             for location in session.files])
-        session_name = self._escape(session.name)
+        session_name = self._escape(str(session.name))
         return '<session name="%s">\n%s</session>\n' % (session_name, files)
 
     def dump(self):



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