[gedit-latex] Dont crash when hiding toolbars.



commit 73987b05cb915588b36df05805daef860146ea96
Author: John Stowers <john stowers gmail com>
Date:   Wed Jun 29 18:31:26 2011 +1200

    Dont crash when hiding toolbars.
    
    This is really hacky. There are so many circular window -> tab
    -> view -> tab -> window reference chains it is confusing

 latex/base/windowactivatable.py |    8 ++++++++
 latex/latex/editor.py           |    4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/latex/base/windowactivatable.py b/latex/base/windowactivatable.py
index a47cc2d..3be7e3c 100644
--- a/latex/base/windowactivatable.py
+++ b/latex/base/windowactivatable.py
@@ -309,6 +309,14 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
         """
         self._save_action.activate()
 
+    def show_toolbar(self):
+        if self._toolbar:
+            self._toolbar.show()
+
+    def hide_toolbar(self):
+        if self._toolbar:
+            self._toolbar.hide()
+
     def _on_tools_changed(self):
         self._log.debug("_on_tools_changed")
 
diff --git a/latex/latex/editor.py b/latex/latex/editor.py
index 926a7fb..6a9b9e8 100644
--- a/latex/latex/editor.py
+++ b/latex/latex/editor.py
@@ -114,9 +114,9 @@ class LaTeXEditor(Editor, IIssueHandler):
         elif key == "show-latex-toolbar":
             show_toolbar = self._preferences.get_bool("show-latex-toolbar")
             if show_toolbar:
-                self._window_context._window_decorator._toolbar.show()
+                self._window_context._window_decorator.show_toolbar()
             else:
-                self._window_context._window_decorator._toolbar.hide()
+                self._window_context._window_decorator.hide_toolbar()
 
     def drag_drop_received(self, files):
         # see base.Editor.drag_drop_received



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