[gedit-plugins/wip/loader-saver: 3/3] Don't use gedit_document_get_location() (deprecated)



commit aa824eb7d4aae3ecb86e70eba81c1692ef98dd19
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Jul 1 13:20:44 2014 +0200

    Don't use gedit_document_get_location() (deprecated)
    
    Use gtk_source_file_get_location() instead.

 plugins/commander/commander/commands/completion.py |    2 +-
 plugins/commander/modules/edit.py                  |    4 ++--
 plugins/commander/modules/shell.py                 |    2 +-
 plugins/git/git/viewactivatable.py                 |    2 +-
 plugins/git/git/windowactivatable.py               |    6 +++---
 plugins/synctex/synctex/synctex.py                 |    4 ++--
 plugins/terminal/terminal.py                       |    2 +-
 plugins/zeitgeist/gedit-zeitgeist-plugin.c         |    5 +++--
 8 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/plugins/commander/commander/commands/completion.py 
b/plugins/commander/commander/commands/completion.py
index 199758c..2599a13 100644
--- a/plugins/commander/commander/commands/completion.py
+++ b/plugins/commander/commander/commands/completion.py
@@ -176,7 +176,7 @@ def filename(words, idx, view):
     doc = view.get_buffer()
 
     if not doc.is_untitled():
-        root = os.path.dirname(doc.get_location().get_path())
+        root = os.path.dirname(doc.get_file().get_location().get_path())
     else:
         root = os.path.expanduser('~/')
 
diff --git a/plugins/commander/modules/edit.py b/plugins/commander/modules/edit.py
index 73e8059..b1a3845 100644
--- a/plugins/commander/modules/edit.py
+++ b/plugins/commander/modules/edit.py
@@ -42,7 +42,7 @@ def __default__(filename, view):
     cwd = os.getcwd()
 
     if not doc.is_untitled():
-        cwd = doc.get_location().get_parent().get_path()
+        cwd = doc.get_file().get_location().get_parent().get_path()
     else:
         cwd = os.path.expanduser('~/')
 
@@ -85,7 +85,7 @@ def rename(view, newfile):
     if not doc.is_local():
         raise commander.commands.exceptions.Execute('You can only rename local files')
 
-    f = doc.get_location()
+    f = doc.get_file().get_location()
 
     if not f.query_exists(None):
         raise commander.commands.exceptions.Execute('Current document file does not exist')
diff --git a/plugins/commander/modules/shell.py b/plugins/commander/modules/shell.py
index 94f4610..5baae50 100644
--- a/plugins/commander/modules/shell.py
+++ b/plugins/commander/modules/shell.py
@@ -126,7 +126,7 @@ def _run_command(entry, replace, background, argstr):
     doc = entry.view().get_buffer()
 
     if not doc.is_untitled() and doc.is_local():
-        gfile = doc.get_location()
+        gfile = doc.get_file().get_location()
         cwd = os.path.dirname(gfile.get_path())
 
     if '<!' in argstr:
diff --git a/plugins/git/git/viewactivatable.py b/plugins/git/git/viewactivatable.py
index 76060b0..4dd9167 100644
--- a/plugins/git/git/viewactivatable.py
+++ b/plugins/git/git/viewactivatable.py
@@ -100,7 +100,7 @@ class GitViewActivatable(GObject.Object, Gedit.ViewActivatable):
         # update_location() as the buffer is currently empty
 
     def update_location(self, *args):
-        self.location = self.buffer.get_location()
+        self.location = self.buffer.get_file().get_location()
 
         repo = None
         if self.location is not None and self.location.has_uri_scheme('file'):
diff --git a/plugins/git/git/windowactivatable.py b/plugins/git/git/windowactivatable.py
index 7c5b8bb..cef4bca 100644
--- a/plugins/git/git/windowactivatable.py
+++ b/plugins/git/git/windowactivatable.py
@@ -104,14 +104,14 @@ class GitWindowActivatable(GObject.Object, Gedit.WindowActivatable):
             self.bus.send('/plugins/filebrowser', 'refresh')
 
     def notify_status(self, view_activatable, psepc):
-        location = view_activatable.view.get_buffer().get_location()
+        location = view_activatable.view.get_buffer().get_file().get_location()
 
         if location is not None:
             self.update_location(location)
 
     def tab_removed(self, window, tab):
         view = tab.get_view()
-        location = view.get_buffer().get_location()
+        location = view.get_buffer().get_file().get_location()
 
         if location is None:
             return
@@ -192,7 +192,7 @@ class GitWindowActivatable(GObject.Object, Gedit.WindowActivatable):
 
         # First get the status from the open documents
         for view_activatable in self.view_activatables:
-            doc_location = view_activatable.view.get_buffer().get_location()
+            doc_location = view_activatable.view.get_buffer().get_file().get_location()
 
             if doc_location is not None and doc_location.equal(location):
                 status = view_activatable.status
diff --git a/plugins/synctex/synctex/synctex.py b/plugins/synctex/synctex/synctex.py
index 4dfac55..8e2c132 100644
--- a/plugins/synctex/synctex/synctex.py
+++ b/plugins/synctex/synctex/synctex.py
@@ -128,7 +128,7 @@ class SynctexViewHelper:
         del self._highlight_tag
 
     def update_location(self):
-        gfile = self._doc.get_location()
+        gfile = self._doc.get_file().get_location()
 
         if gfile is None:
             return
@@ -262,7 +262,7 @@ class SynctexWindowActivatable(GObject.Object, Gedit.WindowActivatable):
 
     def add_helper(self, view, window):
         helper = SynctexViewHelper(view, window, self)
-        location = view.get_buffer().get_location()
+        location = view.get_buffer().get_file().get_location()
 
         if location is not None:
             self.view_dict[location.get_uri()] = helper
diff --git a/plugins/terminal/terminal.py b/plugins/terminal/terminal.py
index 4f4db10..01bf770 100644
--- a/plugins/terminal/terminal.py
+++ b/plugins/terminal/terminal.py
@@ -322,7 +322,7 @@ class TerminalPlugin(GObject.Object, Gedit.WindowActivatable):
     def get_active_document_directory(self):
         doc = self.window.get_active_document()
         if doc:
-            location = doc.get_location()
+            location = doc.get_file().get_location()
             if location and location.has_uri_scheme("file"):
                 directory = location.get_parent()
                 return directory.get_path()
diff --git a/plugins/zeitgeist/gedit-zeitgeist-plugin.c b/plugins/zeitgeist/gedit-zeitgeist-plugin.c
index c75ad76..ffebbc6 100644
--- a/plugins/zeitgeist/gedit-zeitgeist-plugin.c
+++ b/plugins/zeitgeist/gedit-zeitgeist-plugin.c
@@ -159,9 +159,11 @@ gedit_zeitgeist_plugin_send_event (GeditZeitgeistPlugin *plugin,
 {
        ZeitgeistEvent *event;
        ZeitgeistSubject *subject;
+       GtkSourceFile *file;
        GFile *location;
 
-       location = gedit_document_get_location (doc);
+       file = gedit_document_get_file (doc);
+       location = gtk_source_file_get_location (file);
 
        if (location != NULL)
        {
@@ -199,7 +201,6 @@ gedit_zeitgeist_plugin_send_event (GeditZeitgeistPlugin *plugin,
 
                g_object_unref (event);
                g_object_unref (subject);
-               g_object_unref (location);
        }
 }
 


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