[gedit] Use Gio.file_new_for... instead of old Gio.File



commit b3f6fd5c7ab9e433dd7698a25d9dc00867c04ad9
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sat Apr 2 14:45:03 2011 +0200

    Use Gio.file_new_for... instead of old Gio.File

 plugins/snippets/snippets/document.py |    2 +-
 plugins/snippets/snippets/manager.py  |   14 +++++++-------
 plugins/snippets/snippets/snippet.py  |    6 +++---
 3 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/plugins/snippets/snippets/document.py b/plugins/snippets/snippets/document.py
index 30498ee..41bd43e 100644
--- a/plugins/snippets/snippets/document.py
+++ b/plugins/snippets/snippets/document.py
@@ -863,7 +863,7 @@ class Document:
 
         def apply_uri_snippet(self, snippet, mime, uri):
                 # Remove file scheme
-                gfile = Gio.File(uri)
+                gfile = Gio.file_new_for_uri(uri)
                 pathname = ''
                 dirname = ''
                 ruri = ''
diff --git a/plugins/snippets/snippets/manager.py b/plugins/snippets/snippets/manager.py
index 70ee740..7ec4b95 100644
--- a/plugins/snippets/snippets/manager.py
+++ b/plugins/snippets/snippets/manager.py
@@ -173,7 +173,7 @@ class Manager(Gtk.Dialog, Gtk.Buildable):
                 cell.set_property('markup', model.get_value(iter, self.NAME_COLUMN))
 
         def on_tree_view_drag_data_get(self, widget, context, selection_data, info, time):
-                gfile = Gio.File(self._temp_export)
+                gfile = Gio.file_new_for_path(self._temp_export)
                 selection_data.set_uris([gfile.get_uri()])
 
         def on_tree_view_drag_begin(self, widget, context):
@@ -199,7 +199,9 @@ class Manager(Gtk.Dialog, Gtk.Buildable):
         def on_tree_view_drag_data_received(self, widget, context, x, y, selection, info, timestamp):
                 uris = selection.get_uris()
 
-                self.import_snippets(uris)
+                files = [Gio.file_new_for_uri(x) for x in uris]
+
+                self.import_snippets(files)
 
         def on_tree_view_drag_motion(self, widget, context, x, y, timestamp):
                 # Return False if we are dragging
@@ -738,12 +740,10 @@ class Manager(Gtk.Dialog, Gtk.Buildable):
 
                 return fil
 
-        def import_snippets(self, filenames):
+        def import_snippets(self, files):
                 success = True
 
-                for filename in filenames:
-                        gfile = Gio.File(filename)
-
+                for gfile in files:
                         if not Gedit.utils_location_has_file_scheme(gfile):
                                 continue
 
@@ -769,7 +769,7 @@ class Manager(Gtk.Dialog, Gtk.Buildable):
                         dialog.destroy()
                         return
 
-                f = dialog.get_uris()
+                f = dialog.get_files()
                 dialog.destroy()
 
                 self.import_snippets(f)
diff --git a/plugins/snippets/snippets/snippet.py b/plugins/snippets/snippets/snippet.py
index 13cf30d..b324503 100644
--- a/plugins/snippets/snippets/snippet.py
+++ b/plugins/snippets/snippets/snippet.py
@@ -42,12 +42,12 @@ class EvalUtilities:
                 return len(s.expandtabs(tablen))
 
         def _filename_to_uri(self, filename):
-                gfile = Gio.File(filename)
+                gfile = Gio.file_new_for_path(filename)
 
                 return gfile.get_uri()
 
         def util_readfile(self, filename):
-                stream = Gio.File(filename).read()
+                stream = Gio.file_new_for_path(filename).read()
 
                 if not stream:
                         return ''
@@ -58,7 +58,7 @@ class EvalUtilities:
                 return res
 
         def util_filesize(self, filename):
-                gfile = Gio.File(filename)
+                gfile = Gio.file_new_for_path(filename)
                 info = gfile.query_info(Gio.FILE_ATTRIBUTE_STANDARD_SIZE)
 
                 if not info:



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