[gedit-latex] Fix "new document" (replaced obsolete method to get encoding)



commit 68be8fda121899001f2fb588283de92ffab94a5d
Author: Pietro Battiston <pbattiston src gnome org>
Date:   Sat Apr 30 19:22:31 2016 +0200

    Fix "new document" (replaced obsolete method to get encoding)

 latex/windowactivatable.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/latex/windowactivatable.py b/latex/windowactivatable.py
index f373c2d..dcaa2ec 100644
--- a/latex/windowactivatable.py
+++ b/latex/windowactivatable.py
@@ -348,8 +348,14 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
 
         if Gedit.utils_is_valid_location(gfile):
             LOG.debug("GeditWindow.create_tab_from_uri(%s)" % uri)
+            try:
+                view = self.window.get_active_view()
+                encoding = view.get_buffer().get_encoding()
+            except AttributeError:
+                # No document open
+                encoding = None
             self.window.create_tab_from_location(
-                            gfile, Gedit.gedit_encoding_get_current(),
+                            gfile, encoding,
                             1, 1, False, True)
         else:
             LOG.error("Gedit.utils.uri_is_valid(%s) = False" % uri)


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