summaryrefslogtreecommitdiff
path: root/plugins/externaltools/tools/filelookup.py
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-12-14 15:35:49 +0300
committermonsta <[email protected]>2016-12-19 14:16:30 +0300
commit4ea3ff79c350c9af799ed76e72e5c862af3eb73e (patch)
tree1eeb0c435c0e3adc512efb55c72cb3747cc27a58 /plugins/externaltools/tools/filelookup.py
parent38c20e460232c5f4ec7bf616180ff777b5d6b3a0 (diff)
downloadpluma-4ea3ff79c350c9af799ed76e72e5c862af3eb73e.tar.bz2
pluma-4ea3ff79c350c9af799ed76e72e5c862af3eb73e.tar.xz
externaltools plugin: port to gi and libpeas
note: tools manager dialog can now be invoked only via Pluma's menu. Preferences button in plugin manager is inactive. re-enabling it would mean introducing even more complexity, because we would need to pass a configure widget to libpeas, not the whole dialog. mostly adapted from: https://git.gnome.org/browse/gedit/commit/?id=8b6d353e0ab94ad52ce6119759db5e14b281fbba https://git.gnome.org/browse/gedit/commit/?id=2aa6071912dac227f04f44c07e07f159b77be7ff https://git.gnome.org/browse/gedit/commit/?id=09738cd6f5f24a37cb7dd85dfca7a5099529e5d2 https://git.gnome.org/browse/gedit/commit/?id=f08e9d2953fa213f77dce635127c3a0131fba02f https://git.gnome.org/browse/gedit/commit/?id=d09a703e84f818dcadd7bd1c16c2091305a691c2 https://git.gnome.org/browse/gedit/commit/?id=985f3908abe3f2ade53db1364dccf0d1fd61ec1b https://git.gnome.org/browse/gedit/commit/?id=b6086cab8c664d2cfb3e5b4a6d33c215d1b207da https://git.gnome.org/browse/gedit/commit/?id=befd854563e4691a6b75b03695d6a7c458836312 https://git.gnome.org/browse/gedit/commit/?id=cf7549c8e5944a3fbf9d18170b6e45a552071b4c https://git.gnome.org/browse/gedit/commit/?id=6c95d28a13ae87232346583a86ae525a22fcc651 https://git.gnome.org/browse/gedit/commit/?id=c70319048b42b898fd6c2f6ee37e98e54cea54be
Diffstat (limited to 'plugins/externaltools/tools/filelookup.py')
-rwxr-xr-xplugins/externaltools/tools/filelookup.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/externaltools/tools/filelookup.py b/plugins/externaltools/tools/filelookup.py
index ce4961f9..aa5abf9b 100755
--- a/plugins/externaltools/tools/filelookup.py
+++ b/plugins/externaltools/tools/filelookup.py
@@ -17,8 +17,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import os
-import gio
-import pluma
+from gi.repository import Gio, Pluma
class FileLookup:
"""
@@ -73,7 +72,7 @@ class AbsoluteFileLookupProvider(FileLookupProvider):
def lookup(self, path):
if os.path.isabs(path) and os.path.isfile(path):
- return gio.File(path)
+ return Gio.file_new_for_path(path)
else:
return None
@@ -93,7 +92,7 @@ class CwdFileLookupProvider(FileLookupProvider):
real_path = os.path.join(cwd, path)
if os.path.isfile(real_path):
- return gio.File(real_path)
+ return Gio.file_new_for_path(real_path)
else:
return None
@@ -110,14 +109,14 @@ class OpenDocumentRelPathFileLookupProvider(FileLookupProvider):
if path.startswith('/'):
return None
- for doc in pluma.app_get_default().get_documents():
+ for doc in Pluma.App.get_default().get_documents():
if doc.is_local():
location = doc.get_location()
if location:
rel_path = location.get_parent().get_path()
joined_path = os.path.join(rel_path, path)
if os.path.isfile(joined_path):
- return gio.File(joined_path)
+ return Gio.file_new_for_path(joined_path)
return None
@@ -135,7 +134,7 @@ class OpenDocumentFileLookupProvider(FileLookupProvider):
if path.startswith('/'):
return None
- for doc in pluma.app_get_default().get_documents():
+ for doc in Pluma.App.get_default().get_documents():
if doc.is_local():
location = doc.get_location()
if location and location.get_uri().endswith(path):